mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
fix: update plugin (#3895)
This commit is contained in:
parent
fc503321ae
commit
187a587e68
@ -1,3 +1,6 @@
|
|||||||
|
import { fsExists } from '@nocobase/utils';
|
||||||
|
import fs from 'fs';
|
||||||
|
import { resolve } from 'path';
|
||||||
import Application from '../application';
|
import Application from '../application';
|
||||||
import { ApplicationNotInstall } from '../errors/application-not-install';
|
import { ApplicationNotInstall } from '../errors/application-not-install';
|
||||||
|
|
||||||
@ -9,13 +12,17 @@ export default (app: Application) => {
|
|||||||
.option('--quickstart')
|
.option('--quickstart')
|
||||||
.action(async (...cliArgs) => {
|
.action(async (...cliArgs) => {
|
||||||
const [options] = 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()) {
|
if (await app.isInstalled()) {
|
||||||
await app.upgrade();
|
await app.upgrade();
|
||||||
} else {
|
} else {
|
||||||
await app.install();
|
await app.install();
|
||||||
}
|
}
|
||||||
|
|
||||||
app['_started'] = true;
|
app['_started'] = true;
|
||||||
await app.restart();
|
await app.restart();
|
||||||
app.log.info('app has been started');
|
app.log.info('app has been started');
|
||||||
|
@ -815,7 +815,16 @@ export class PluginManager {
|
|||||||
} else {
|
} else {
|
||||||
await this.upgradeByNpm(options as any);
|
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
1
storage/.gitignore
vendored
@ -3,3 +3,4 @@ tmp
|
|||||||
app.watch.ts
|
app.watch.ts
|
||||||
/e2e
|
/e2e
|
||||||
nocobase.conf
|
nocobase.conf
|
||||||
|
app-upgrading
|
Loading…
x
Reference in New Issue
Block a user