diff --git a/src/core/index.ts b/src/core/index.ts index d1816a6b..23cc25d1 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -44,9 +44,11 @@ export default class Feflow { async init(cmd: string) { if (cmd === 'config') { + await this.initClient(); await this.loadNative(); } else { await this.initClient(); + await this.initPackageManager(); await this.checkUpdate(); await this.loadNative(); await loadPlugins(this); @@ -73,7 +75,15 @@ export default class Feflow { 'private': true }, null, 2)); } + + resolve(); + }); + } + + initPackageManager() { + const { root } = this; + return new Promise((resolve, reject) => { if (!this.config || !this.config.packageManager) { const isInstalled = (packageName: string) => { try { diff --git a/src/core/native/config.ts b/src/core/native/config.ts index 8bf32653..ae0209e9 100644 --- a/src/core/native/config.ts +++ b/src/core/native/config.ts @@ -8,15 +8,18 @@ module.exports = (ctx: any) => { switch (action) { case 'get': console.log(ctx.config[key]); + break; case 'set': config[key] = value; safeDump(config, configPath); + break; case 'list': let str = ''; for (let prop in config) { str += prop + ' = ' + config[prop] + '\n'; } console.log(str.replace(/\s+$/g, '')); + break; default: return null; }