@@ -10,10 +10,12 @@ import { RushCommandLineParser } from '../cli/RushCommandLineParser';
1010import { RushConstants } from '../logic/RushConstants' ;
1111import { RushXCommandLine } from '../cli/RushXCommandLine' ;
1212import { CommandLineMigrationAdvisor } from '../cli/CommandLineMigrationAdvisor' ;
13- import { RushConfiguration } from './RushConfiguration ' ;
13+ import { NodeJsCompatibility } from '../logic/NodeJsCompatibility ' ;
1414
1515/**
1616 * Options to pass to the rush "launch" functions.
17+ *
18+ * @public
1719 */
1820export interface ILaunchOptions {
1921 /**
@@ -30,12 +32,6 @@ export interface ILaunchOptions {
3032 alreadyReportedNodeTooNewError ?: boolean ;
3133}
3234
33- interface IExtendedNodeProcess extends NodeJS . Process {
34- release : {
35- lts ?: string ;
36- } ;
37- }
38-
3935/**
4036 * General operations for the Rush engine.
4137 *
@@ -48,15 +44,20 @@ export class Rush {
4844 * and start a new Node.js process.
4945 *
5046 * @param launcherVersion - The version of the `@microsoft/rush` wrapper used to call invoke the CLI.
47+ *
48+ * @remarks
49+ * Earlier versions of the rush frontend used a different API contract. In the old contract,
50+ * the second argument was the `isManaged` value of the {@see ILaunchOptions} object.
51+ *
52+ * Even though this API isn't documented, it is still supported for legacy compatibility.
5153 */
5254 public static launch ( launcherVersion : string , arg : ILaunchOptions ) : void {
5355 const options : ILaunchOptions = Rush . _normalizeLaunchOptions ( arg ) ;
5456
5557 Rush . _printStartupBanner ( options . isManaged ) ;
5658
57- const rushConfiguration : RushConfiguration | undefined = Rush . _tryGetRushConfiguration ( ) ;
5859 if ( ! options . alreadyReportedNodeTooNewError ) {
59- Rush . _warnAboutNodeVersion ( rushConfiguration ) ;
60+ NodeJsCompatibility . warnAboutVersionTooNew ( true ) ;
6061 }
6162
6263 if ( ! CommandLineMigrationAdvisor . checkArgv ( process . argv ) ) {
@@ -65,7 +66,7 @@ export class Rush {
6566 return ;
6667 }
6768
68- const parser : RushCommandLineParser = new RushCommandLineParser ( { rushConfiguration } ) ;
69+ const parser : RushCommandLineParser = new RushCommandLineParser ( ) ;
6970 parser . execute ( ) . catch ( console . error ) ; // CommandLineParser.execute() should never reject the promise
7071 }
7172
@@ -81,18 +82,11 @@ export class Rush {
8182
8283 Rush . _printStartupBanner ( options . isManaged ) ;
8384
84- const rushConfiguration : RushConfiguration | undefined = Rush . _tryGetRushConfiguration ( ) ;
8585 if ( ! options . alreadyReportedNodeTooNewError ) {
86- Rush . _warnAboutNodeVersion ( rushConfiguration ) ;
86+ NodeJsCompatibility . warnAboutVersionTooNew ( true ) ;
8787 }
8888
89- RushXCommandLine . _launchRushXInternal (
90- launcherVersion ,
91- {
92- isManaged : options . isManaged ,
93- rushConfiguration : rushConfiguration
94- }
95- ) ;
89+ RushXCommandLine . launchRushX ( launcherVersion , options . isManaged ) ;
9690 }
9791
9892 /**
@@ -103,18 +97,6 @@ export class Rush {
10397 return PackageJsonLookup . loadOwnPackageJson ( __dirname ) . version ;
10498 }
10599
106- private static _tryGetRushConfiguration ( ) : RushConfiguration | undefined {
107- try {
108- if ( RushConfiguration . tryFindRushJsonLocation ( ) ) {
109- return RushConfiguration . loadFromDefaultLocation ( { showVerbose : true } ) ;
110- }
111- } catch ( e ) {
112- // ignore
113- }
114-
115- return undefined ;
116- }
117-
118100 /**
119101 * This function normalizes legacy options to the current {@see ILaunchOptions} object.
120102 */
@@ -128,7 +110,7 @@ export class Rush {
128110 const nodeVersion : string = process . versions . node ;
129111 const nodeMajorVersion : number = semver . major ( nodeVersion ) ;
130112 const nodeReleaseLabel : string = ( nodeMajorVersion % 2 === 0 )
131- ? ( ! ! ( process as IExtendedNodeProcess ) . release . lts ? 'LTS' : 'pre-LTS' )
113+ ? ( NodeJsCompatibility . isLtsVersion ? 'LTS' : 'pre-LTS' )
132114 : 'unstable' ;
133115
134116 console . log (
@@ -140,30 +122,4 @@ export class Rush {
140122 EOL
141123 ) ;
142124 }
143-
144- private static _warnAboutNodeVersion ( rushConfiguration : RushConfiguration | undefined ) : void {
145- const nodeVersion : string = process . versions . node ;
146-
147- if ( semver . satisfies ( nodeVersion , '>= 11.0.0' ) ) {
148- console . log ( ) ;
149- console . warn ( colors . yellow (
150- `Your version of Node.js (${ nodeVersion } ) has not been tested with this release` +
151- `of the Rush engine. Please consider upgrading the "rushVersion" setting in rush.json, ` +
152- `or downgrading Node.js.`
153- ) ) ;
154- console . log ( ) ;
155- } else if (
156- rushConfiguration &&
157- ! rushConfiguration . suppressNodeLtsWarning &&
158- ! ( process as IExtendedNodeProcess ) . release . lts
159- ) {
160- console . log ( ) ;
161- console . warn ( colors . yellow (
162- `Your version of Node.js (${ nodeVersion } ) has an odd major version number. ` +
163- `These releases frequently have bugs. Please consider installing a Long Term Support (LTS) ` +
164- `version instead.`
165- ) ) ;
166- console . log ( ) ;
167- }
168- }
169125}
0 commit comments