Skip to content

Commit f690716

Browse files
author
Nick Pape
committed
Remove all PNPM references
1 parent 146dd70 commit f690716

15 files changed

Lines changed: 48 additions & 601 deletions

‎apps/rush-lib/package.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@
2323
"@types/z-schema": "3.16.31",
2424
"builtins": "~1.0.3",
2525
"colors": "~1.1.2",
26-
"encode-registry": "~1.1.0",
2726
"fs-extra": "~0.26.7",
2827
"git-repo-info": "~1.1.4",
2928
"glob": "~7.0.5",
3029
"glob-escape": "~0.0.1",
3130
"inquirer": "~1.2.1",
32-
"js-yaml": "~3.9.1",
3331
"jju": "~1.3.0",
3432
"lodash": "~4.15.0",
3533
"minimatch": "~3.0.2",
@@ -49,7 +47,6 @@
4947
"sinon": "~1.17.3",
5048
"@types/colors": "1.1.3",
5149
"@types/glob": "5.0.30",
52-
"@types/js-yaml": "3.9.1",
5350
"@types/lodash": "4.14.74",
5451
"@types/minimatch": "2.0.29",
5552
"@types/sinon": "1.16.34",

‎apps/rush-lib/src/RushConstants.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ export namespace RushConstants {
5858
*/
5959
export const npmShrinkwrapFilename: string = 'npm-shrinkwrap.json';
6060

61-
/**
62-
* The filename ("shrinkwrap.yaml") used to store state for pnpm
63-
*/
64-
export const pnpmShrinkwrapFilename: string = 'shrinkwrap.yaml';
65-
6661
/**
6762
* The folder name ("node_modules") where NPM installs its packages.
6863
*/

‎apps/rush-lib/src/cli/actions/GenerateAction.ts‎

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ export default class GenerateAction extends BaseRushAction {
6262
const stopwatch: Stopwatch = Stopwatch.start();
6363
const isLazy: boolean = this._lazyParameter.value;
6464

65-
if (this._lazyParameter.value && this.rushConfiguration.packageManager === 'pnpm') {
66-
console.warn(colors.yellow('The --lazy flag is not required for PNPM'
67-
+ ' because its algorithm inherently incorporates this optimization.'));
68-
}
69-
7065
ApprovedPackagesChecker.rewriteConfigFiles(this.rushConfiguration);
7166

7267
const installManager: InstallManager = new InstallManager(this.rushConfiguration);
@@ -106,37 +101,31 @@ export default class GenerateAction extends BaseRushAction {
106101
fsx.unlinkSync(tempShrinkwrapFilename);
107102
}
108103

109-
if (isLazy || this.rushConfiguration.packageManager === 'pnpm') {
110-
if (this.rushConfiguration.packageManager === 'npm') {
111-
console.log(colors.green(
112-
`${os.EOL}Rush is running in "--lazy" mode. ` +
113-
`You will need to run a normal "rush generate" before committing.`));
114-
}
104+
if (isLazy) {
105+
console.log(colors.green(
106+
`${os.EOL}Rush is running in "--lazy" mode. ` +
107+
`You will need to run a normal "rush generate" before committing.`));
115108

116109
// Do an incremental install
117110
installManager.installCommonModules(InstallType.Normal);
118111

119-
if (this.rushConfiguration.packageManager === 'npm') {
120-
console.log(os.EOL + colors.bold('(Skipping "npm shrinkwrap")') + os.EOL);
121-
const packageLogFilePath: string = path.join(this.rushConfiguration.commonTempFolder, 'package.lock');
112+
console.log(os.EOL + colors.bold('(Skipping "npm shrinkwrap")') + os.EOL);
113+
const packageLogFilePath: string = path.join(this.rushConfiguration.commonTempFolder, 'package.lock');
122114

123-
if (fsx.existsSync(packageLogFilePath)) {
124-
console.log('Removing NPM5\'s "package.lock" file');
125-
fsx.removeSync(packageLogFilePath);
126-
}
115+
if (fsx.existsSync(packageLogFilePath)) {
116+
console.log('Removing NPM5\'s "package.lock" file');
117+
fsx.removeSync(packageLogFilePath);
127118
}
128119
} else {
129120
// Do a clean install
130121
installManager.installCommonModules(InstallType.ForceClean);
131122

132-
if (this.rushConfiguration.packageManager === 'npm') {
133-
console.log(os.EOL + colors.bold('Running "npm shrinkwrap"...'));
134-
const npmArgs: string[] = ['shrinkwrap'];
135-
installManager.pushConfigurationArgs(npmArgs);
136-
Utilities.executeCommand(this.rushConfiguration.packageManagerToolFilename,
137-
npmArgs, this.rushConfiguration.commonTempFolder);
138-
console.log('"npm shrinkwrap" completed' + os.EOL);
139-
}
123+
console.log(os.EOL + colors.bold('Running "npm shrinkwrap"...'));
124+
const npmArgs: string[] = ['shrinkwrap'];
125+
installManager.pushConfigurationArgs(npmArgs);
126+
Utilities.executeCommand(this.rushConfiguration.packageManagerToolFilename,
127+
npmArgs, this.rushConfiguration.commonTempFolder);
128+
console.log('"npm shrinkwrap" completed' + os.EOL);
140129

141130
// Copy (or delete) common\temp\npm-shrinkwrap.json --> common\npm-shrinkwrap.json
142131
installManager.syncFile(tempShrinkwrapFilename,

‎apps/rush-lib/src/cli/utilities/InstallManager.ts‎

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export default class InstallManager {
143143

144144
/**
145145
* If the "(p)npm-local" symlink hasn't been set up yet, this creates it, installing the
146-
* specified PNPM or NPM version in the user's home directory if needed.
146+
* specified NPM version in the user's home directory if needed.
147147
*/
148148
public ensureLocalPackageManager(forceReinstall: boolean): void {
149149
// Example: "C:\Users\YourName\.rush"
@@ -157,10 +157,10 @@ export default class InstallManager {
157157
const packageManager: PackageManager = this._rushConfiguration.packageManager;
158158
const packageManagerVersion: string = this._rushConfiguration.packageManagerToolVersion;
159159

160-
// Example: "C:\Users\YourName\.rush\pnpm-1.2.3"
160+
// Example: "C:\Users\YourName\.rush\npm-1.2.3"
161161
const packageManagerToolFolder: string = path.join(rushHomeFolder,
162162
`${packageManager}-${packageManagerVersion}`);
163-
// Example: "C:\Users\YourName\.rush\pnpm-1.2.3\last-install.flag"
163+
// Example: "C:\Users\YourName\.rush\npm-1.2.3\last-install.flag"
164164
const packageManagerToolFlagFile: string = path.join(packageManagerToolFolder, 'last-install.flag');
165165

166166
// NOTE: We don't care about the timestamp for last-install.flag, because nobody will change
@@ -188,7 +188,7 @@ export default class InstallManager {
188188
fsx.mkdirsSync(this._rushConfiguration.commonTempFolder);
189189
}
190190

191-
// Example: "C:\MyRepo\common\temp\pnpm-local"
191+
// Example: "C:\MyRepo\common\temp\npm-local"
192192
const localPackageManagerToolFolder: string =
193193
path.join(this._rushConfiguration.commonTempFolder, `${packageManager}-local`);
194194
if (fsx.existsSync(localPackageManagerToolFolder)) {
@@ -496,9 +496,6 @@ export default class InstallManager {
496496
}
497497
}
498498

499-
// @todo for PNPM, we should look at the lock file to determine if the store needs to be cleaned
500-
// ie even if the marker file does not exist, the store may be ok if there is no lock file
501-
502499
// If "--clean" or "--full-clean" was specified, or if the last install was interrupted,
503500
// then we will need to delete the node_modules folder. Otherwise, we can do an incremental
504501
// install.
@@ -530,18 +527,12 @@ export default class InstallManager {
530527
return;
531528
}
532529
} else {
533-
if (this._rushConfiguration.packageManager === 'npm') {
534-
console.log(`Deleting the "npm-cache" folder`);
535-
// This is faster and more thorough than "npm cache clean"
536-
this._asyncRecycler.moveFolder(this._rushConfiguration.npmCacheFolder);
537-
538-
console.log(`Deleting the "npm-tmp" folder`);
539-
this._asyncRecycler.moveFolder(this._rushConfiguration.npmTmpFolder);
530+
console.log(`Deleting the "npm-cache" folder`);
531+
// This is faster and more thorough than "npm cache clean"
532+
this._asyncRecycler.moveFolder(this._rushConfiguration.npmCacheFolder);
540533

541-
} else {
542-
console.log(`Deleting the "pnpm-store" folder`);
543-
this._asyncRecycler.moveFolder(this._rushConfiguration.pnpmStoreFolder);
544-
}
534+
console.log(`Deleting the "npm-tmp" folder`);
535+
this._asyncRecycler.moveFolder(this._rushConfiguration.npmTmpFolder);
545536
}
546537

547538
if (fsx.existsSync(this.commonNodeModulesMarkerFilename)) {
@@ -575,15 +566,12 @@ export default class InstallManager {
575566
} else {
576567
// NO: Do an incremental install in the "node_modules" folder
577568

578-
// note: it is not necessary to run "prune" with pnpm
579-
if (this._rushConfiguration.packageManager === 'npm') {
580-
console.log(`Running "${this._rushConfiguration.packageManager} prune"`
581-
+ ` in ${this._rushConfiguration.commonTempFolder}`);
582-
const args: string[] = ['prune'];
583-
this.pushConfigurationArgs(args);
584-
Utilities.executeCommandWithRetry(packageManagerFilename, args, MAX_INSTALL_ATTEMPTS,
585-
this._rushConfiguration.commonTempFolder);
586-
}
569+
console.log(`Running "${this._rushConfiguration.packageManager} prune"`
570+
+ ` in ${this._rushConfiguration.commonTempFolder}`);
571+
const args: string[] = ['prune'];
572+
this.pushConfigurationArgs(args);
573+
Utilities.executeCommandWithRetry(packageManagerFilename, args, MAX_INSTALL_ATTEMPTS,
574+
this._rushConfiguration.commonTempFolder);
587575

588576
// Delete the (installed image of) the temp projects, since "npm install" does not
589577
// detect changes for "file:./" references.
@@ -626,9 +614,6 @@ export default class InstallManager {
626614
// One possible solution would be to have the shrinkwrap include information about whether the dependency
627615
// is optional or not, but it does not appear to do so. Also, this would result in strange behavior where
628616
// people would have different node_modules based on their system.
629-
//
630-
// NOTE FOR PNPM:
631-
// PNPM does not appear to support the --no-optional flag at the moment
632617

633618
const installArgs: string[] = ['install'];
634619
if (this._rushConfiguration.packageManager === 'npm') {
@@ -658,13 +643,8 @@ export default class InstallManager {
658643
* to the command-line.
659644
*/
660645
public pushConfigurationArgs(args: string[]): void {
661-
if (this._rushConfiguration.packageManager === 'npm') {
662-
args.push('--cache', this._rushConfiguration.npmCacheFolder);
663-
args.push('--tmp', this._rushConfiguration.npmTmpFolder);
664-
} else if (this._rushConfiguration.packageManager === 'pnpm') {
665-
args.push('--store', this._rushConfiguration.pnpmStoreFolder);
666-
args.push('--no-lock');
667-
}
646+
args.push('--cache', this._rushConfiguration.npmCacheFolder);
647+
args.push('--tmp', this._rushConfiguration.npmTmpFolder);
668648
}
669649

670650
/**

‎apps/rush-lib/src/cli/utilities/LinkManager.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ export default abstract class LinkManager {
2222
protected _rushConfiguration: RushConfiguration;
2323

2424
public static getLinkManager(rushConfiguration: RushConfiguration): LinkManager {
25-
return new (rushConfiguration.packageManager === 'pnpm'
26-
? require('./pnpm/PnpmLinkManager').default
27-
: require('./npm/NpmLinkManager').default)(rushConfiguration);
25+
return new (require('./npm/NpmLinkManager').default)(rushConfiguration);
2826
}
2927

3028
protected static _createSymlink(linkTarget: string, linkSource: string, symlinkKind: SymlinkKind): void {

‎apps/rush-lib/src/cli/utilities/ShrinkwrapFile.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@ import { PackageManager } from '../../data/RushConfiguration';
1010
import { RushConstants } from '../../RushConstants';
1111

1212
/**
13-
* This class is a parser for both NPM's npm-shrinkwrap.json and PNPM's shrinkwrap.yaml file formats.
13+
* This class is a parser for both NPM's npm-shrinkwrap.json file formats.
1414
*/
1515
export default abstract class ShrinkwrapFile {
1616
protected _alreadyWarnedSpecs: Set<string> = new Set<string>();
1717

1818
public static loadFromFile(packageManager: PackageManager, shrinkwrapFilename: string): ShrinkwrapFile | undefined {
19-
if (packageManager === 'npm') {
20-
return require('./npm/NpmShrinkwrapFile').default.loadFromFile(shrinkwrapFilename);
21-
} else if (packageManager === 'pnpm') {
22-
return require('./pnpm/PnpmShrinkwrapFile').default.loadFromFile(shrinkwrapFilename);
23-
}
24-
throw new Error(`Invalid package manager: "${packageManager}"`);
19+
return require('./npm/NpmShrinkwrapFile').default.loadFromFile(shrinkwrapFilename);
2520
}
2621

2722
protected static tryGetValue<T>(dictionary: { [key2: string]: T }, key: string): T | undefined {

0 commit comments

Comments
 (0)