diff --git a/package.json b/package.json index bba35b10..6b3f08f7 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@artus-cli/artus-cli": "^0.2.9", "@artus-cli/plugin-autocomplete": "^0.1.1", "@artus-cli/plugin-version": "^1.0.1", - "@eggjs/utils": "^3.0.1", + "@eggjs/utils": "^4.0.2", "c8": "^10.0.0", "detect-port": "^2.0.0", "egg-ts-helper": "^2.1.0", diff --git a/src/cmd/dev.ts b/src/cmd/dev.ts index aa21b8b3..568774cc 100644 --- a/src/cmd/dev.ts +++ b/src/cmd/dev.ts @@ -61,16 +61,19 @@ export class DevCommand extends BaseCommand { }); if (!this.port) { - let configuredPort; + let configuredPort: number | undefined; try { - const configuration = utils.getConfig({ + const configuration = await utils.getConfig({ framework: this.framework, baseDir: this.base, env: 'local', }); configuredPort = configuration?.cluster?.listen?.port; - } catch (_) { /** skip when failing to read the configuration */ } - + } catch (err) { + /** skip when failing to read the configuration */ + debug('getConfig error: %s, framework: %o, baseDir: %o, env: local', + err, this.framework, this.base); + } if (configuredPort) { this.port = configuredPort; debug(`use port ${this.port} from configuration file`); @@ -79,7 +82,8 @@ export class DevCommand extends BaseCommand { debug('detect available port'); this.port = await detect(defaultPort); if (this.port !== defaultPort) { - console.warn('[egg-bin] server port %s is in use, now using port %o', defaultPort, this.port); + console.warn('[egg-bin] server port %s is in use, now using port %o', + defaultPort, this.port); } debug(`use available port ${this.port}`); }