fix: update plugin (#3895)

This commit is contained in:
chenos 2024-04-03 21:15:28 +08:00 committed by GitHub
parent fc503321ae
commit 187a587e68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 3 deletions

View File

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

View File

@ -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,
});
}
}
/**

1
storage/.gitignore vendored
View File

@ -3,3 +3,4 @@ tmp
app.watch.ts
/e2e
nocobase.conf
app-upgrading