add install base
This commit is contained in:
@@ -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