pnpm-settings-migrator 0.11.0 → 0.13.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 CHANGED
@@ -15,6 +15,9 @@ Run in your workspace root:
15
15
  pnpm dlx pnpm-settings-migrator
16
16
  ```
17
17
 
18
+ <details>
19
+ <summary>CLI output and migration outcomes</summary>
20
+
18
21
  After migration, the CLI reports how many root settings changed and shows a
19
22
  GitHub-style YAML diff. Removed lines are red and added lines are green:
20
23
 
@@ -49,6 +52,8 @@ Other outcomes are reported according to the files actually changed:
49
52
  - File formatting changes with no settings diff: `✔ Migration completed. Configuration files updated.`
50
53
  - Failure: one error report and exit code `1`.
51
54
 
55
+ </details>
56
+
52
57
  ## Library usage
53
58
 
54
59
  ```ts
@@ -57,6 +62,9 @@ import { migratePnpmSettings } from 'pnpm-settings-migrator'
57
62
  const result = await migratePnpmSettings({ cwd: '/path/to/workspace' })
58
63
  ```
59
64
 
65
+ <details>
66
+ <summary>Library results and error handling</summary>
67
+
60
68
  Library calls now return a `MigrationResult` and do not print logs. The result
61
69
  contains `settingsChanges` (before/after root workspace settings), `changedFiles`
62
70
  (absolute paths, including created or removed files), `sourceSettingsCleaned`,
@@ -64,6 +72,8 @@ contains `settingsChanges` (before/after root workspace settings), `changedFiles
64
72
  thrown to the caller. Consumers that relied on console output should render the
65
73
  returned changes and warnings themselves.
66
74
 
75
+ </details>
76
+
67
77
  ## CLI Options
68
78
 
69
79
  ### `--cwd`
@@ -95,6 +105,9 @@ Compatibility major for migrated settings:
95
105
  - `v12`: use the v12 schema, including `globalShims`, and enable additional
96
106
  fields according to the confirmed target version.
97
107
 
108
+ <details>
109
+ <summary>Compatibility resolution and validation</summary>
110
+
98
111
  An explicit major still uses a matching version from the project declarations.
99
112
  For example, `--compatibility v12` with `packageManager: "pnpm@12.4.0"` enables
100
113
  12.4 capabilities. A pin to another major supplies no minor capabilities for
@@ -104,6 +117,8 @@ In `v11` and `v12` modes, the migrator validates existing workspace keys,
104
117
  filters incoming settings against the resolved capabilities, and applies
105
118
  required normalization to legacy files and `pnpm-workspace.yaml`.
106
119
 
120
+ </details>
121
+
107
122
  ### `--target-version`
108
123
 
109
124
  - **Type**: `string` (an exact version such as `'12.4.0'`)
@@ -120,18 +135,56 @@ await migratePnpmSettings({ compatibility: 'v12' }) // Infer a matching minor
120
135
  await migratePnpmSettings({ targetVersion: '12.4.0' }) // Target this exact release
