7201845894
* refactor: auto generate electron_version.h from the version file * Update BUILD.gn Co-Authored-By: Jeremy Apthorp <nornagon@nornagon.net>
28 lines
585 B
JavaScript
28 lines
585 B
JavaScript
const fs = require('fs')
|
|
const path = require('path')
|
|
const semver = require('semver')
|
|
|
|
const outputPath = process.argv[2]
|
|
|
|
const currentVersion = fs.readFileSync(path.resolve(__dirname, '../ELECTRON_VERSION'), 'utf8').trim()
|
|
|
|
const parsed = semver.parse(currentVersion)
|
|
|
|
let prerelease = ''
|
|
if (parsed.prerelease && parsed.prerelease.length > 0) {
|
|
prerelease = parsed.prerelease.join('.')
|
|
}
|
|
|
|
const {
|
|
major,
|
|
minor,
|
|
patch
|
|
} = parsed
|
|
|
|
fs.writeFileSync(outputPath, JSON.stringify({
|
|
major,
|
|
minor,
|
|
patch,
|
|
prerelease,
|
|
has_prerelease: prerelease === '' ? 0 : 1
|
|
}, null, 2))
|