add install base
This commit is contained in:
@@ -66,3 +66,24 @@ appManagerCommand
|
||||
}
|
||||
console.log('Restart App:', appKey);
|
||||
});
|
||||
|
||||
const pageListCommand = new Command('page-list')
|
||||
.alias('pl')
|
||||
.option('-a, --all', '列出前端页面的所有信息')
|
||||
.description('列出安装的前端页面')
|
||||
.action(async (opts) => {
|
||||
const manager = new AssistantApp(assistantConfig);
|
||||
await manager.loadConfig();
|
||||
const showInfos = manager.pageList();
|
||||
if (opts.all) {
|
||||
console.log('Installed Pages:', showInfos);
|
||||
} else {
|
||||
console.log(
|
||||
'Installed Pages:',
|
||||
showInfos.map((item) => {
|
||||
return { app: item.app, user: item.user, version: item.version };
|
||||
}),
|
||||
);
|
||||
}
|
||||
});
|
||||
program.addCommand(pageListCommand);
|
||||
|
||||
@@ -7,8 +7,10 @@ const command = new Command('server')
|
||||
.option('-n, --name <name>', '服务名称')
|
||||
.option('-p, --port <port>', '服务端口')
|
||||
.option('-s, --start', '是否启动服务')
|
||||
.option('-i, --home', '是否以home方式运行')
|
||||
.action((options) => {
|
||||
const { port } = options;
|
||||
const [_interpreter, execPath] = process.argv;
|
||||
const shellCommands = [];
|
||||
if (options.daemon) {
|
||||
shellCommands.push('-d');
|
||||
@@ -22,10 +24,23 @@ const command = new Command('server')
|
||||
if (port) {
|
||||
shellCommands.push(`-p ${port}`);
|
||||
}
|
||||
console.log(`Assistant server shell command: asst-server ${shellCommands.join(' ')}`);
|
||||
const child = spawnSync('asst-server', shellCommands, {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
if (options.home) {
|
||||
shellCommands.push('--home');
|
||||
}
|
||||
const basename = _interpreter.split('/').pop();
|
||||
|
||||
if (basename.includes('bun')) {
|
||||
console.log(`Assistant server shell command: bun src/run-server.ts server ${shellCommands.join(' ')}`);
|
||||
const child = spawnSync(_interpreter, ['src/run-server.ts', ...shellCommands], {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
} else {
|
||||
console.log(`Assistant server shell command: asst-server ${shellCommands.join(' ')}`);
|
||||
const child = spawnSync('asst-server', shellCommands, {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
program.addCommand(command);
|
||||
|
||||
Reference in New Issue
Block a user