From 7432a485ebf1740289dd8a879dd27b2098f12908 Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 7 Oct 2021 19:35:53 +0800 Subject: [PATCH] feat: add importDemo option for plugin-client --- packages/plugin-client/src/server.ts | 3 +++ packages/plugin-multi-apps/src/server.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/packages/plugin-client/src/server.ts b/packages/plugin-client/src/server.ts index 31467d18b..91336d2ca 100644 --- a/packages/plugin-client/src/server.ts +++ b/packages/plugin-client/src/server.ts @@ -40,6 +40,9 @@ export default { }); const app = this.app; this.app.on('db.init', async () => { + if (this.options.importDemo !== true) { + return; + } const transaction = await app.db.sequelize.transaction(); const sqls = getInitSqls(); try { diff --git a/packages/plugin-multi-apps/src/server.ts b/packages/plugin-multi-apps/src/server.ts index 0cb37b77b..32dd802ac 100644 --- a/packages/plugin-multi-apps/src/server.ts +++ b/packages/plugin-multi-apps/src/server.ts @@ -73,6 +73,7 @@ function createApp(opts) { app.plugin( require(`@nocobase/plugin-client/${__filename.endsWith('.ts') ? 'src' : 'lib'}/server`).default, { dist: path.resolve(process.cwd(), './dist'), + importDemo: true, }); return app;