diff --git a/packages/core/server/src/commands/console.ts b/packages/core/server/src/commands/console.ts index ee80a3c85..1f2ea878d 100644 --- a/packages/core/server/src/commands/console.ts +++ b/packages/core/server/src/commands/console.ts @@ -3,16 +3,19 @@ import Application from '../application'; const REPL = require('repl'); export default (app: Application) => { - app.command('console').action(async () => { - await app.start(); - const repl = (REPL.start('nocobase > ').context.app = app); - repl.on('exit', async function (err) { - if (err) { - console.log(err); - process.exit(1); - } - await app.stop(); - process.exit(0); + app + .command('console') + .preload() + .action(async () => { + await app.start(); + const repl = (REPL.start('nocobase > ').context.app = app); + repl.on('exit', async function (err) { + if (err) { + console.log(err); + process.exit(1); + } + await app.stop(); + process.exit(0); + }); }); - }); }; diff --git a/packages/core/server/src/commands/index.ts b/packages/core/server/src/commands/index.ts index 4a0fd5709..c518ecb8d 100644 --- a/packages/core/server/src/commands/index.ts +++ b/packages/core/server/src/commands/index.ts @@ -11,9 +11,9 @@ import restart from './restart'; import start from './start'; import stop from './stop'; import upgrade from './upgrade'; - +import consoleCommand from './console'; export function registerCli(app: Application) { - // console(app); + consoleCommand(app); dbAuth(app); createMigration(app); dbClean(app);