chore: fix pre passing to atom.rc (#16311)

* chore: fix pre passing to versionH

* preTypes => preType
This commit is contained in:
Shelley Vohr 2019-01-07 13:41:07 -08:00 committed by GitHub
parent ff1c90b638
commit 2ac677228d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View file

@ -8,6 +8,12 @@ const { promisify } = require('util')
const readFile = promisify(fs.readFile)
const gitDir = path.resolve(__dirname, '..', '..')
const preType = {
NONE: 'none',
PARTIAL: 'partial',
FULL: 'full'
}
const getCurrentDate = () => {
const d = new Date()
const dd = `${d.getDate()}`.padStart(2, '0')
@ -23,9 +29,11 @@ const isStable = v => {
return !!(parsed && parsed.prerelease.length === 0)
}
const makeVersion = (components, delim, withPre = false) => {
const makeVersion = (components, delim, pre = preType.NONE) => {
let version = [components.major, components.minor, components.patch].join(delim)
if (withPre) {
if (pre === preType.PARTIAL) {
version += `${delim}${components.pre[1]}`
} else if (pre === preType.FULL) {
version += `-${components.pre[0]}${delim}${components.pre[1]}`
}
return version