Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: channel parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Apr 9, 2018
1 parent 4c67d30 commit 0aa73ba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export interface IConfig {

const _pjson = require('../package.json')

function channelFromVersion(version: string) {
const m = version.match(/[^-]+(?:-([^.]+))?/)
return (m && m[1]) || 'stable'
}

export class Config implements IConfig {
_base = `${_pjson.name}@${_pjson.version}`
name!: string
Expand Down Expand Up @@ -152,8 +157,7 @@ export class Config implements IConfig {
this.pjson = plugin.pjson
this.name = this.pjson.name
this.version = this.pjson.version || '0.0.0'
const [, versionSuffix] = this.version.split('-')
this.channel = (versionSuffix || '').split('.')[0] || 'stable'
this.channel = channelFromVersion(this.version)

this.arch = (os.arch() === 'ia32' ? 'x86' : os.arch() as any)
this.platform = os.platform() as any
Expand Down

0 comments on commit 0aa73ba

Please sign in to comment.