-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: automate creation of the first LTS release (#514)
Add an option to `git node release` that marks the release being created as the transition from Current to LTS.
- Loading branch information
1 parent
6dab341
commit 53e68b4
Showing
7 changed files
with
276 additions
and
7 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
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,61 @@ | ||
'use strict'; | ||
|
||
function getEOLDate(ltsStartDate) { | ||
// Maintenance LTS lasts for 18 months. | ||
const result = getLTSMaintenanceStartDate(ltsStartDate); | ||
result.setMonth(result.getMonth() + 18); | ||
return result; | ||
} | ||
|
||
function getLTSMaintenanceStartDate(ltsStartDate) { | ||
// Active LTS lasts for one year. | ||
const result = new Date(ltsStartDate); | ||
result.setMonth(result.getMonth() + 12); | ||
return result; | ||
} | ||
|
||
function getStartLTSBlurb({ date, ltsCodename, versionComponents }) { | ||
const dateFormat = { month: 'long', year: 'numeric' }; | ||
// TODO pull these from the schedule.json in the Release repo? | ||
const mainDate = getLTSMaintenanceStartDate(date); | ||
const mainStart = mainDate.toLocaleString('en-US', dateFormat); | ||
const eolDate = getEOLDate(date); | ||
const eol = eolDate.toLocaleString('en-US', dateFormat); | ||
const { major } = versionComponents; | ||
return [ | ||
/* eslint-disable max-len */ | ||
`This release marks the transition of Node.js ${major}.x into Long Term Support (LTS)`, | ||
`with the codename '${ltsCodename}'. The ${major}.x release line now moves into "Active LTS"`, | ||
`and will remain so until ${mainStart}. After that time, it will move into`, | ||
`"Maintenance" until end of life in ${eol}.` | ||
/* eslint-enable */ | ||
].join('\n'); | ||
} | ||
|
||
function updateTestProcessRelease(test, { versionComponents, ltsCodename }) { | ||
if (test.includes(ltsCodename)) { | ||
return test; | ||
} | ||
const inLines = test.split('\n'); | ||
const outLines = []; | ||
const { major, minor } = versionComponents; | ||
for (const line of inLines) { | ||
if (line === '} else {') { | ||
outLines.push(`} else if (versionParts[0] === '${major}' ` + | ||
`&& versionParts[1] >= ${minor}) {` | ||
); | ||
outLines.push( | ||
` assert.strictEqual(process.release.lts, '${ltsCodename}');` | ||
); | ||
} | ||
outLines.push(line); | ||
} | ||
return outLines.join('\n'); | ||
} | ||
|
||
module.exports = { | ||
getEOLDate, | ||
getLTSMaintenanceStartDate, | ||
getStartLTSBlurb, | ||
updateTestProcessRelease | ||
}; |
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,26 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const assert = require('assert'); | ||
const versionParts = process.versions.node.split('.'); | ||
|
||
assert.strictEqual(process.release.name, 'node'); | ||
|
||
// It's expected that future LTS release lines will have additional | ||
// branches in here | ||
if (versionParts[0] === '4' && versionParts[1] >= 2) { | ||
assert.strictEqual(process.release.lts, 'Argon'); | ||
} else if (versionParts[0] === '6' && versionParts[1] >= 9) { | ||
assert.strictEqual(process.release.lts, 'Boron'); | ||
} else if (versionParts[0] === '8' && versionParts[1] >= 9) { | ||
assert.strictEqual(process.release.lts, 'Carbon'); | ||
} else if (versionParts[0] === '10' && versionParts[1] >= 13) { | ||
assert.strictEqual(process.release.lts, 'Dubnium'); | ||
} else if (versionParts[0] === '12' && versionParts[1] >= 13) { | ||
assert.strictEqual(process.release.lts, 'Erbium'); | ||
} else if (versionParts[0] === '14' && versionParts[1] >= 15) { | ||
assert.strictEqual(process.release.lts, 'Fermium'); | ||
} else { | ||
assert.strictEqual(process.release.lts, undefined); | ||
} |
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,24 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const assert = require('assert'); | ||
const versionParts = process.versions.node.split('.'); | ||
|
||
assert.strictEqual(process.release.name, 'node'); | ||
|
||
// It's expected that future LTS release lines will have additional | ||
// branches in here | ||
if (versionParts[0] === '4' && versionParts[1] >= 2) { | ||
assert.strictEqual(process.release.lts, 'Argon'); | ||
} else if (versionParts[0] === '6' && versionParts[1] >= 9) { | ||
assert.strictEqual(process.release.lts, 'Boron'); | ||
} else if (versionParts[0] === '8' && versionParts[1] >= 9) { | ||
assert.strictEqual(process.release.lts, 'Carbon'); | ||
} else if (versionParts[0] === '10' && versionParts[1] >= 13) { | ||
assert.strictEqual(process.release.lts, 'Dubnium'); | ||
} else if (versionParts[0] === '12' && versionParts[1] >= 13) { | ||
assert.strictEqual(process.release.lts, 'Erbium'); | ||
} else { | ||
assert.strictEqual(process.release.lts, undefined); | ||
} |
Oops, something went wrong.