Skip to content

Commit

Permalink
fix: preserve old behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
sumwatshade committed Mar 27, 2021
1 parent 47f910e commit 3c8d231
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
9 changes: 4 additions & 5 deletions src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3c8d231

Please sign in to comment.