Skip to content

Commit

Permalink
refactor(CLI): Modern logs for uninstall command
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed Oct 4, 2021
1 parent 592596c commit 2787ea0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/plugins/standalone.js
Expand Up @@ -8,6 +8,7 @@ const stream = require('stream');
const { promisify } = require('util');
const fse = require('fs-extra');
const fetch = require('node-fetch');
const { legacy, log, progress, style } = require('@serverless/utils/log');
const currentVersion = require('../../package').version;
const ServerlessError = require('../serverless-error');
const standaloneUtils = require('../utils/standalone');
Expand All @@ -18,6 +19,7 @@ const pipeline = promisify(stream.pipeline);
const BINARY_TMP_PATH = path.resolve(os.tmpdir(), 'serverless-binary-tmp');

const BINARY_PATH = standaloneUtils.path;
const mainProgress = progress.get('main');

module.exports = class Standalone {
constructor(serverless, cliOptions) {
Expand Down Expand Up @@ -80,7 +82,14 @@ module.exports = class Standalone {
}

async uninstall() {
const commandRunStartTime = Date.now();
mainProgress.notice('Uninstalling standalone binary', { isMainEvent: true });
await fse.remove(path.dirname(BINARY_PATH));
this.serverless.cli.log('Uninstalled');
legacy.log('Uninstalled');
log.notice.success(
`Standalone binary uninstalled ${style.aside(
`(${Math.floor((Date.now() - commandRunStartTime) / 1000)}s)`
)}`
);
}
};

0 comments on commit 2787ea0

Please sign in to comment.