|
1 | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. |
2 | 2 | // See LICENSE in the project root for license information. |
3 | 3 |
|
| 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 | + |
4 | 35 | import * as path from 'path'; |
5 | 36 | import { JsonFile, IPackageJson } from '@microsoft/node-core-library'; |
6 | 37 |
|
|
0 commit comments