refactor: replace atom_version and friends with electron_version (#18847)

This commit is contained in:
Samuel Attard 2019-06-17 13:37:55 -07:00 committed by GitHub
parent c9bca78a7a
commit 4dc38d39e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 71 additions and 70 deletions

View file

@ -138,20 +138,20 @@ async function commitVersionBump (version) {
await GitProcess.exec(gitArgs, gitDir)
}
// updates atom_version.h file with new semver values
// updates electron_version.h file with new semver values
// TODO(codebytere): auto-generate this
async function updateVersionH (components) {
const filePath = path.resolve(__dirname, '..', 'atom', 'common', 'atom_version.h')
const filePath = path.resolve(__dirname, '..', 'atom', 'common', 'electron_version.h')
const data = await readFile(filePath, 'utf8')
const arr = data.split('\n')
const pre = components.pre && components.pre.length >= 2 ? `-${components.pre[0]}.${components.pre[1]}` : null
arr.forEach((item, idx) => {
if (item.includes('#define ATOM_MAJOR_VERSION')) {
arr[idx] = `#define ATOM_MAJOR_VERSION ${components.major}`
arr[idx + 1] = `#define ATOM_MINOR_VERSION ${components.minor}`
arr[idx + 2] = `#define ATOM_PATCH_VERSION ${components.patch}`
arr[idx + 4] = pre ? `#define ATOM_PRE_RELEASE_VERSION ${pre}` : '// #define ATOM_PRE_RELEASE_VERSION'
if (item.includes('#define ELECTRON_MAJOR_VERSION')) {
arr[idx] = `#define ELECTRON_MAJOR_VERSION ${components.major}`
arr[idx + 1] = `#define ELECTRON_MINOR_VERSION ${components.minor}`
arr[idx + 2] = `#define ELECTRON_PATCH_VERSION ${components.patch}`
arr[idx + 4] = pre ? `#define ELECTRON_PRE_RELEASE_VERSION ${pre}` : '// #define ELECTRON_PRE_RELEASE_VERSION'
}
})
await writeFile(filePath, arr.join('\n'))