зеркало из https://github.com/microsoft/rushstack.git
[rush] Add support for pnpm ignoredOptionalDependencies (#4928)
* add support for pnpm ignoredOptionalDependencies, resolve #4859 * modify pnpm-config.json rush init template
This commit is contained in:
Родитель
0c7a1ed40e
Коммит
536cb5398d
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"changes": [
|
||||
{
|
||||
"packageName": "@microsoft/rush",
|
||||
"comment": "add support for pnpm ignoredOptionalDependencies",
|
||||
"type": "none"
|
||||
}
|
||||
],
|
||||
"packageName": "@microsoft/rush"
|
||||
}
|
|
@ -727,6 +727,7 @@ export interface _IPnpmOptionsJson extends IPackageManagerOptionsJsonBase {
|
|||
alwaysInjectDependenciesFromOtherSubspaces?: boolean;
|
||||
autoInstallPeers?: boolean;
|
||||
globalAllowedDeprecatedVersions?: Record<string, string>;
|
||||
globalIgnoredOptionalDependencies?: string[];
|
||||
globalNeverBuiltDependencies?: string[];
|
||||
globalOverrides?: Record<string, string>;
|
||||
globalPackageExtensions?: Record<string, IPnpmPackageExtension>;
|
||||
|
@ -1086,6 +1087,7 @@ export class PnpmOptionsConfiguration extends PackageManagerOptionsConfiguration
|
|||
readonly alwaysInjectDependenciesFromOtherSubspaces: boolean | undefined;
|
||||
readonly autoInstallPeers: boolean | undefined;
|
||||
readonly globalAllowedDeprecatedVersions: Record<string, string> | undefined;
|
||||
readonly globalIgnoredOptionalDependencies: string[] | undefined;
|
||||
readonly globalNeverBuiltDependencies: string[] | undefined;
|
||||
readonly globalOverrides: Record<string, string> | undefined;
|
||||
readonly globalPackageExtensions: Record<string, IPnpmPackageExtension> | undefined;
|
||||
|
|
|
@ -269,6 +269,21 @@
|
|||
/*[LINE "HYPOTHETICAL"]*/ "fsevents"
|
||||
],
|
||||
|
||||
/**
|
||||
* The `globalIgnoredOptionalDependencies` setting suppresses the installation of optional NPM
|
||||
* dependencies specified in the list. This is useful when certain optional dependencies are
|
||||
* not needed in your environment, such as platform-specific packages or dependencies that
|
||||
* fail during installation but are not critical to your project.
|
||||
* These settings are copied into the `pnpm.overrides` field of the `common/temp/package.json`
|
||||
* file that is generated by Rush during installation, instructing PNPM to ignore the specified
|
||||
* optional dependencies.
|
||||
*
|
||||
* PNPM documentation: https://pnpm.io/package_json#pnpmignoredoptionaldependencies
|
||||
*/
|
||||
"globalIgnoredOptionalDependencies": [
|
||||
/*[LINE "HYPOTHETICAL"]*/ "fsevents"
|
||||
],
|
||||
|
||||
/**
|
||||
* The `globalAllowedDeprecatedVersions` setting suppresses installation warnings for package
|
||||
* versions that the NPM registry reports as being deprecated. This is useful if the
|
||||
|
|
|
@ -28,6 +28,7 @@ interface ICommonPackageJson extends IPackageJson {
|
|||
packageExtensions?: typeof PnpmOptionsConfiguration.prototype.globalPackageExtensions;
|
||||
peerDependencyRules?: typeof PnpmOptionsConfiguration.prototype.globalPeerDependencyRules;
|
||||
neverBuiltDependencies?: typeof PnpmOptionsConfiguration.prototype.globalNeverBuiltDependencies;
|
||||
ignoredOptionalDependencies?: typeof PnpmOptionsConfiguration.prototype.globalIgnoredOptionalDependencies;
|
||||
allowedDeprecatedVersions?: typeof PnpmOptionsConfiguration.prototype.globalAllowedDeprecatedVersions;
|
||||
patchedDependencies?: typeof PnpmOptionsConfiguration.prototype.globalPatchedDependencies;
|
||||
};
|
||||
|
@ -69,6 +70,10 @@ export class InstallHelpers {
|
|||
commonPackageJson.pnpm.neverBuiltDependencies = pnpmOptions.globalNeverBuiltDependencies;
|
||||
}
|
||||
|
||||
if (pnpmOptions.globalIgnoredOptionalDependencies) {
|
||||
commonPackageJson.pnpm.ignoredOptionalDependencies = pnpmOptions.globalIgnoredOptionalDependencies;
|
||||
}
|
||||
|
||||
if (pnpmOptions.globalAllowedDeprecatedVersions) {
|
||||
commonPackageJson.pnpm.allowedDeprecatedVersions = pnpmOptions.globalAllowedDeprecatedVersions;
|
||||
}
|
||||
|
|
|
@ -111,6 +111,10 @@ export interface IPnpmOptionsJson extends IPackageManagerOptionsJsonBase {
|
|||
* {@inheritDoc PnpmOptionsConfiguration.globalNeverBuiltDependencies}
|
||||
*/
|
||||
globalNeverBuiltDependencies?: string[];
|
||||
/**
|
||||
* {@inheritDoc PnpmOptionsConfiguration.globalIgnoredOptionalDependencies}
|
||||
*/
|
||||
globalIgnoredOptionalDependencies?: string[];
|
||||
/**
|
||||
* {@inheritDoc PnpmOptionsConfiguration.globalAllowedDeprecatedVersions}
|
||||
*/
|
||||
|
@ -321,6 +325,18 @@ export class PnpmOptionsConfiguration extends PackageManagerOptionsConfiguration
|
|||
*/
|
||||
public readonly globalNeverBuiltDependencies: string[] | undefined;
|
||||
|
||||
/**
|
||||
* The ignoredOptionalDependencies setting allows you to exclude certain optional dependencies from being installed
|
||||
* during the Rush installation process. This can be useful when optional dependencies are not required or are
|
||||
* problematic in specific environments (e.g., dependencies with incompatible binaries or platform-specific requirements).
|
||||
* The listed dependencies will be treated as though they are missing, even if other packages specify them as optional
|
||||
* dependencies. The settings are copied into the pnpm.ignoredOptionalDependencies field of the common/temp/package.json
|
||||
* file that is generated by Rush during installation.
|
||||
*
|
||||
* PNPM documentation: https://pnpm.io/package_json#pnpmignoredoptionaldependencies
|
||||
*/
|
||||
public readonly globalIgnoredOptionalDependencies: string[] | undefined;
|
||||
|
||||
/**
|
||||
* The `globalAllowedDeprecatedVersions` setting suppresses installation warnings for package
|
||||
* versions that the NPM registry reports as being deprecated. This is useful if the
|
||||
|
@ -400,6 +416,7 @@ export class PnpmOptionsConfiguration extends PackageManagerOptionsConfiguration
|
|||
this.globalPeerDependencyRules = json.globalPeerDependencyRules;
|
||||
this.globalPackageExtensions = json.globalPackageExtensions;
|
||||
this.globalNeverBuiltDependencies = json.globalNeverBuiltDependencies;
|
||||
this.globalIgnoredOptionalDependencies = json.globalIgnoredOptionalDependencies;
|
||||
this.globalAllowedDeprecatedVersions = json.globalAllowedDeprecatedVersions;
|
||||
this.unsupportedPackageJsonSettings = json.unsupportedPackageJsonSettings;
|
||||
this._globalPatchedDependencies = json.globalPatchedDependencies;
|
||||
|
|
|
@ -145,6 +145,15 @@
|
|||
}
|
||||
},
|
||||
|
||||
"globalIgnoredOptionalDependencies": {
|
||||
"description": "This field allows you to skip the installation of specific optional dependencies. The listed packages will be treated as if they are not present in the dependency tree during installation, meaning they will not be installed even if required by other packages.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Specify the package name of the optional dependency to be ignored.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
|
||||
"globalAllowedDeprecatedVersions": {
|
||||
"description": "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.\n\nPNPM documentation: https://pnpm.io/package_json#pnpmalloweddeprecatedversions",
|
||||
"type": "object",
|
||||
|
|
Загрузка…
Ссылка в новой задаче