(options: PerformCliSelfUpdateOptions = {})
| 177 | } |
| 178 | |
| 179 | export function performCliSelfUpdate(options: PerformCliSelfUpdateOptions = {}): Promise<UpdateCommandResult> { |
| 180 | const platformName = options.platform ?? process.platform |
| 181 | const npmCmd = platformName === 'win32' ? 'npm.cmd' : 'npm' |
| 182 | const args = ['install', '-g', `${PACKAGE_NAME}@latest`] |
| 183 | const write = options.write ?? ((text) => process.stderr.write(text)) |
| 184 | const runCommand = options.runCommand ?? ((command, commandArgs) => runNpmUpdateCommand(command, commandArgs, write)) |
| 185 | |
| 186 | write(`\n Running: ${npmCmd} ${args.join(' ')}\n\n`) |
| 187 | return runCommand(npmCmd, args) |
| 188 | } |
| 189 | |
| 190 | function isDevEnvironment(): boolean { |
| 191 | if (process.env.CHATLAB_SKIP_UPDATE_CHECK) return true |
no test coverage detected