chore: fix pre passing to atom.rc (#16311)
* chore: fix pre passing to versionH * preTypes => preType
This commit is contained in:
parent
ff1c90b638
commit
2ac677228d
2 changed files with 18 additions and 4 deletions
|
@ -12,6 +12,12 @@ const minimist = require('minimist')
|
|||
const writeFile = promisify(fs.writeFile)
|
||||
const readFile = promisify(fs.readFile)
|
||||
|
||||
const preType = {
|
||||
NONE: 'none',
|
||||
PARTIAL: 'partial',
|
||||
FULL: 'full'
|
||||
}
|
||||
|
||||
function parseCommandLine () {
|
||||
let help
|
||||
const opts = minimist(process.argv.slice(2), {
|
||||
|
@ -164,8 +170,8 @@ async function updateWinRC (components) {
|
|||
const arr = data.split('\n')
|
||||
arr.forEach((line, idx) => {
|
||||
if (line.includes('FILEVERSION')) {
|
||||
arr[idx] = ` FILEVERSION ${utils.makeVersion(components, ',', true)}`
|
||||
arr[idx + 1] = ` PRODUCTVERSION ${utils.makeVersion(components, ',', true)}`
|
||||
arr[idx] = ` FILEVERSION ${utils.makeVersion(components, ',', preType.PARTIAL)}`
|
||||
arr[idx + 1] = ` PRODUCTVERSION ${utils.makeVersion(components, ',', preType.PARTIAL)}`
|
||||
} else if (line.includes('FileVersion')) {
|
||||
arr[idx] = ` VALUE "FileVersion", "${utils.makeVersion(components, '.')}"`
|
||||
arr[idx + 5] = ` VALUE "ProductVersion", "${utils.makeVersion(components, '.')}"`
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue