feat: add update

This commit is contained in:
熊潇 2025-05-16 02:57:35 +08:00
parent 4e007d48a4
commit 2e0d8a0581
2 changed files with 18 additions and 0 deletions

16
src/command/update.ts Normal file
View File

@ -0,0 +1,16 @@
import { program, Command } from '@/program.ts';
import { execSync } from 'node:child_process';
const update = new Command('update')
.option('-g --global', 'update global')
.description('update cli')
.action((opts) => {
try {
const cmd = opts.global ? 'npm install -g @kevisual/envision-cli' : 'npm install -D @kevisual/envision-cli';
execSync(cmd, { stdio: 'inherit', encoding: 'utf-8' });
} catch (error) {
console.error('Error updating CLI:', error);
}
});
program.addCommand(update);

View File

@ -8,6 +8,8 @@ import './command/npm.ts';
import './command/publish.ts';
import './command/init.ts';
import './command/proxy.ts';
import './command/update.ts';
import './command/sync/sync.ts';
import './command/app/index.ts';