121
136
  ```
122
137
 
138
+ <details>
139
+ <summary>Version inference and supported version formats</summary>
140
+
123
141
  Version ranges are not accepted by `targetVersion`. Project ranges, conflicting
124
142
  `devEngines` entries, prereleases, and declarations without a confirmed matching
125
143
  version retain the base major schema. Build metadata on exact stable versions
126
144
  is accepted. Later stable minors automatically inherit known capabilities;
127
145
  there are no minor-specific compatibility options.
128
146
 
147
+ </details>
148
+
149
+ <details>
150
+ <summary>Version-specific settings and requirements</summary>
151
+
129
152
  For pnpm 12.4.0 and later stable v12 releases, the migrator additionally accepts
130
153
  `trustPolicyExcludePrune`, `python`, `cargo`, `pipelines`, `pipelineBase`, and
131
154
  `packageConfigs`, plus task fields `outputs`, `inputs`, `env`, `cache`, and
132
155
  `cargoTargetDir`. On older or unconfirmed targets, a `tasks` object containing
133
156
  these fields stays in its source as a whole.
134
157
 
158
+ For pnpm 12.5.0 and later stable v12 releases, the migrator also accepts
159
+ `concurrencyGroups`, task `concurrencyGroup`, platform lists in
160
+ `supportedArchitectures`, Python `versions` / `overrides` / `constraints`, and
161
+ `registries` declarations with `ecosystem`. Python registry `packages` routes
162
+ require 12.5.1. Unsupported nested settings stay in their source as a whole.
163
+ The legacy OS/CPU/libc architecture mapping continues to work.
164
+
165
+ pnpm 12.5 removes `python.indexUrl` and `cargo.indexUrl`. Settings containing
166
+ these fields are retained with an incompatibility warning; existing workspaces
167
+ containing them fail validation before any files are written. Replace them with
168
+ URL-keyed `registries` entries using `ecosystem: pypi` or `ecosystem: cargo`.
169
+ The registry prefix `pkg` is reserved from 12.5 onward. Tool download mirrors
170
+ under `tools` belong in global `config.yaml` or `PNPM_CONFIG_TOOLS` and are
171
+ never migrated into the project workspace.
172
+
173
+ On the v11 line, `trustPolicyExcludePrune` requires a confirmed stable version
174
+ from 11.27.0 onward; v12 support still starts at 12.4.0.
175
+
176
+ For pnpm 12.6.0 and later stable v12 releases, the migrator accepts `autoDedupe`,
177
+ `saveTypes`, `tagVersionPrefix`, and signed 32-bit `tasks.*.priority` values.
178
+ `progress` and `loglevel` also require 12.6.0 for v12 targets, when pnpm first
179
+ consumes them from workspace configuration; their v11 support is unchanged.
180
+ Invalid values and fields unsupported by the target remain in their sources.
181
+ The global-only `macosBackup` setting is preserved with a project-refused warning.
182
+
183
+ </details>
184
+
185
+ <details>
186
+ <summary>Automated v10 to v11 conversions</summary>
187
+
135
188
  Automated v10 to v11 conversions include:
136
189
 
137
190
  - `managePackageManagerVersions`, `packageManagerStrict`, and
@@ -146,11 +199,19 @@ Automated v10 to v11 conversions include:
146
199
  - removal of `ignoreDepScripts` and `ignorePatchFailures`, which have no v11
147
200
  equivalent
148
201
 
202
+ </details>
203
+
204
+ <details>
205
+ <summary>Migration rules, limitations, and compatibility coverage</summary>
206
+
149
207
  Notes:
150
208
 
151
209
  - `.npmrc` migration is aligned with the target pnpm workspace schema. Unknown
152
210
  keys and settings supported only by a different pnpm version stay in `.npmrc`
153
211
  with a warning.
212
+ - Scalar list settings such as `public-hoist-pattern=*eslint*` become YAML
213
+ arrays (`publicHoistPattern: ['*eslint*']`). Existing arrays and patterns
214
+ containing commas are preserved without splitting their values.
154
215
  - In `v11` and `v12`, auth/registry keys and project-refused machine settings
155
216
  such as `globalDir`, `stateDir`, `configDir`, and `scope` stay in `.npmrc`.
156
217
  - Registry declarations containing embedded credentials or dynamic `${...}`
@@ -177,6 +238,8 @@ Notes:
177
238
  resolutions remain in their original source.
178
239
  Unrecognized, refused, incompatible, or otherwise unsupported
179
240
  `package.json#pnpm` child keys remain in `package.json`.
241
+ INI sections in `.npmrc` are retained conservatively; their child names are
242
+ never treated as root keys during cleanup.
180
243
  - Runtime migration writes `devEngines.runtime` before removing a workspace
181
244
  runtime declaration. A failed write preserves source settings for retry.
182
245
  If an existing runtime declaration conflicts with a workspace runtime, migration
@@ -191,12 +254,19 @@ Notes:
191
254
  - The migrator does not update the `packageManager` version, CI environment variables,
192
255
  shell setup, or pnpm commands in scripts. When `packageManager` still pins pnpm 10,
193
256
  pass `--compatibility v11` explicitly and update the pin separately.
194
- - Compatibility checks cover pnpm 11.26.0, 12.3.4, and 12.4.0, retaining
195
- 11.25.0 and 12.2.1 regressions. As audited on 2026-09-10, 12.3.4 is npm
196
- `latest` and 12.4.0 is on `next-12`; the project stays pinned to 12.3.4. Its removed `pnpm install --resolution-only` CLI
257
+ - Compatibility checks cover pnpm 11.27.1 and 12.6.0, retaining 11.25.0,
258
+ 11.26.0, 12.2.1, 12.3.4, 12.4.0, 12.4.2, 12.5.0, and 12.5.1 regressions.
259
+ As [audited on 2026-09-24](docs/research/pnpm-settings-bump-2026-09-24.md),
260
+ npm `latest` and the highest stable release are 12.6.0; `latest-11` is 11.27.1.
261
+ The project is pinned to 12.6.0. The removed `pnpm install --resolution-only` CLI
197
262
  flag is outside this settings migrator's scope; replace it with
