-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d9fb2f
commit 06dfd34
Showing
3 changed files
with
111 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const { promises: fs } = require('fs'); | ||
const semver = require('semver'); | ||
|
||
const { getMergedConfig } = require('./config'); | ||
const { runAsync, runSync } = require('./run'); | ||
const { writeJson, readJson } = require('./file'); | ||
|
||
const isWindows = process.platform === 'win32'; | ||
|
||
class ReleasePreparation { | ||
constructor(argv, cli, dir) { | ||
this.cli = cli; | ||
this.dir = dir; | ||
this.isSecurityRelease = argv.security; | ||
this.isLTS = await this.checkIsLTS; | ||
this.ltsCodename = ''; | ||
this.date = ''; | ||
this.config = getMergedConfig(this.dir); | ||
} | ||
|
||
async promote() { | ||
// Verify that CI is green | ||
|
||
// Verify that the PR has at least one approval from a Releaser | ||
|
||
// | ||
} | ||
|
||
async checkIsLTS() { | ||
const filePath = path.resolve('src', 'node_version.h'); | ||
const data = await fs.readFile(filePath, 'utf8'); | ||
const arr = data.split('\n'); | ||
|
||
for (let idx = 0; idx < arr.length; idx++) { | ||
const line = arr[idx]; | ||
if (line.includes('#define NODE_VERSION_IS_LTS')) { | ||
return line.split(' ')[2] === '1'; | ||
} | ||
} | ||
} | ||
|
||
// Returns the LTS codename for the Release line; e.g 'Erbium' for 12.x. | ||
async checkReleaseCodename() { | ||
const filePath = path.resolve('src', 'node_version.h'); | ||
const data = await fs.readFile(filePath, 'utf8'); | ||
const arr = data.split('\n'); | ||
|
||
for (let idx = 0; idx < arr.length; idx++) { | ||
const line = arr[idx]; | ||
if (line.includes('#define NODE_VERSION_LTS_CODENAME')) { | ||
return line.split(' ')[2]; | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
// Set up the branch so that nightly builds are produced with the next | ||
// version number and a pre-release tag. | ||
async setupForNextRelease() { | ||
const { versionComponents } = this; | ||
|
||
const filePath = path.resolve('src', 'node_version.h'); | ||
const data = await fs.readFile(filePath, 'utf8'); | ||
const arr = data.split('\n'); | ||
|
||
arr.forEach((line, idx) => { | ||
if (line.includes('#define NODE_PATCH_VERSION')) { | ||
arr[idx] = `#define NODE_PATCH_VERSION ${versionComponents.patch + 1}`; | ||
} else if (line.includes('#define NODE_VERSION_IS_RELEASE')) { | ||
arr[idx] = '#define NODE_VERSION_IS_RELEASE 0'; | ||
} | ||
}); | ||
|
||
await fs.writeFile(filePath, arr.join('\n')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters