forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request microsoft#3972 from dmichon-msft/rush-sdk-env
[rush-sdk] Use rush-lib from parent process
- Loading branch information
Showing
10 changed files
with
225 additions
and
18 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@microsoft/rush/rush-sdk-env_2023-02-10-23-15.json
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,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@microsoft/rush", | ||
"comment": "Add code path to @rushstack/rush-sdk for inheriting @microsoft/rush-lib location from a parent process via the RUSH_LIB_PATH environment variable.", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@microsoft/rush" | ||
} |
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
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,12 @@ | ||
import { PackageJsonLookup } from '@rushstack/node-core-library'; | ||
|
||
import { EnvironmentVariableNames } from '../api/EnvironmentConfiguration'; | ||
|
||
if (!process.env[EnvironmentVariableNames.RUSH_LIB_PATH]) { | ||
const rootDir: string | undefined = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname); | ||
if (rootDir) { | ||
// Route to the 'main' field of package.json | ||
const rushLibIndex: string = require.resolve(rootDir, { paths: [] }); | ||
process.env[EnvironmentVariableNames.RUSH_LIB_PATH] = rushLibIndex; | ||
} | ||
} |
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
76 changes: 76 additions & 0 deletions
76
libraries/rush-sdk/src/test/__snapshots__/script.test.ts.snap
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,76 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`@rushstack/rush-sdk Should load via env when Rush has loaded (for child processes): stderr 1`] = `""`; | ||
|
||
exports[`@rushstack/rush-sdk Should load via env when Rush has loaded (for child processes): stdout 1`] = ` | ||
"Try to load @microsoft/rush-lib from process.env.RUSH_LIB_PATH from caller package | ||
Loaded @microsoft/rush-lib from process.env.RUSH_LIB_PATH | ||
[ | ||
'_rushSdk_loadInternalModule', | ||
'ApprovedPackagesConfiguration', | ||
'ApprovedPackagesItem', | ||
'ApprovedPackagesPolicy', | ||
'BuildCacheConfiguration', | ||
'BumpType', | ||
'ChangeManager', | ||
'CommonVersionsConfiguration', | ||
'CredentialCache', | ||
'DependencyType', | ||
'EnvironmentConfiguration', | ||
'EnvironmentVariableNames', | ||
'Event', | ||
'EventHooks', | ||
'ExperimentsConfiguration', | ||
'FileSystemBuildCacheProvider', | ||
'IndividualVersionPolicy', | ||
'LockStepVersionPolicy', | ||
'LookupByPath', | ||
'NpmOptionsConfiguration', | ||
'Operation', | ||
'OperationStatus', | ||
'PackageJsonDependency', | ||
'PackageJsonEditor', | ||
'PackageManager', | ||
'PackageManagerOptionsConfigurationBase', | ||
'PhasedCommandHooks', | ||
'PnpmOptionsConfiguration', | ||
'ProjectChangeAnalyzer', | ||
'RepoStateFile', | ||
'Rush', | ||
'RushConfiguration', | ||
'RushConfigurationProject', | ||
'RushConstants', | ||
'RushLifecycleHooks', | ||
'RushSession', | ||
'RushUserConfiguration', | ||
'VersionPolicy', | ||
'VersionPolicyConfiguration', | ||
'VersionPolicyDefinitionName', | ||
'YarnOptionsConfiguration', | ||
'_LastInstallFlag', | ||
'_OperationMetadataManager', | ||
'_OperationStateFile', | ||
'_RushGlobalFolder', | ||
'_RushInternals' | ||
]" | ||
`; | ||
|
||
exports[`@rushstack/rush-sdk Should load via global (for plugins): stderr 1`] = `""`; | ||
|
||
exports[`@rushstack/rush-sdk Should load via global (for plugins): stdout 1`] = `"[ '_rushSdk_loadInternalModule', 'foo' ]"`; | ||
|
||
exports[`@rushstack/rush-sdk Should load via install-run (for standalone tools): stderr 1`] = `""`; | ||
|
||
exports[`@rushstack/rush-sdk Should load via install-run (for standalone tools): stdout 1`] = ` | ||
"Trying to load @microsoft/rush-lib installed by install-run-rush | ||
Loaded @microsoft/rush-lib installed by install-run-rush | ||
[ '_rushSdk_loadInternalModule', 'foo' ]" | ||
`; | ||
|
||
exports[`@rushstack/rush-sdk Should load via process.env.RUSH_LIB_PATH (for child processes): stderr 1`] = `""`; | ||
|
||
exports[`@rushstack/rush-sdk Should load via process.env.RUSH_LIB_PATH (for child processes): stdout 1`] = ` | ||
"Try to load @microsoft/rush-lib from process.env.RUSH_LIB_PATH from caller package | ||
Loaded @microsoft/rush-lib from process.env.RUSH_LIB_PATH | ||
[ '_rushSdk_loadInternalModule', 'foo' ]" | ||
`; |
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