Skip to content

Commit 288b48c

Browse files
committed
🐛 fixed not found command.
1 parent dce9880 commit 288b48c

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed
File renamed without changes.

libs/Service/base/BaseService.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const assert = require('assert');
44
const _ = require('lodash');
55
const semverRegex = require('semver-regex');
6+
const os = require('os');
67

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

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

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

189190
if (env === 'production') { // fixed

libs/Service/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,7 @@ e.g.
376376

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

383382
const { fn, opts } = command;

plugins/commands/check/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module.exports = function(api) {
44

5+
const os = require('os');
56
const chalk = require('chalk');
67
const _ = require('lodash');
78
const { getPadLength } = require('@micro-app/shared-utils');
@@ -73,7 +74,7 @@ Examples:
7374
color = 'yellow';
7475
}
7576
const _warpperMicroVersion = chalk[color](`[ ${_microVersion} ]`);
76-
textStrs.push(`\n${' '.repeat(15) + chalk.gray('|--')} ${_microName} ${_warpperMicroVersion}`);
77+
textStrs.push(`${os.EOL}${' '.repeat(15) + chalk.gray('|--')} ${_microName} ${_warpperMicroVersion}`);
7778
});
7879
}
7980
api.logger.logo(textStrs.join(' '));

src/utils/logger.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

3-
const chalk = require('chalk').default;
3+
const os = require('os');
4+
const chalk = require('chalk');
45
const utils = require('util');
56

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

0 commit comments

Comments
 (0)