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 #3383 from dmichon-msft/install-option
[rush-lib] Allow phased commands to install prior to execution if requested
- Loading branch information
Showing
7 changed files
with
125 additions
and
8 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@microsoft/rush/install-option_2022-05-02-21-50.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": "Provide ability for phased script commands to internally invoke \"rush install\" prior to execution.", | ||
"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
50 changes: 50 additions & 0 deletions
50
libraries/rush-lib/src/logic/installManager/doBasicInstallAsync.ts
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,50 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
import type { RushConfiguration } from '../../api/RushConfiguration'; | ||
import type { RushGlobalFolder } from '../../api/RushGlobalFolder'; | ||
import type { BaseInstallManager } from '../base/BaseInstallManager'; | ||
import { InstallManagerFactory } from '../InstallManagerFactory'; | ||
import { SetupChecks } from '../SetupChecks'; | ||
import { PurgeManager } from '../PurgeManager'; | ||
import { VersionMismatchFinder } from '../versionMismatch/VersionMismatchFinder'; | ||
|
||
export interface IRunInstallOptions { | ||
rushConfiguration: RushConfiguration; | ||
rushGlobalFolder: RushGlobalFolder; | ||
isDebug: boolean; | ||
} | ||
|
||
export async function doBasicInstallAsync(options: IRunInstallOptions): Promise<void> { | ||
const { rushConfiguration, rushGlobalFolder, isDebug } = options; | ||
|
||
VersionMismatchFinder.ensureConsistentVersions(rushConfiguration); | ||
SetupChecks.validate(rushConfiguration); | ||
|
||
const purgeManager: typeof PurgeManager.prototype = new PurgeManager(rushConfiguration, rushGlobalFolder); | ||
|
||
const installManager: BaseInstallManager = InstallManagerFactory.getInstallManager( | ||
rushConfiguration, | ||
rushGlobalFolder, | ||
purgeManager, | ||
{ | ||
debug: isDebug, | ||
allowShrinkwrapUpdates: false, | ||
checkOnly: false, | ||
bypassPolicy: false, | ||
noLink: false, | ||
fullUpgrade: false, | ||
recheckShrinkwrap: false, | ||
collectLogFile: false, | ||
pnpmFilterArguments: [], | ||
maxInstallAttempts: 1, | ||
networkConcurrency: undefined | ||
} | ||
); | ||
|
||
try { | ||
await installManager.doInstallAsync(); | ||
} finally { | ||
purgeManager.deleteAll(); | ||
} | ||
} |
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