Skip to content

Commit

Permalink
🐛 fixed not found command.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyao89 committed Oct 30, 2019
1 parent dce9880 commit 288b48c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
File renamed without changes.
5 changes: 3 additions & 2 deletions libs/Service/base/BaseService.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const assert = require('assert');
const _ = require('lodash');
const semverRegex = require('semver-regex');
const os = require('os');

const CONSTANTS = require('../../../libs/Constants');

Expand Down Expand Up @@ -78,7 +79,7 @@ class BaseService {
if (extraConfig && _.isPlainObject(extraConfig)) {
Object.keys(extraConfig).forEach(key => {
const item = extraConfig[key];
logger.debug(`【 Extra Config 】${key}: \n${JSON.stringify(item, false, 4)}`);
logger.debug(`【 Extra Config 】${key}: ${os.EOL}${JSON.stringify(item, false, 4)}`);
});
}

Expand Down Expand Up @@ -183,7 +184,7 @@ class BaseService {
process.env.HOSTNAME = config.HOSTNAME;
}
Object.assign(this.env, config);
logger.debug('dotenv parsed envs:\n', JSON.stringify(this.env, null, 4));
logger.debug(`dotenv parsed envs:${os.EOL}`, JSON.stringify(this.env, null, 4));
}

if (env === 'production') { // fixed
Expand Down
3 changes: 1 addition & 2 deletions libs/Service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,7 @@ e.g.

const command = this.commands[name];
if (!command) {
logger.error(`Command "${name}" does not exists`);
return this.runCommand('help', { _: [] });
logger.throw(`Command "${name}" does not exists!`);
}

const { fn, opts } = command;
Expand Down
3 changes: 2 additions & 1 deletion plugins/commands/check/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module.exports = function(api) {

const os = require('os');
const chalk = require('chalk');
const _ = require('lodash');
const { getPadLength } = require('@micro-app/shared-utils');
Expand Down Expand Up @@ -73,7 +74,7 @@ Examples:
color = 'yellow';
}
const _warpperMicroVersion = chalk[color](`[ ${_microVersion} ]`);
textStrs.push(`\n${' '.repeat(15) + chalk.gray('|--')} ${_microName} ${_warpperMicroVersion}`);
textStrs.push(`${os.EOL}${' '.repeat(15) + chalk.gray('|--')} ${_microName} ${_warpperMicroVersion}`);
});
}
api.logger.logo(textStrs.join(' '));
Expand Down
5 changes: 3 additions & 2 deletions src/utils/logger.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const chalk = require('chalk').default;
const os = require('os');
const chalk = require('chalk');
const utils = require('util');

const { logger } = require('@micro-app/shared-utils');
Expand All @@ -12,7 +13,7 @@ const toString = {
logo() {
const message = utils.format(...(arguments || []));
const { NAME } = CONSTANTS;
return `${chalk.bgHex('#662F88')(` ${NAME} `)} ${message} \r\n`;
return `${chalk.bgHex('#662F88')(` ${NAME} `)} ${message} ${os.EOL}`;
},
};

Expand Down

0 comments on commit 288b48c

Please sign in to comment.