Skip to content

Commit 6222ba9

Browse files
committed
Move version check from rush-lib to rush
1 parent 8ee395c commit 6222ba9

3 files changed

Lines changed: 32 additions & 31 deletions

File tree

‎apps/rush-lib/src/start.ts‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import * as colors from 'colors';
5-
import * as semver from 'semver';
6-
7-
const nodeVersion: string = process.versions.node;
8-
9-
// tslint:disable-next-line
10-
11-
// We are on an ancient version of NodeJS that is known not to work with Rush
12-
if (semver.satisfies(nodeVersion, '<= 6.4.0')) {
13-
console.error(colors.red(`Your version of Node.js (${nodeVersion}) is very old and incompatible with Rush.`
14-
+ ` Please upgrade to the latest Long-Term Support (LTS) version.`));
15-
process.exit(1);
16-
}
17-
18-
// We are on a much newer release than we have tested and support
19-
// tslint:disable-next-line
20-
else if (semver.satisfies(nodeVersion, '>=9.0.0')) {
21-
console.warn(colors.yellow(`Your version of Node.js (${nodeVersion}) has not been tested with this release of Rush.`
22-
+ ` The Rush team will not accept issue reports for it.`
23-
+ ` Please consider upgrading Rush or downgrading Node.js.`));
24-
}
25-
26-
// We are not on an LTS release
27-
// tslint:disable-next-line
28-
else if (!semver.satisfies(nodeVersion, '^6.9.0')
29-
&& !semver.satisfies(nodeVersion, '^8.9.0')) {
30-
console.warn(colors.yellow(`Your version of Node.js (${nodeVersion}) is not a Long-Term Support (LTS) release.`
31-
+ ` These versions frequently contain bugs, and the Rush team will not accept issue reports for them.`
32-
+ ` Please consider installing a stable release.`));
33-
}
34-
354
import Rush from './Rush';
365

376
Rush.launch(Rush.version, false);

‎apps/rush/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"dependencies": {
3333
"@microsoft/node-core-library": "1.0.0",
3434
"@microsoft/rush-lib": "4.3.0",
35+
"colors": "~1.1.2",
3536
"fs-extra": "~0.26.7",
3637
"semver": "~5.3.0"
3738
},

‎apps/rush/src/start.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4+
import * as colors from 'colors';
5+
import * as semver from 'semver';
6+
7+
const nodeVersion: string = process.versions.node;
8+
9+
// tslint:disable-next-line
10+
11+
// We are on an ancient version of NodeJS that is known not to work with Rush
12+
if (semver.satisfies(nodeVersion, '<= 6.4.0')) {
13+
console.error(colors.red(`Your version of Node.js (${nodeVersion}) is very old and incompatible with Rush.`
14+
+ ` Please upgrade to the latest Long-Term Support (LTS) version.`));
15+
process.exit(1);
16+
}
17+
18+
// We are on a much newer release than we have tested and support
19+
// tslint:disable-next-line
20+
else if (semver.satisfies(nodeVersion, '>=9.0.0')) {
21+
console.warn(colors.yellow(`Your version of Node.js (${nodeVersion}) has not been tested with this release of Rush.`
22+
+ ` The Rush team will not accept issue reports for it.`
23+
+ ` Please consider upgrading Rush or downgrading Node.js.`));
24+
}
25+
26+
// We are not on an LTS release
27+
// tslint:disable-next-line
28+
else if (!semver.satisfies(nodeVersion, '^6.9.0')
29+
&& !semver.satisfies(nodeVersion, '^8.9.0')) {
30+
console.warn(colors.yellow(`Your version of Node.js (${nodeVersion}) is not a Long-Term Support (LTS) release.`
31+
+ ` These versions frequently contain bugs, and the Rush team will not accept issue reports for them.`
32+
+ ` Please consider installing a stable release.`));
33+
}
34+
435
import * as path from 'path';
536
import { JsonFile, IPackageJson } from '@microsoft/node-core-library';
637

0 commit comments

Comments
 (0)