feat: add update
This commit is contained in:
		
							
								
								
									
										16
									
								
								src/command/update.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/command/update.ts
									
									
									
									
									
										Normal 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); | ||||||
| @@ -8,6 +8,8 @@ import './command/npm.ts'; | |||||||
| import './command/publish.ts'; | import './command/publish.ts'; | ||||||
| import './command/init.ts'; | import './command/init.ts'; | ||||||
| import './command/proxy.ts'; | import './command/proxy.ts'; | ||||||
|  | import './command/update.ts'; | ||||||
|  |  | ||||||
| import './command/sync/sync.ts'; | import './command/sync/sync.ts'; | ||||||
|  |  | ||||||
| import './command/app/index.ts'; | import './command/app/index.ts'; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user