Skip to content

Commit 187a587

Browse files
authored
fix: update plugin (nocobase#3895)
1 parent fc50332 commit 187a587

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

packages/core/server/src/commands/start.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { fsExists } from '@nocobase/utils';
2+
import fs from 'fs';
3+
import { resolve } from 'path';
14
import Application from '../application';
25
import { ApplicationNotInstall } from '../errors/application-not-install';
36

@@ -9,13 +12,17 @@ export default (app: Application) => {
912
.option('--quickstart')
1013
.action(async (...cliArgs) => {
1114
const [options] = cliArgs;
12-
if (options.quickstart) {
15+
const file = resolve(process.cwd(), 'storage/app-upgrading');
16+
const upgrading = await fsExists(file);
17+
if (upgrading) {
18+
await app.upgrade();
19+
await fs.promises.rm(file);
20+
} else if (options.quickstart) {
1321
if (await app.isInstalled()) {
1422
await app.upgrade();
1523
} else {
1624
await app.install();
1725
}
18-
1926
app['_started'] = true;
2027
await app.restart();
2128
app.log.info('app has been started');

packages/core/server/src/plugin-manager/plugin-manager.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,16 @@ export class PluginManager {
815815
} else {
816816
await this.upgradeByNpm(options as any);
817817
}
818-
await this.app.upgrade();
818+
const file = resolve(process.cwd(), 'storage/app-upgrading');
819+
await fs.promises.writeFile(file, '', 'utf-8');
820+
// await this.app.upgrade();
821+
if (process.env.IS_DEV_CMD) {
822+
await tsxRerunning();
823+
} else {
824+
await execa('yarn', ['nocobase', 'pm2-restart'], {
825+
env: process.env,
826+
});
827+
}
819828
}
820829

821830
/**

storage/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ tmp
33
app.watch.ts
44
/e2e
55
nocobase.conf
6+
app-upgrading

0 commit comments

Comments
 (0)