198
263
  `pnpm peers check` in scripts before upgrading.
199
264
 
265
+ </details>
266
+
267
+ <details>
268
+ <summary>Target version migration example</summary>
269
+
200
270
  For example, `--target-version 12.4.0` migrates this legacy configuration:
201
271
 
202
272
  ```json
@@ -215,6 +285,8 @@ With `--target-version 12.3.4`, these settings remain in `package.json` with an
215
285
  incompatibility warning. See the [version audit](docs/research/pnpm-recent-settings-audit-2026-09-10.md)
216
286
  for the upstream release and schema references.
217
287
 
288
+ </details>
289
+
218
290
  ### `--replace-deprecated`
219
291
 
220
292
  - **Type**: `boolean`
@@ -222,6 +294,9 @@ for the upstream release and schema references.
222
294
 
223
295
  Force replacing deprecated pnpm settings with new keys and remove old keys during migration.
224
296
 
297
+ <details>
298
+ <summary>Deprecated setting conversion examples</summary>
299
+
225
300
  Example conversions:
226
301
 
227
302
  - `allowNonAppliedPatches` -> `allowUnusedPatches`
@@ -234,6 +309,8 @@ Example conversions:
234
309
  `sideEffectsCache`
235
310
  - non-conflicting `namedRegistries` aliases -> URL-keyed `registries`
236
311
 
312
+ </details>
313
+
237
314
  ### `--strategy`
238
315
 
239
316
  - **Type**: `'discard' | 'merge' | 'overwrite'`
@@ -245,6 +322,10 @@ Strategy to handle conflicts when merging settings with existing `pnpm-workspace
245
322
  - `merge`: Deep merge with array deduplication. Arrays are combined and deduplicated, objects are recursively merged, primitives keep existing values.
246
323
  - `overwrite`: Use incoming values, only keep existing keys not present in incoming settings. For nested objects, merges keys from both.
247
324
 
325
+ `packageConfigs` matcher arrays preserve order and repeated entries because the
326
+ last matching entry wins. With `merge`, incoming matchers follow existing ones;
327
+ an overlapping end/start sequence is reused to keep repeated migrations stable.
328
+
248
329
  ### `--no-yarn-resolutions`
249
330
 
250
331
  - **Type**: `boolean`
@@ -252,6 +333,9 @@ Strategy to handle conflicts when merging settings with existing `pnpm-workspace
252
333
 
253
334
  Disable migrating `resolutions` field in `package.json`.
254
335
 
336
+ <details>
337
+ <summary>Yarn selector translation and warnings</summary>
338
+
255
339
  By default, plain package names are copied to pnpm overrides and global Yarn
256
340
  selectors are translated: `**/foo` becomes `foo`, and `**/@scope/foo` becomes
257
341
  `@scope/foo`. Path-specific selectors such as `parent/child` and
@@ -268,6 +352,8 @@ WARN Kept Yarn resolution "parent/**/child" in package.json: its selector cannot
268
352
  ℹ No changes needed.
269
353
  ```
270
354
 
355
+ </details>
356
+
271
357
  ### `--no-show-changes`
272
358
 
273
359
  - **Type**: `boolean`
@@ -301,6 +387,9 @@ Disable adding newlines between each root keys.
301
387
 
302
388
  This document demonstrates how different merge strategies work when migrating pnpm settings.
303
389
 
390
+ <details>
391
+ <summary>Compare merge strategies with configuration examples</summary>
392
+
304
393
  ### Scenario
305
394
 
306
395
  Existing `pnpm-workspace.yaml`:
@@ -435,6 +524,8 @@ peerDependencyRules:
435
524
  - vue-router # Arrays merged and deduplicated
436
525
  ```
437
526
 
527
+ </details>
528
+
438
529
  ## Context
439
530
 
440
531
  - [Moving settings to pnpm-workspace.yaml](https://github.com/orgs/pnpm/discussions/9037)