pnpm-settings-migrator 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -7
- package/dist/cli.mjs +90 -7
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +89 -6
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -180,6 +180,20 @@ consumes them from workspace configuration; their v11 support is unchanged.
|
|
|
180
180
|
Invalid values and fields unsupported by the target remain in their sources.
|
|
181
181
|
The global-only `macosBackup` setting is preserved with a project-refused warning.
|
|
182
182
|
|
|
183
|
+
`forceIgnoresPlatform` requires pnpm 11.28.0+ or 12.7.0+. pnpm's defaults differ
|
|
184
|
+
between those majors; the migrator only moves explicit values. For v12,
|
|
185
|
+
`publishWaitTimeout` and `reporter` require 12.7.0+. The timeout is a nonnegative
|
|
186
|
+
safe integer in milliseconds (zero disables waiting); numeric `.npmrc` values
|
|
187
|
+
are converted to YAML numbers. Reporter values are `default`, `append-only`,
|
|
188
|
+
`ndjson`, and `silent`, or preserved environment placeholders.
|
|
189
|
+
|
|
190
|
+
From 11.28.0 / 12.7.0, dynamic `userAgent` values remain in their sources because
|
|
191
|
+
pnpm ignores project values containing environment placeholders. From 11.28.1,
|
|
192
|
+
invalid `patchedDependencies` maps and non-array `packages` values are retained
|
|
193
|
+
with diagnostics. From 12.8.2, `globalShims` belongs in trusted global
|
|
194
|
+
configuration and is retained with an incompatibility warning. Existing
|
|
195
|
+
workspaces containing these incompatible values fail validation before writes.
|
|
196
|
+
|
|
183
197
|
</details>
|
|
184
198
|
|
|
185
199
|
<details>
|
|
@@ -254,13 +268,16 @@ Notes:
|
|
|
254
268
|
- The migrator does not update the `packageManager` version, CI environment variables,
|
|
255
269
|
shell setup, or pnpm commands in scripts. When `packageManager` still pins pnpm 10,
|
|
256
270
|
pass `--compatibility v11` explicitly and update the pin separately.
|
|
257
|
-
- Compatibility checks cover pnpm 11.
|
|
258
|
-
11.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
271
|
+
- Compatibility checks cover pnpm 11.28.2 and 12.8.2, including 11.28.0,
|
|
272
|
+
11.28.1, 12.7.0, 12.8.0, and 12.8.1. Earlier regressions remain at 11.25.0,
|
|
273
|
+
11.26.0, 11.27.1, 12.2.1, 12.3.4, 12.4.0, 12.4.2, 12.5.0, 12.5.1, and 12.6.0.
|
|
274
|
+
As [audited on 2026-09-30](docs/research/pnpm-settings-bump-2026-09-30.md),
|
|
275
|
+
npm `latest` is 12.8.1; the highest confirmed stable release is 12.8.2 on
|
|
276
|
+
`next-12`. The project is pinned to 12.8.1. These checks verify the documented
|
|
277
|
+
fixtures, not every setting in every release. v10 has unit regressions and
|
|
278
|
+
source review through 10.34.6; real v10 consumption remains unverified.
|
|
279
|
+
The removed `pnpm install --resolution-only` CLI flag is outside this settings
|
|
280
|
+
migrator's scope; replace it with `pnpm peers check` in scripts before upgrading.
|
|
264
281
|
|
|
265
282
|
</details>
|
|
266
283
|
|
package/dist/cli.mjs
CHANGED
|
@@ -530,11 +530,61 @@ const PNPM_V12_5_1_MINIMUM_VERSION = [
|
|
|
530
530
|
1
|
|
531
531
|
];
|
|
532
532
|
/**
|
|
533
|
+
* Release introducing forceIgnoresPlatform and filtering dynamic user agents.
|
|
534
|
+
*/
|
|
535
|
+
const PNPM_V11_28_MINIMUM_VERSION = [
|
|
536
|
+
11,
|
|
537
|
+
28,
|
|
538
|
+
0
|
|
539
|
+
];
|
|
540
|
+
/**
|
|
541
|
+
* Release validating patch path maps before reading them.
|
|
542
|
+
*/
|
|
543
|
+
const PNPM_V11_28_1_MINIMUM_VERSION = [
|
|
544
|
+
11,
|
|
545
|
+
28,
|
|
546
|
+
1
|
|
547
|
+
];
|
|
548
|
+
/**
|
|
549
|
+
* Release adding force, publishing, and reporter settings.
|
|
550
|
+
*/
|
|
551
|
+
const PNPM_V12_7_MINIMUM_VERSION = [
|
|
552
|
+
12,
|
|
553
|
+
7,
|
|
554
|
+
0
|
|
555
|
+
];
|
|
556
|
+
/**
|
|
557
|
+
* Release restricting global shims to trusted configuration.
|
|
558
|
+
*/
|
|
559
|
+
const PNPM_V12_8_2_MINIMUM_VERSION = [
|
|
560
|
+
12,
|
|
561
|
+
8,
|
|
562
|
+
2
|
|
563
|
+
];
|
|
564
|
+
/**
|
|
565
|
+
* Workspace settings first consumed by pnpm v12 in 12.7.0.
|
|
566
|
+
*/
|
|
567
|
+
const PNPM_V12_7_WORKSPACE_SETTINGS = [
|
|
568
|
+
"forceIgnoresPlatform",
|
|
569
|
+
"publishWaitTimeout",
|
|
570
|
+
"reporter"
|
|
571
|
+
];
|
|
572
|
+
/**
|
|
533
573
|
* Version-gated settings. Add a release entry only when supported fields change.
|
|
534
574
|
*
|
|
535
575
|
* @see https://github.com/pnpm/pnpm/blob/v12.4.0/pnpm/crates/config/src/workspace_yaml.rs
|
|
536
576
|
*/
|
|
537
577
|
const PNPM_SETTINGS_CAPABILITIES = [
|
|
578
|
+
{
|
|
579
|
+
minimumVersion: PNPM_V11_28_MINIMUM_VERSION,
|
|
580
|
+
workspaceFields: ["forceIgnoresPlatform"],
|
|
581
|
+
taskFields: []
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
minimumVersion: PNPM_V12_7_MINIMUM_VERSION,
|
|
585
|
+
workspaceFields: PNPM_V12_7_WORKSPACE_SETTINGS,
|
|
586
|
+
taskFields: []
|
|
587
|
+
},
|
|
538
588
|
{
|
|
539
589
|
minimumVersion: [
|
|
540
590
|
11,
|
|
@@ -602,7 +652,7 @@ const v11OnlyWorkspaceSettings = new Set(PNPM_V11_ONLY_WORKSPACE_SETTINGS);
|
|
|
602
652
|
/**
|
|
603
653
|
* Settings accepted by a pnpm v12 project workspace manifest.
|
|
604
654
|
*/
|
|
605
|
-
const PNPM_V12_WORKSPACE_SETTINGS_FIELDS = [...PNPM_V11_WORKSPACE_SETTINGS_FIELDS.filter((field) => !v11OnlyWorkspaceSettings.has(field) && !PNPM_V12_6_WORKSPACE_SETTINGS.includes(field)), ...PNPM_V12_ONLY_WORKSPACE_SETTINGS];
|
|
655
|
+
const PNPM_V12_WORKSPACE_SETTINGS_FIELDS = [...PNPM_V11_WORKSPACE_SETTINGS_FIELDS.filter((field) => !v11OnlyWorkspaceSettings.has(field) && !PNPM_V12_6_WORKSPACE_SETTINGS.includes(field) && !PNPM_V12_7_WORKSPACE_SETTINGS.includes(field)), ...PNPM_V12_ONLY_WORKSPACE_SETTINGS];
|
|
606
656
|
//#endregion
|
|
607
657
|
//#region src/constants/settings-schema.ts
|
|
608
658
|
/**
|
|
@@ -982,8 +1032,19 @@ const MAX_TASK_PRIORITY = 2147483647;
|
|
|
982
1032
|
* @returns Whether a scalar value cannot be read by the target
|
|
983
1033
|
*/
|
|
984
1034
|
function hasInvalidScalarValue(key, value, target) {
|
|
985
|
-
if ([
|
|
1035
|
+
if ([
|
|
1036
|
+
"autoDedupe",
|
|
1037
|
+
"saveTypes",
|
|
1038
|
+
"forceIgnoresPlatform"
|
|
1039
|
+
].includes(key)) return !isBoolean(value);
|
|
1040
|
+
if (key === "publishWaitTimeout") return !isNumber(value) || !Number.isSafeInteger(value) || value < 0;
|
|
986
1041
|
if (target.compatibility === "v12") {
|
|
1042
|
+
if (key === "reporter") return !isString(value) || !value.includes("${") && ![
|
|
1043
|
+
"default",
|
|
1044
|
+
"append-only",
|
|
1045
|
+
"ndjson",
|
|
1046
|
+
"silent"
|
|
1047
|
+
].includes(value);
|
|
987
1048
|
if (key === "progress") return !isBoolean(value);
|
|
988
1049
|
if (key === "tagVersionPrefix") return !isString(value);
|
|
989
1050
|
if (key === "loglevel") return !isString(value) || !value.includes("${") && ![
|
|
@@ -997,6 +1058,22 @@ function hasInvalidScalarValue(key, value, target) {
|
|
|
997
1058
|
return false;
|
|
998
1059
|
}
|
|
999
1060
|
/**
|
|
1061
|
+
* Reject settings ignored or newly validated by the September releases.
|
|
1062
|
+
*
|
|
1063
|
+
* @param key - Canonical workspace setting name
|
|
1064
|
+
* @param value - Untrusted source value
|
|
1065
|
+
* @param target - Confirmed version for release-specific restrictions
|
|
1066
|
+
*
|
|
1067
|
+
* @returns Whether the value cannot be used by the target release
|
|
1068
|
+
*/
|
|
1069
|
+
function hasInvalidReleaseValue(key, value, target) {
|
|
1070
|
+
if (key === "globalShims" && supportsMinimumVersion(target.version, PNPM_V12_8_2_MINIMUM_VERSION)) return true;
|
|
1071
|
+
if (key === "userAgent" && isString(value) && value.includes("${") && (supportsMinimumVersion(target.version, PNPM_V11_28_MINIMUM_VERSION) || supportsMinimumVersion(target.version, PNPM_V12_7_MINIMUM_VERSION))) return true;
|
|
1072
|
+
if (key === "packages" && value !== null && value !== void 0 && supportsMinimumVersion(target.version, PNPM_V11_28_1_MINIMUM_VERSION)) return !isArray(value) || value.some((entry) => !isString(entry) || !entry);
|
|
1073
|
+
if (key === "patchedDependencies" && supportsMinimumVersion(target.version, PNPM_V11_28_1_MINIMUM_VERSION)) return !value || typeof value !== "object" || isArray(value) || !Object.values(value).every(isString);
|
|
1074
|
+
return false;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1000
1077
|
* Check value shapes that changed within a pnpm major release.
|
|
1001
1078
|
*
|
|
1002
1079
|
* Reject the whole setting so cleanup cannot discard unsupported nested values.
|
|
@@ -1008,6 +1085,7 @@ function hasInvalidScalarValue(key, value, target) {
|
|
|
1008
1085
|
* @returns Whether the value uses a shape unsupported by the selected release
|
|
1009
1086
|
*/
|
|
1010
1087
|
function hasIncompatibleSettingValue(key, value, target) {
|
|
1088
|
+
if (hasInvalidReleaseValue(key, value, target)) return true;
|
|
1011
1089
|
if (hasInvalidScalarValue(key, value, target)) return true;
|
|
1012
1090
|
const supportsV12_5 = supportsMinimumVersion(target.version, PNPM_V12_5_MINIMUM_VERSION);
|
|
1013
1091
|
if (key === "supportedArchitectures" && isArray(value)) return !supportsV12_5;
|
|
@@ -1527,12 +1605,15 @@ function normalizeNpmrcKey(key) {
|
|
|
1527
1605
|
/**
|
|
1528
1606
|
* Convert scalar list settings to the array representation required by YAML.
|
|
1529
1607
|
*
|
|
1530
|
-
* @param settings -
|
|
1608
|
+
* @param settings - `.npmrc` settings with original or camelCase keys
|
|
1531
1609
|
*
|
|
1532
1610
|
* @returns Settings with each scalar list value preserved as one array item
|
|
1533
1611
|
*/
|
|
1534
1612
|
function normalizeNpmrcSettings(settings) {
|
|
1535
|
-
for (const key of
|
|
1613
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
1614
|
+
const canonicalKey = Object.keys(camelcaseKeys({ [key]: true }))[0] ?? key;
|
|
1615
|
+
if (NPMRC_STRING_ARRAY_SETTINGS.includes(canonicalKey) && isString(value)) settings[key] = [value];
|
|
1616
|
+
}
|
|
1536
1617
|
return settings;
|
|
1537
1618
|
}
|
|
1538
1619
|
/**
|
|
@@ -1646,7 +1727,9 @@ async function readMigratableNpmrc(path, target, options = {}) {
|
|
|
1646
1727
|
nodeDownloadMirrorKeys.push(key);
|
|
1647
1728
|
nodeDownloadMirrors[nodeMirrorMatch.groups.channel] = String(value);
|
|
1648
1729
|
} else {
|
|
1649
|
-
const
|
|
1730
|
+
const [canonicalKey] = Object.keys(camelcaseKeys({ [key]: true }));
|
|
1731
|
+
const settingValue = canonicalKey === "publishWaitTimeout" && isString(value) && /^\d+$/u.test(value) ? Number(value) : value;
|
|
1732
|
+
const selected = selectPnpmSettings(normalizeNpmrcSettings({ [key]: settingValue }), target, {
|
|
1650
1733
|
allowedFields: options.allowedFields,
|
|
1651
1734
|
npmrc: true
|
|
1652
1735
|
});
|
|
@@ -1655,7 +1738,7 @@ async function readMigratableNpmrc(path, target, options = {}) {
|
|
|
1655
1738
|
mergeSettingsIssues(issues, selected.issues);
|
|
1656
1739
|
}
|
|
1657
1740
|
}
|
|
1658
|
-
const settings =
|
|
1741
|
+
const settings = migratable;
|
|
1659
1742
|
if (Object.keys(nodeDownloadMirrors).length) {
|
|
1660
1743
|
const selected = selectPnpmSettings({ nodeDownloadMirrors }, target, { allowedFields: options.allowedFields });
|
|
1661
1744
|
if (selected.keys.length) {
|
|
@@ -2774,7 +2857,7 @@ const bold = getColor("bold");
|
|
|
2774
2857
|
//#endregion
|
|
2775
2858
|
//#region package.json
|
|
2776
2859
|
var name = "pnpm-settings-migrator";
|
|
2777
|
-
var version = "0.
|
|
2860
|
+
var version = "0.14.0";
|
|
2778
2861
|
//#endregion
|
|
2779
2862
|
//#region src/cli/options.ts
|
|
2780
2863
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -206,6 +206,14 @@ interface PnpmRegistryDeclaration extends RegistryDeclaration {
|
|
|
206
206
|
* Settings supported by pnpm v12, subject to the resolved version capabilities.
|
|
207
207
|
*/
|
|
208
208
|
interface PnpmSettingsV12 {
|
|
209
|
+
/**
|
|
210
|
+
* Milliseconds to wait for published artifacts; zero disables waiting (12.7+).
|
|
211
|
+
*/
|
|
212
|
+
publishWaitTimeout?: number;
|
|
213
|
+
/**
|
|
214
|
+
* Default terminal reporter (consumed by pnpm v12 from 12.7).
|
|
215
|
+
*/
|
|
216
|
+
reporter?: 'default' | 'append-only' | 'ndjson' | 'silent';
|
|
209
217
|
/**
|
|
210
218
|
* Deduplicate compatible dependency versions during installation (pnpm 12.6+).
|
|
211
219
|
*/
|
|
@@ -248,6 +256,7 @@ interface PnpmSettingsV12 {
|
|
|
248
256
|
externalDependencies?: string[];
|
|
249
257
|
/**
|
|
250
258
|
* Project-aware global shim policies, or `false` to disable global shims.
|
|
259
|
+
* Project configuration is accepted only before pnpm 12.8.2.
|
|
251
260
|
*/
|
|
252
261
|
globalShims?: false | Record<string, GlobalShimPolicy>;
|
|
253
262
|
/**
|
|
@@ -395,6 +404,11 @@ interface PnpmSettingsDeprecated {
|
|
|
395
404
|
* Settings introduced in pnpm v11.
|
|
396
405
|
*/
|
|
397
406
|
interface PnpmSettingsV11 {
|
|
407
|
+
/**
|
|
408
|
+
* Let --force install optional dependencies for other platforms
|
|
409
|
+
* (pnpm 11.28+ and 12.7+). Defaults remain controlled by pnpm.
|
|
410
|
+
*/
|
|
411
|
+
forceIgnoresPlatform?: boolean;
|
|
398
412
|
/**
|
|
399
413
|
* Canonical replacement for the legacy `cleanupUnusedCatalogs` setting.
|
|
400
414
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -528,11 +528,61 @@ const PNPM_V12_5_1_MINIMUM_VERSION = [
|
|
|
528
528
|
1
|
|
529
529
|
];
|
|
530
530
|
/**
|
|
531
|
+
* Release introducing forceIgnoresPlatform and filtering dynamic user agents.
|
|
532
|
+
*/
|
|
533
|
+
const PNPM_V11_28_MINIMUM_VERSION = [
|
|
534
|
+
11,
|
|
535
|
+
28,
|
|
536
|
+
0
|
|
537
|
+
];
|
|
538
|
+
/**
|
|
539
|
+
* Release validating patch path maps before reading them.
|
|
540
|
+
*/
|
|
541
|
+
const PNPM_V11_28_1_MINIMUM_VERSION = [
|
|
542
|
+
11,
|
|
543
|
+
28,
|
|
544
|
+
1
|
|
545
|
+
];
|
|
546
|
+
/**
|
|
547
|
+
* Release adding force, publishing, and reporter settings.
|
|
548
|
+
*/
|
|
549
|
+
const PNPM_V12_7_MINIMUM_VERSION = [
|
|
550
|
+
12,
|
|
551
|
+
7,
|
|
552
|
+
0
|
|
553
|
+
];
|
|
554
|
+
/**
|
|
555
|
+
* Release restricting global shims to trusted configuration.
|
|
556
|
+
*/
|
|
557
|
+
const PNPM_V12_8_2_MINIMUM_VERSION = [
|
|
558
|
+
12,
|
|
559
|
+
8,
|
|
560
|
+
2
|
|
561
|
+
];
|
|
562
|
+
/**
|
|
563
|
+
* Workspace settings first consumed by pnpm v12 in 12.7.0.
|
|
564
|
+
*/
|
|
565
|
+
const PNPM_V12_7_WORKSPACE_SETTINGS = [
|
|
566
|
+
"forceIgnoresPlatform",
|
|
567
|
+
"publishWaitTimeout",
|
|
568
|
+
"reporter"
|
|
569
|
+
];
|
|
570
|
+
/**
|
|
531
571
|
* Version-gated settings. Add a release entry only when supported fields change.
|
|
532
572
|
*
|
|
533
573
|
* @see https://github.com/pnpm/pnpm/blob/v12.4.0/pnpm/crates/config/src/workspace_yaml.rs
|
|
534
574
|
*/
|
|
535
575
|
const PNPM_SETTINGS_CAPABILITIES = [
|
|
576
|
+
{
|
|
577
|
+
minimumVersion: PNPM_V11_28_MINIMUM_VERSION,
|
|
578
|
+
workspaceFields: ["forceIgnoresPlatform"],
|
|
579
|
+
taskFields: []
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
minimumVersion: PNPM_V12_7_MINIMUM_VERSION,
|
|
583
|
+
workspaceFields: PNPM_V12_7_WORKSPACE_SETTINGS,
|
|
584
|
+
taskFields: []
|
|
585
|
+
},
|
|
536
586
|
{
|
|
537
587
|
minimumVersion: [
|
|
538
588
|
11,
|
|
@@ -600,7 +650,7 @@ const v11OnlyWorkspaceSettings = new Set(PNPM_V11_ONLY_WORKSPACE_SETTINGS);
|
|
|
600
650
|
/**
|
|
601
651
|
* Settings accepted by a pnpm v12 project workspace manifest.
|
|
602
652
|
*/
|
|
603
|
-
const PNPM_V12_WORKSPACE_SETTINGS_FIELDS = [...PNPM_V11_WORKSPACE_SETTINGS_FIELDS.filter((field) => !v11OnlyWorkspaceSettings.has(field) && !PNPM_V12_6_WORKSPACE_SETTINGS.includes(field)), ...PNPM_V12_ONLY_WORKSPACE_SETTINGS];
|
|
653
|
+
const PNPM_V12_WORKSPACE_SETTINGS_FIELDS = [...PNPM_V11_WORKSPACE_SETTINGS_FIELDS.filter((field) => !v11OnlyWorkspaceSettings.has(field) && !PNPM_V12_6_WORKSPACE_SETTINGS.includes(field) && !PNPM_V12_7_WORKSPACE_SETTINGS.includes(field)), ...PNPM_V12_ONLY_WORKSPACE_SETTINGS];
|
|
604
654
|
//#endregion
|
|
605
655
|
//#region src/constants/settings-schema.ts
|
|
606
656
|
/**
|
|
@@ -975,8 +1025,19 @@ const MAX_TASK_PRIORITY = 2147483647;
|
|
|
975
1025
|
* @returns Whether a scalar value cannot be read by the target
|
|
976
1026
|
*/
|
|
977
1027
|
function hasInvalidScalarValue(key, value, target) {
|
|
978
|
-
if ([
|
|
1028
|
+
if ([
|
|
1029
|
+
"autoDedupe",
|
|
1030
|
+
"saveTypes",
|
|
1031
|
+
"forceIgnoresPlatform"
|
|
1032
|
+
].includes(key)) return !isBoolean(value);
|
|
1033
|
+
if (key === "publishWaitTimeout") return !isNumber(value) || !Number.isSafeInteger(value) || value < 0;
|
|
979
1034
|
if (target.compatibility === "v12") {
|
|
1035
|
+
if (key === "reporter") return !isString(value) || !value.includes("${") && ![
|
|
1036
|
+
"default",
|
|
1037
|
+
"append-only",
|
|
1038
|
+
"ndjson",
|
|
1039
|
+
"silent"
|
|
1040
|
+
].includes(value);
|
|
980
1041
|
if (key === "progress") return !isBoolean(value);
|
|
981
1042
|
if (key === "tagVersionPrefix") return !isString(value);
|
|
982
1043
|
if (key === "loglevel") return !isString(value) || !value.includes("${") && ![
|
|
@@ -990,6 +1051,22 @@ function hasInvalidScalarValue(key, value, target) {
|
|
|
990
1051
|
return false;
|
|
991
1052
|
}
|
|
992
1053
|
/**
|
|
1054
|
+
* Reject settings ignored or newly validated by the September releases.
|
|
1055
|
+
*
|
|
1056
|
+
* @param key - Canonical workspace setting name
|
|
1057
|
+
* @param value - Untrusted source value
|
|
1058
|
+
* @param target - Confirmed version for release-specific restrictions
|
|
1059
|
+
*
|
|
1060
|
+
* @returns Whether the value cannot be used by the target release
|
|
1061
|
+
*/
|
|
1062
|
+
function hasInvalidReleaseValue(key, value, target) {
|
|
1063
|
+
if (key === "globalShims" && supportsMinimumVersion(target.version, PNPM_V12_8_2_MINIMUM_VERSION)) return true;
|
|
1064
|
+
if (key === "userAgent" && isString(value) && value.includes("${") && (supportsMinimumVersion(target.version, PNPM_V11_28_MINIMUM_VERSION) || supportsMinimumVersion(target.version, PNPM_V12_7_MINIMUM_VERSION))) return true;
|
|
1065
|
+
if (key === "packages" && value !== null && value !== void 0 && supportsMinimumVersion(target.version, PNPM_V11_28_1_MINIMUM_VERSION)) return !isArray(value) || value.some((entry) => !isString(entry) || !entry);
|
|
1066
|
+
if (key === "patchedDependencies" && supportsMinimumVersion(target.version, PNPM_V11_28_1_MINIMUM_VERSION)) return !value || typeof value !== "object" || isArray(value) || !Object.values(value).every(isString);
|
|
1067
|
+
return false;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
993
1070
|
* Check value shapes that changed within a pnpm major release.
|
|
994
1071
|
*
|
|
995
1072
|
* Reject the whole setting so cleanup cannot discard unsupported nested values.
|
|
@@ -1001,6 +1078,7 @@ function hasInvalidScalarValue(key, value, target) {
|
|
|
1001
1078
|
* @returns Whether the value uses a shape unsupported by the selected release
|
|
1002
1079
|
*/
|
|
1003
1080
|
function hasIncompatibleSettingValue(key, value, target) {
|
|
1081
|
+
if (hasInvalidReleaseValue(key, value, target)) return true;
|
|
1004
1082
|
if (hasInvalidScalarValue(key, value, target)) return true;
|
|
1005
1083
|
const supportsV12_5 = supportsMinimumVersion(target.version, PNPM_V12_5_MINIMUM_VERSION);
|
|
1006
1084
|
if (key === "supportedArchitectures" && isArray(value)) return !supportsV12_5;
|
|
@@ -1520,12 +1598,15 @@ function normalizeNpmrcKey(key) {
|
|
|
1520
1598
|
/**
|
|
1521
1599
|
* Convert scalar list settings to the array representation required by YAML.
|
|
1522
1600
|
*
|
|
1523
|
-
* @param settings -
|
|
1601
|
+
* @param settings - `.npmrc` settings with original or camelCase keys
|
|
1524
1602
|
*
|
|
1525
1603
|
* @returns Settings with each scalar list value preserved as one array item
|
|
1526
1604
|
*/
|
|
1527
1605
|
function normalizeNpmrcSettings(settings) {
|
|
1528
|
-
for (const key of
|
|
1606
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
1607
|
+
const canonicalKey = Object.keys(camelcaseKeys({ [key]: true }))[0] ?? key;
|
|
1608
|
+
if (NPMRC_STRING_ARRAY_SETTINGS.includes(canonicalKey) && isString(value)) settings[key] = [value];
|
|
1609
|
+
}
|
|
1529
1610
|
return settings;
|
|
1530
1611
|
}
|
|
1531
1612
|
/**
|
|
@@ -1639,7 +1720,9 @@ async function readMigratableNpmrc(path, target, options = {}) {
|
|
|
1639
1720
|
nodeDownloadMirrorKeys.push(key);
|
|
1640
1721
|
nodeDownloadMirrors[nodeMirrorMatch.groups.channel] = String(value);
|
|
1641
1722
|
} else {
|
|
1642
|
-
const
|
|
1723
|
+
const [canonicalKey] = Object.keys(camelcaseKeys({ [key]: true }));
|
|
1724
|
+
const settingValue = canonicalKey === "publishWaitTimeout" && isString(value) && /^\d+$/u.test(value) ? Number(value) : value;
|
|
1725
|
+
const selected = selectPnpmSettings(normalizeNpmrcSettings({ [key]: settingValue }), target, {
|
|
1643
1726
|
allowedFields: options.allowedFields,
|
|
1644
1727
|
npmrc: true
|
|
1645
1728
|
});
|
|
@@ -1648,7 +1731,7 @@ async function readMigratableNpmrc(path, target, options = {}) {
|
|
|
1648
1731
|
mergeSettingsIssues(issues, selected.issues);
|
|
1649
1732
|
}
|
|
1650
1733
|
}
|
|
1651
|
-
const settings =
|
|
1734
|
+
const settings = migratable;
|
|
1652
1735
|
if (Object.keys(nodeDownloadMirrors).length) {
|
|
1653
1736
|
const selected = selectPnpmSettings({ nodeDownloadMirrors }, target, { allowedFields: options.allowedFields });
|
|
1654
1737
|
if (selected.keys.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pnpm-settings-migrator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Move pnpm settings from `pnpm` field in `package.json` and `.npmrc` file to `pnpm-workspace.yaml`",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"migrator",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ntnyq/utils": "^0.23.0",
|
|
46
|
-
"@pnpm/types": "^1102.1.
|
|
46
|
+
"@pnpm/types": "^1102.1.1",
|
|
47
47
|
"cac": "^7.0.0",
|
|
48
48
|
"camelcase-keys": "^10.0.3",
|
|
49
49
|
"consola": "^3.4.2",
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
"yaml": "^2.9.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^26.6.
|
|
59
|
+
"@types/node": "^26.6.3",
|
|
60
60
|
"bumpp": "^12.3.0",
|
|
61
61
|
"husky": "^9.1.7",
|
|
62
62
|
"nano-staged": "^1.0.2",
|
|
63
63
|
"npm-run-all2": "^9.0.3",
|
|
64
|
-
"oxfmt": "^0.
|
|
65
|
-
"oxlint": "^1.
|
|
64
|
+
"oxfmt": "^0.71.0",
|
|
65
|
+
"oxlint": "^1.86.0",
|
|
66
66
|
"tsdown": "^0.23.0",
|
|
67
67
|
"tsx": "^4.23.15",
|
|
68
68
|
"typescript": "^7.0.2",
|
|
69
|
-
"vitest": "^5.0.
|
|
69
|
+
"vitest": "^5.0.2"
|
|
70
70
|
},
|
|
71
71
|
"nano-staged": {
|
|
72
72
|
"*.{js,ts,mjs,tsx}": "oxlint --fix",
|