Rush StackShopBlogEvents
Skip to main content

Home > @microsoft/rush-lib > PnpmOptionsConfiguration

PnpmOptionsConfiguration class

Options that are only used when the PNPM package manager is selected. Use this class to load "common/config/rush/pnpm-config.json" file, or, load json from "pnpmOptions" field in "rush.json" for legacy support.

Signature:

export declare class PnpmOptionsConfiguration extends PackageManagerOptionsConfigurationBase 

Extends: PackageManagerOptionsConfigurationBase

Remarks

It is valid to define these options in rush.json even if the PNPM package manager is not being used.

Properties

PropertyModifiersTypeDescription
globalAllowedDeprecatedVersionsreadonlyRecord<string, string> | undefined

The globalAllowedDeprecatedVersions setting suppresses installation warnings for package versions that the NPM registry reports as being deprecated. This is useful if the deprecated package is an indirect dependency of an external package that has not released a fix. The settings are copied into the pnpm.allowedDeprecatedVersions field of the common/temp/package.json file that is generated by Rush during installation.

PNPM documentation: https://pnpm.io/package\_json\#pnpmalloweddeprecatedversions

If you are working to eliminate a deprecated version, it's better to specify allowedDeprecatedVersions in the package.json file for individual Rush projects.

globalNeverBuiltDependenciesreadonlystring[] | undefined

The globalNeverBuiltDependencies setting suppresses the preinstall, install, and postinstall lifecycle events for the specified NPM dependencies. This is useful for scripts with poor practices such as downloading large binaries without retries or attempting to invoke OS tools such as a C++ compiler. (PNPM's terminology refers to these lifecycle events as "building" a package; it has nothing to do with build system operations such as rush build or rushx build.) The settings are copied into the pnpm.neverBuiltDependencies field of the common/temp/package.json file that is generated by Rush during installation.

PNPM documentation: https://pnpm.io/package\_json\#pnpmneverbuiltdependencies

globalOverridesreadonlyRecord<string, string> | undefined

The "globalOverrides" setting provides a simple mechanism for overriding version selections for all dependencies of all projects in the monorepo workspace. The settings are copied into the pnpm.overrides field of the common/temp/package.json file that is generated by Rush during installation.

Order of precedence: .pnpmfile.cjs has the highest precedence, followed by unsupportedPackageJsonSettings, globalPeerDependencyRules, globalPackageExtensions, and globalOverrides has lowest precedence.

PNPM documentation: https://pnpm.io/package\_json\#pnpmoverrides

globalPackageExtensionsreadonlyRecord<string, IPnpmPackageExtension> | undefined

The globalPackageExtension setting provides a way to patch arbitrary package.json fields for any PNPM dependency of the monorepo. The settings are copied into the pnpm.packageExtensions field of the common/temp/package.json file that is generated by Rush during installation. The globalPackageExtension setting has similar capabilities as .pnpmfile.cjs but without the downsides of an executable script (nondeterminism, unreliable caching, performance concerns).

Order of precedence: .pnpmfile.cjs has the highest precedence, followed by unsupportedPackageJsonSettings, globalPeerDependencyRules, globalPackageExtensions, and globalOverrides has lowest precedence.

PNPM documentation: https://pnpm.io/package\_json\#pnpmpackageextensions

globalPatchedDependenciesreadonlyRecord<string, string> | undefined

(GENERATED BY RUSH-PNPM PATCH-COMMIT) When modifying this property, make sure you know what you are doing.

The globalPatchedDependencies is added/updated automatically when you run pnpm patch-commit command. It is a dictionary where the key should be the package name and exact version. The value should be a relative path to a patch file.

PNPM documentation: https://pnpm.io/package\_json\#pnpmpatcheddependencies

globalPeerDependencyRulesreadonlyIPnpmPeerDependencyRules | undefined

The globalPeerDependencyRules setting provides various settings for suppressing validation errors that are reported during installation with strictPeerDependencies=true. The settings are copied into the pnpm.peerDependencyRules field of the common/temp/package.json file that is generated by Rush during installation.

Order of precedence: .pnpmfile.cjs has the highest precedence, followed by unsupportedPackageJsonSettings, globalPeerDependencyRules, globalPackageExtensions, and globalOverrides has lowest precedence.

https://pnpm.io/package\_json\#pnpmpeerdependencyrules

jsonFilenamereadonlystring | undefined
pnpmStorereadonlyPnpmStoreOptionsThe method used to resolve the store used by PNPM.
pnpmStorePathreadonlystring

The path for PNPM to use as the store directory.

Will be overridden by environment variable RUSH_PNPM_STORE_PATH

preventManualShrinkwrapChangesreadonlybooleanIf true, then rush install will report an error if manual modifications were made to the PNPM shrinkwrap file without running rush update afterwards.
strictPeerDependenciesreadonlybooleanIf true, then Rush will add the "--strict-peer-dependencies" option when invoking PNPM.
unsupportedPackageJsonSettingsreadonlyunknown | undefined

(USE AT YOUR OWN RISK) This is a free-form property bag that will be copied into the common/temp/package.json file that is generated by Rush during installation. This provides a way to experiment with new PNPM features. These settings will override any other Rush configuration associated with a given JSON field except for .pnpmfile.cjs.

USAGE OF THIS SETTING IS NOT SUPPORTED BY THE RUSH MAINTAINERS AND MAY CAUSE RUSH TO MALFUNCTION. If you encounter a missing PNPM setting that you believe should be supported, please create a GitHub issue or PR. Note that Rush does not aim to support every possible PNPM setting, but rather to promote a battle-tested installation strategy that is known to provide a good experience for large teams with lots of projects.

useWorkspacesreadonlybooleanIf true, then Rush will use the workspaces feature to install and link packages when invoking PNPM.

Methods

MethodModifiersDescription
updateGlobalPatchedDependencies(patchedDependencies)Updates patchedDependencies field of the PNPM options in the common/config/rush/pnpm-config.json file.