fix: app quickstart (#2921)

* fix: app quickstart

* fix: test

* fix: test

---------

Co-authored-by: Chareice <chareice@live.com>
This commit is contained in:
chenos 2023-10-27 19:40:44 +08:00 committed by GitHub
parent 1ff3aa94fc
commit 6f3681c2aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import compression from 'compression';
import { EventEmitter } from 'events';
import fs from 'fs';
import http, { IncomingMessage, ServerResponse } from 'http';
import compose from 'koa-compose';
import { promisify } from 'node:util';
import { resolve } from 'path';
import qs from 'qs';
@ -13,12 +14,11 @@ import { parse } from 'url';
import xpipe from 'xpipe';
import { AppSupervisor } from '../app-supervisor';
import { ApplicationOptions } from '../application';
import { getPackageDirByExposeUrl, getPackageNameByExposeUrl, PLUGIN_STATICS_PATH } from '../plugin-manager';
import { PLUGIN_STATICS_PATH, getPackageDirByExposeUrl, getPackageNameByExposeUrl } from '../plugin-manager';
import { applyErrorWithArgs, getErrorWithCode } from './errors';
import { IPCSocketClient } from './ipc-socket-client';
import { IPCSocketServer } from './ipc-socket-server';
import { WSServer } from './ws-server';
import compose from 'koa-compose';
const compress = promisify(compression());
@ -202,7 +202,7 @@ export class Gateway extends EventEmitter {
if (appStatus === 'initialized') {
const appInstance = await AppSupervisor.getInstance().getApp(handleApp);
appInstance.runAsCLI(['start'], { from: 'user' });
appInstance.runCommand('start', '--quickstart');
appStatus = AppSupervisor.getInstance().getAppStatus(handleApp);
}

View File

@ -274,7 +274,7 @@ describe('multiple apps', () => {
values: {
name: subAppName,
options: {
plugins: [],
plugins: ['nocobase'],
},
},
context: {
@ -306,7 +306,7 @@ describe('multiple apps', () => {
});
await app.start();
await sleep(1000);
await sleep(5000);
expect(AppSupervisor.getInstance().hasApp(subAppName)).toBeTruthy();
const appStatus = AppSupervisor.getInstance().getAppStatus(subAppName);
expect(appStatus).toEqual('running');

View File

@ -171,7 +171,7 @@ export class PluginMultiAppManager extends Plugin {
context: options.context,
});
const startPromise = subApp.runAsCLI(['start', '--quickstart'], { from: 'user' });
const startPromise = subApp.runCommand('start', '--quickstart');
if (options?.context?.waitSubAppInstall) {
await startPromise;
@ -227,7 +227,7 @@ export class PluginMultiAppManager extends Plugin {
// must skip load on upgrade
if (!loadButNotStart) {
await subApp.runCommand('start');
await subApp.runCommand('start', '--quickstart');
}
}
@ -290,7 +290,7 @@ export class PluginMultiAppManager extends Plugin {
if (!appSupervisor.hasApp(subAppInstance.name)) {
await AppSupervisor.getInstance().getApp(subAppInstance.name);
} else if (appSupervisor.getAppStatus(subAppInstance.name) === 'initialized') {
(await AppSupervisor.getInstance().getApp(subAppInstance.name)).runCommand('start');
(await AppSupervisor.getInstance().getApp(subAppInstance.name)).runCommand('start', '--quickstart');
}
})(),
);