From 3c8d231a010c205c557dcf690cf28e98c22c774f Mon Sep 17 00:00:00 2001 From: lshadler Date: Sat, 27 Mar 2021 12:12:20 -0700 Subject: [PATCH] fix: preserve old behavior --- package.json | 2 +- src/commands/update.ts | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 63ce6ce5..85885eda 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "http-call": "^5.3.0", "lodash": "^4.17.21", "log-chopper": "^1.0.2", - "semver": "^7.3.5", + "semver": "^7.3.4", "tar-fs": "^2.1.1" }, "devDependencies": { diff --git a/src/commands/update.ts b/src/commands/update.ts index fe8df3c6..885c0b52 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -71,10 +71,9 @@ export default class UpdateCommand extends Command { if (flags['switch-to']) { targetVersion = semver.clean(flags['switch-to']) this.debug(`Flag overriden target version: ${targetVersion}`) - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [_, channel] = targetVersion?.split('-') || ['', ''] - if (channel) { - this.channel = channel.substr(0, channel.indexOf('.')) + const versionParts = targetVersion?.split('-') || ['', ''] + if (versionParts && versionParts[1]) { + this.channel = versionParts[1].substr(0, versionParts[1].indexOf('.')) } this.debug(`Flag overriden target channel: ${this.channel}`) } @@ -155,7 +154,7 @@ export default class UpdateCommand extends Command { bin: this.config.bin, platform: this.config.platform, arch: this.config.arch, - ext: '.tar.gz', + ext: targetVersion ? '.tar.gz' : 'gz', })) const {response: stream} = await http.stream(gzUrl)