feat: add importDemo option for plugin-client
This commit is contained in:
		
							parent
							
								
									a2006fdc6a
								
							
						
					
					
						commit
						7432a485eb
					
				@ -40,6 +40,9 @@ export default {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
    const app = this.app;
 | 
					    const app = this.app;
 | 
				
			||||||
    this.app.on('db.init', async () => {
 | 
					    this.app.on('db.init', async () => {
 | 
				
			||||||
 | 
					      if  (this.options.importDemo !== true) {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      const transaction = await app.db.sequelize.transaction();
 | 
					      const transaction = await app.db.sequelize.transaction();
 | 
				
			||||||
      const sqls = getInitSqls();
 | 
					      const sqls = getInitSqls();
 | 
				
			||||||
      try {
 | 
					      try {
 | 
				
			||||||
 | 
				
			|||||||
@ -73,6 +73,7 @@ function createApp(opts) {
 | 
				
			|||||||
  app.plugin(
 | 
					  app.plugin(
 | 
				
			||||||
    require(`@nocobase/plugin-client/${__filename.endsWith('.ts') ? 'src' : 'lib'}/server`).default, {
 | 
					    require(`@nocobase/plugin-client/${__filename.endsWith('.ts') ? 'src' : 'lib'}/server`).default, {
 | 
				
			||||||
    dist: path.resolve(process.cwd(), './dist'),
 | 
					    dist: path.resolve(process.cwd(), './dist'),
 | 
				
			||||||
 | 
					    importDemo: true,
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return app;
 | 
					  return app;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user