fix(server): adjust the position of beforeInstall
This commit is contained in:
parent
8e4336cbe1
commit
851c97b52a
@ -1,5 +1,5 @@
|
||||
import { resolve } from 'path';
|
||||
import { Application } from '@nocobase/server';
|
||||
import { resolve } from 'path';
|
||||
|
||||
const start = Date.now();
|
||||
|
||||
@ -9,6 +9,12 @@ const api = new Application({
|
||||
? {
|
||||
dialect: process.env.DB_DIALECT as any,
|
||||
storage: resolve(process.cwd(), './db.sqlite'),
|
||||
pool: {
|
||||
max: 5,
|
||||
min: 0,
|
||||
acquire: 60000,
|
||||
idle: 10000,
|
||||
},
|
||||
logging: process.env.DB_LOG_SQL === 'on' ? console.log : false,
|
||||
define: {},
|
||||
sync: {
|
||||
|
@ -21,7 +21,7 @@ describe('application life cycle', () => {
|
||||
return 'Test';
|
||||
}
|
||||
|
||||
load() {
|
||||
async load() {
|
||||
loadFn();
|
||||
this.app.on('beforeInstall', () => {
|
||||
installFn();
|
||||
|
@ -208,12 +208,11 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
||||
}
|
||||
|
||||
async install(options?: InstallOptions) {
|
||||
await this.emitAsync('beforeInstall', this, options);
|
||||
if (options?.clean) {
|
||||
await this.db.clean(isBoolean(options.clean) ? { drop: options.clean } : options.clean);
|
||||
}
|
||||
await this.db.sync(options?.sync);
|
||||
|
||||
await this.emitAsync('beforeInstall', this, options);
|
||||
await this.emitAsync('installing', this, options);
|
||||
await this.emitAsync('afterInstall', this, options);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ export function createI18n(options: ApplicationOptions) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
export function createCli(app: Application, options: ApplicationOptions) {
|
||||
export function createCli(app: Application, options: ApplicationOptions): Command {
|
||||
const cli = new Command();
|
||||
|
||||
cli
|
||||
|
Loading…
Reference in New Issue
Block a user