fix: upgrade

This commit is contained in:
sealday 2024-04-10 01:00:04 +08:00
parent 464a963316
commit 06c942103b
4 changed files with 25 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"@nocobase/server": patch
---
fix upgrade

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';
@ -10,7 +13,12 @@ export default (app: Application) => {
.action(async (...cliArgs) => {
const [options] = cliArgs;
console.log('start options', options);
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 {

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('pnpm', ['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