Skip to content

Commit bf26b96

Browse files
rvaggFishrock123
authored andcommitted
src: add 'dynamic' process.release.lts property
This makes the process.release.lts property configurable by a constant. This ref is the original PR to v6.x. Refs: nodejs#3212 Conflicts: doc/api/process.md PR-URL: nodejs#16656 Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
1 parent 40d8211 commit bf26b96

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

doc/api/process.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,11 @@ tarball.
13961396
compiling Node.js native add-ons. _This property is only present on Windows
13971397
builds of Node.js and will be missing on all other platforms._
13981398
* `lts` {string} a string label identifying the [LTS][] label for this release.
1399-
If the Node.js release is not an LTS release, this will be `undefined`.
1399+
This property only exists for LTS releases and is `undefined` for all other
1400+
release types, including _Current_ releases. Currently the valid values are:
1401+
- `'Argon'` for the v4.x LTS line beginning with v4.2.0.
1402+
- `'Boron'` for the v6.x LTS line beginning with v6.9.0.
1403+
- `'Carbon'` for the v8.x LTS line beginning with v8.9.1.
14001404

14011405
For example:
14021406

src/node.cc

+5
Original file line numberDiff line numberDiff line change
@@ -3458,6 +3458,11 @@ void SetupProcessObject(Environment* env,
34583458
READONLY_PROPERTY(release, "name",
34593459
OneByteString(env->isolate(), NODE_RELEASE));
34603460

3461+
#if NODE_VERSION_IS_LTS
3462+
READONLY_PROPERTY(release, "lts",
3463+
OneByteString(env->isolate(), NODE_VERSION_LTS_CODENAME));
3464+
#endif
3465+
34613466
// if this is a release build and no explicit base has been set
34623467
// substitute the standard release download URL
34633468
#ifndef NODE_RELEASE_URLBASE

test/parallel/test-process-release.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
const versionParts = process.versions.node.split('.');
5+
6+
assert.equal(process.release.name, 'node');
7+
8+
// it's expected that future LTS release lines will have additional
9+
// branches in here
10+
if (versionParts[0] === '4' && versionParts[1] >= 2) {
11+
assert.equal(process.release.lts, 'Argon');
12+
} else if (versionParts[0] === '6' && versionParts[1] >= 9) {
13+
assert.equal(process.release.lts, 'Boron');
14+
} else {
15+
assert.strictEqual(process.release.lts, undefined);
16+
}

0 commit comments

Comments
 (0)