feat: add importDemo option for plugin-client

This commit is contained in:
chenos 2021-10-07 19:35:53 +08:00
parent a2006fdc6a
commit 7432a485eb
2 changed files with 4 additions and 0 deletions

View File

@ -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 {

View File

@ -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;