Skip to content

Commit c2ac1d4

Browse files
committed
Rename trustPolicyIgnoreAfter to trustPolicyIgnoreAfterMinutes
...this setting is named like that in user-facing and internal Rush config, but must be surfaced as trustPolicyIgnoreAfter in the synthesised package.json.
1 parent 2e9a71c commit c2ac1d4

8 files changed

Lines changed: 16 additions & 15 deletions

File tree

common/changes/@microsoft/rush/feature-add-trust-policy-support_2026-04-07-00-00.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"changes": [
33
{
4-
"comment": "Add support for pnpm `trustPolicy`, `trustPolicyExclude`, and `trustPolicyIgnoreAfter` settings in `pnpm-config.json`.",
4+
"comment": "Add support for pnpm `trustPolicy`, `trustPolicyExclude`, and `trustPolicyIgnoreAfterMinutes` settings in `pnpm-config.json`.",
55
"type": "minor",
66
"packageName": "@microsoft/rush"
77
}

common/reviews/api/rush-lib.api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ export interface _IPnpmOptionsJson extends IPackageManagerOptionsJsonBase {
769769
strictPeerDependencies?: boolean;
770770
trustPolicy?: PnpmTrustPolicy;
771771
trustPolicyExclude?: string[];
772-
trustPolicyIgnoreAfter?: number;
772+
trustPolicyIgnoreAfterMinutes?: number;
773773
unsupportedPackageJsonSettings?: unknown;
774774
useWorkspaces?: boolean;
775775
}
@@ -1199,7 +1199,7 @@ export class PnpmOptionsConfiguration extends PackageManagerOptionsConfiguration
11991199
readonly strictPeerDependencies: boolean;
12001200
readonly trustPolicy: PnpmTrustPolicy | undefined;
12011201
readonly trustPolicyExclude: string[] | undefined;
1202-
readonly trustPolicyIgnoreAfter: number | undefined;
1202+
readonly trustPolicyIgnoreAfterMinutes: number | undefined;
12031203
readonly unsupportedPackageJsonSettings: unknown | undefined;
12041204
updateGlobalOnlyBuiltDependencies(onlyBuiltDependencies: string[] | undefined): void;
12051205
updateGlobalPatchedDependencies(patchedDependencies: Record<string, string> | undefined): void;

libraries/rush-lib/assets/rush-init/common/config/rush/pnpm-config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@
141141
* For example, the following setting ignores trust level changes for packages published
142142
* more than 14 days ago:
143143
*
144-
* "trustPolicyIgnoreAfter": 20160
144+
* "trustPolicyIgnoreAfterMinutes": 20160
145145
*
146146
* (SUPPORTED ONLY IN PNPM 10.27.0 AND NEWER)
147147
*
148148
* PNPM documentation: https://pnpm.io/settings#trustpolicyignoreafter
149149
*
150150
* The default value is undefined (no exclusion).
151151
*/
152-
/*[LINE "HYPOTHETICAL"]*/ "trustPolicyIgnoreAfter": 20160,
152+
/*[LINE "HYPOTHETICAL"]*/ "trustPolicyIgnoreAfterMinutes": 20160,
153153

154154
/**
155155
* If true, then Rush will add the `--strict-peer-dependencies` command-line parameter when

libraries/rush-lib/src/logic/installManager/InstallHelpers.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ interface ICommonPackageJson extends IPackageJson {
3939
minimumReleaseAgeExclude?: typeof PnpmOptionsConfiguration.prototype.minimumReleaseAgeExclude;
4040
trustPolicy?: typeof PnpmOptionsConfiguration.prototype.trustPolicy;
4141
trustPolicyExclude?: typeof PnpmOptionsConfiguration.prototype.trustPolicyExclude;
42-
trustPolicyIgnoreAfter?: typeof PnpmOptionsConfiguration.prototype.trustPolicyIgnoreAfter;
42+
trustPolicyIgnoreAfter?: typeof PnpmOptionsConfiguration.prototype.trustPolicyIgnoreAfterMinutes;
4343
};
4444
}
4545

@@ -184,22 +184,23 @@ export class InstallHelpers {
184184
commonPackageJson.pnpm.trustPolicyExclude = pnpmOptions.trustPolicyExclude;
185185
}
186186

187-
if (pnpmOptions.trustPolicyIgnoreAfter !== undefined) {
187+
if (pnpmOptions.trustPolicyIgnoreAfterMinutes !== undefined) {
188188
if (
189189
rushConfiguration.rushConfigurationJson.pnpmVersion !== undefined &&
190190
semver.lt(rushConfiguration.rushConfigurationJson.pnpmVersion, '10.27.0')
191191
) {
192192
terminal.writeWarningLine(
193193
Colorize.yellow(
194194
`Your version of pnpm (${rushConfiguration.rushConfigurationJson.pnpmVersion}) ` +
195-
`doesn't support the "trustPolicyIgnoreAfter" field in ` +
195+
`doesn't support the "trustPolicyIgnoreAfterMinutes" field in ` +
196196
`${rushConfiguration.commonRushConfigFolder}/${RushConstants.pnpmConfigFilename}. ` +
197197
'Remove this field or upgrade to pnpm 10.27.0 or newer.'
198198
)
199199
);
200200
}
201201

202-
commonPackageJson.pnpm.trustPolicyIgnoreAfter = pnpmOptions.trustPolicyIgnoreAfter;
202+
// NOTE: the pnpm setting is `trustPolicyIgnoreAfter`, but the rush pnpm setting is `trustPolicyIgnoreAfterMinutes`
203+
commonPackageJson.pnpm.trustPolicyIgnoreAfter = pnpmOptions.trustPolicyIgnoreAfterMinutes;
203204
}
204205

205206
if (pnpmOptions.unsupportedPackageJsonSettings) {

libraries/rush-lib/src/logic/pnpm/PnpmOptionsConfiguration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export interface IPnpmOptionsJson extends IPackageManagerOptionsJsonBase {
171171
/**
172172
* {@inheritDoc PnpmOptionsConfiguration.trustPolicyIgnoreAfter}
173173
*/
174-
trustPolicyIgnoreAfter?: number;
174+
trustPolicyIgnoreAfterMinutes?: number;
175175
/**
176176
* {@inheritDoc PnpmOptionsConfiguration.alwaysInjectDependenciesFromOtherSubspaces}
177177
*/
@@ -357,7 +357,7 @@ export class PnpmOptionsConfiguration extends PackageManagerOptionsConfiguration
357357
*
358358
* PNPM documentation: https://pnpm.io/settings#trustpolicyignoreafter
359359
*/
360-
public readonly trustPolicyIgnoreAfter: number | undefined;
360+
public readonly trustPolicyIgnoreAfterMinutes: number | undefined;
361361

362362
/**
363363
* If true, then `rush update` add injected install options for all cross-subspace
@@ -555,7 +555,7 @@ export class PnpmOptionsConfiguration extends PackageManagerOptionsConfiguration
555555
this.minimumReleaseAgeExclude = json.minimumReleaseAgeExclude;
556556
this.trustPolicy = json.trustPolicy;
557557
this.trustPolicyExclude = json.trustPolicyExclude;
558-
this.trustPolicyIgnoreAfter = json.trustPolicyIgnoreAfter;
558+
this.trustPolicyIgnoreAfterMinutes = json.trustPolicyIgnoreAfterMinutes;
559559
this.alwaysInjectDependenciesFromOtherSubspaces = json.alwaysInjectDependenciesFromOtherSubspaces;
560560
this.alwaysFullInstall = json.alwaysFullInstall;
561561
this.pnpmLockfilePolicies = json.pnpmLockfilePolicies;

libraries/rush-lib/src/logic/pnpm/test/PnpmOptionsConfiguration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe(PnpmOptionsConfiguration.name, () => {
113113
'webpack@4.47.0 || 5.102.1',
114114
'@babel/core@7.28.5'
115115
]);
116-
expect(pnpmConfiguration.trustPolicyIgnoreAfter).toEqual(20160);
116+
expect(pnpmConfiguration.trustPolicyIgnoreAfterMinutes).toEqual(20160);
117117
});
118118

119119
it('loads catalog and catalogs', () => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"trustPolicy": "no-downgrade",
33
"trustPolicyExclude": ["@myorg/*", "chokidar@4.0.3", "webpack@4.47.0 || 5.102.1", "@babel/core@7.28.5"],
4-
"trustPolicyIgnoreAfter": 20160
4+
"trustPolicyIgnoreAfterMinutes": 20160
55
}

libraries/rush-lib/src/schemas/pnpm-config.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
}
230230
},
231231

232-
"trustPolicyIgnoreAfter": {
232+
"trustPolicyIgnoreAfterMinutes": {
233233
"description": "The number of minutes after which pnpm will ignore trust level downgrades. Packages published longer ago than this threshold will not be blocked even if their trust level has decreased.\n\n(SUPPORTED ONLY IN PNPM 10.27.0 AND NEWER)\n\nPNPM documentation: https://pnpm.io/settings#trustpolicyignoreafter",
234234
"type": "number"
235235
},

0 commit comments

Comments
 (0)