Skip to content

Commit

Permalink
fix: update plugin (nocobase#3895)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenos authored Apr 3, 2024
1 parent fc50332 commit 187a587
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
11 changes: 9 additions & 2 deletions packages/core/server/src/commands/start.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { fsExists } from '@nocobase/utils';
import fs from 'fs';
import { resolve } from 'path';
import Application from '../application';
import { ApplicationNotInstall } from '../errors/application-not-install';

Expand All @@ -9,13 +12,17 @@ export default (app: Application) => {
.option('--quickstart')
.action(async (...cliArgs) => {
const [options] = cliArgs;
if (options.quickstart) {
const file = resolve(process.cwd(), 'storage/app-upgrading');
const upgrading = await fsExists(file);
if (upgrading) {
await app.upgrade();
await fs.promises.rm(file);
} else if (options.quickstart) {
if (await app.isInstalled()) {
await app.upgrade();
} else {
await app.install();
}

app['_started'] = true;
await app.restart();
app.log.info('app has been started');
Expand Down
11 changes: 10 additions & 1 deletion packages/core/server/src/plugin-manager/plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,16 @@ export class PluginManager {
} else {
await this.upgradeByNpm(options as any);
}
await this.app.upgrade();
const file = resolve(process.cwd(), 'storage/app-upgrading');
await fs.promises.writeFile(file, '', 'utf-8');
// await this.app.upgrade();
if (process.env.IS_DEV_CMD) {
await tsxRerunning();
} else {
await execa('yarn', ['nocobase', 'pm2-restart'], {
env: process.env,
});
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions storage/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ tmp
app.watch.ts
/e2e
nocobase.conf
app-upgrading

0 comments on commit 187a587

Please sign in to comment.