Skip to content

Commit bc574b2

Browse files
committed
[rush] Fixing an issue where the /common/temp/.npmrc file didn't have cleaned env variables.
1 parent 2e554d3 commit bc574b2

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎apps/rush-lib/src/logic/InstallManager.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,8 @@ export class InstallManager {
382382

383383
// Also copy down the committed .npmrc file, if there is one
384384
// "common\config\rush\.npmrc" --> "common\temp\.npmrc"
385-
const committedNpmrcPath: string = path.join(this._rushConfiguration.commonRushConfigFolder, '.npmrc');
386-
const tempNpmrcPath: string = path.join(this._rushConfiguration.commonTempFolder, '.npmrc');
387-
388-
// ensure that we remove any old one that may be hanging around
389-
this._syncFile(committedNpmrcPath, tempNpmrcPath);
385+
// Also ensure that we remove any old one that may be hanging around
386+
Utilities.syncNpmrc(this._rushConfiguration.commonRushConfigFolder, this._rushConfiguration.commonTempFolder);
390387

391388
// also, copy the pnpmfile.js if it exists
392389
if (this._rushConfiguration.packageManager === 'pnpm') {

‎apps/rush-lib/src/utilities/Utilities.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ export class Utilities {
422422
JsonFile.save(npmPackageJson, path.join(directory, 'package.json'));
423423

424424
if (options.commonRushConfigFolder) {
425-
Utilities._syncNpmrc(options.commonRushConfigFolder, directory);
425+
Utilities.syncNpmrc(options.commonRushConfigFolder, directory);
426426
}
427427

428428
console.log(os.EOL + 'Running "npm install" in ' + directory);
@@ -454,8 +454,8 @@ export class Utilities {
454454
}
455455

456456
/**
457-
* As a workaround, _syncNpmrc() copies the .npmrc file to the target folder, and also trims
458-
* unusable lines from the .npmrc file. If the source .npmrc file not exist, then _syncNpmrc()
457+
* As a workaround, syncNpmrc() copies the .npmrc file to the target folder, and also trims
458+
* unusable lines from the .npmrc file. If the source .npmrc file not exist, then syncNpmrc()
459459
* will delete an .npmrc that is found in the target folder.
460460
*
461461
* Why are we trimming the .npmrc lines? NPM allows environment variables to be specified in
@@ -467,7 +467,7 @@ export class Utilities {
467467
*
468468
* IMPORTANT: THIS CODE SHOULD BE KEPT UP TO DATE WITH _syncNpmrc() FROM scripts/install-run.ts
469469
*/
470-
private static _syncNpmrc(sourceNpmrcFolder: string, targetNpmrcFolder: string): void {
470+
public static syncNpmrc(sourceNpmrcFolder: string, targetNpmrcFolder: string): void {
471471
const sourceNpmrcPath: string = path.join(sourceNpmrcFolder, '.npmrc');
472472
const targetNpmrcPath: string = path.join(targetNpmrcFolder, '.npmrc');
473473
try {

0 commit comments

Comments
 (0)