pnpm-settings-migrator 0.10.0 → 0.11.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 +106 -17
- package/dist/cli.mjs +2098 -1530
- package/dist/index.d.mts +289 -84
- package/dist/index.mjs +1911 -1350
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -85,19 +85,52 @@ Sort keys when write `pnpm-workspace.yaml`.
|
|
|
85
85
|
- **Type**: `'auto' | 'v10' | 'v11' | 'v12'`
|
|
86
86
|
- **Default**: `'auto'`
|
|
87
87
|
|
|
88
|
-
Compatibility
|
|
88
|
+
Compatibility major for migrated settings:
|
|
89
89
|
|
|
90
|
-
- `auto`: infer from `packageManager
|
|
91
|
-
(`pnpm@12+` => `v12`, `pnpm@11` => `v11`,
|
|
92
|
-
|
|
93
|
-
- `
|
|
94
|
-
|
|
95
|
-
- `v12`: use the
|
|
96
|
-
|
|
90
|
+
- `auto`: infer from `targetVersion`, `packageManager`, or
|
|
91
|
+
`devEngines.packageManager` (`pnpm@12+` => `v12`, `pnpm@11` => `v11`,
|
|
92
|
+
otherwise `v10`).
|
|
93
|
+
- `v10`: keep legacy settings and migrate schema-aligned pnpm config keys from `.npmrc`.
|
|
94
|
+
- `v11`: normalize to v11-compatible settings (`allowBuilds`, `allowUnusedPatches`, etc.).
|
|
95
|
+
- `v12`: use the v12 schema, including `globalShims`, and enable additional
|
|
96
|
+
fields according to the confirmed target version.
|
|
97
|
+
|
|
98
|
+
An explicit major still uses a matching version from the project declarations.
|
|
99
|
+
For example, `--compatibility v12` with `packageManager: "pnpm@12.4.0"` enables
|
|
100
|
+
12.4 capabilities. A pin to another major supplies no minor capabilities for
|
|
101
|
+
the selected major; use `--target-version` to state the intended release.
|
|
97
102
|
|
|
98
103
|
In `v11` and `v12` modes, the migrator validates existing workspace keys,
|
|
99
|
-
filters incoming settings against the
|
|
100
|
-
normalization to legacy files and `pnpm-workspace.yaml`.
|
|
104
|
+
filters incoming settings against the resolved capabilities, and applies
|
|
105
|
+
required normalization to legacy files and `pnpm-workspace.yaml`.
|
|
106
|
+
|
|
107
|
+
### `--target-version`
|
|
108
|
+
|
|
109
|
+
- **Type**: `string` (an exact version such as `'12.4.0'`)
|
|
110
|
+
- **Default**: inferred from the project when possible
|
|
111
|
+
|
|
112
|
+
Override the target pnpm version without changing the project's package manager
|
|
113
|
+
pin. Resolution order is explicit `targetVersion`, then `packageManager`, then
|
|
114
|
+
`devEngines.packageManager`. An explicit `compatibility` major must agree with
|
|
115
|
+
`targetVersion`; conflicts fail before any files are written.
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
await migratePnpmSettings() // Infer the target from the project
|
|
119
|
+
await migratePnpmSettings({ compatibility: 'v12' }) // Infer a matching minor
|
|
120
|
+
await migratePnpmSettings({ targetVersion: '12.4.0' }) // Target this exact release
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Version ranges are not accepted by `targetVersion`. Project ranges, conflicting
|
|
124
|
+
`devEngines` entries, prereleases, and declarations without a confirmed matching
|
|
125
|
+
version retain the base major schema. Build metadata on exact stable versions
|
|
126
|
+
is accepted. Later stable minors automatically inherit known capabilities;
|
|
127
|
+
there are no minor-specific compatibility options.
|
|
128
|
+
|
|
129
|
+
For pnpm 12.4.0 and later stable v12 releases, the migrator additionally accepts
|
|
130
|
+
`trustPolicyExcludePrune`, `python`, `cargo`, `pipelines`, `pipelineBase`, and
|
|
131
|
+
`packageConfigs`, plus task fields `outputs`, `inputs`, `env`, `cache`, and
|
|
132
|
+
`cargoTargetDir`. On older or unconfirmed targets, a `tasks` object containing
|
|
133
|
+
these fields stays in its source as a whole.
|
|
101
134
|
|
|
102
135
|
Automated v10 to v11 conversions include:
|
|
103
136
|
|
|
@@ -116,20 +149,41 @@ Automated v10 to v11 conversions include:
|
|
|
116
149
|
Notes:
|
|
117
150
|
|
|
118
151
|
- `.npmrc` migration is aligned with the target pnpm workspace schema. Unknown
|
|
119
|
-
keys and settings supported only by a different pnpm
|
|
152
|
+
keys and settings supported only by a different pnpm version stay in `.npmrc`
|
|
120
153
|
with a warning.
|
|
121
154
|
- In `v11` and `v12`, auth/registry keys and project-refused machine settings
|
|
122
155
|
such as `globalDir`, `stateDir`, `configDir`, and `scope` stay in `.npmrc`.
|
|
123
156
|
- Registry declarations containing embedded credentials or dynamic `${...}`
|
|
124
157
|
URLs stay in their source with a warning.
|
|
125
|
-
-
|
|
126
|
-
`
|
|
127
|
-
|
|
128
|
-
|
|
158
|
+
- Dynamic `${...}` values in `httpProxy`, `httpsProxy`, `noProxy`, `proxy`, and
|
|
159
|
+
`noproxy` stay in their source for every target. Project YAML does not expand
|
|
160
|
+
these placeholders; configure them globally in trusted configuration or use
|
|
161
|
+
environment variables. Existing dynamic proxy settings in YAML block migration.
|
|
162
|
+
The migrator never expands and writes these values.
|
|
163
|
+
- pnpm v11 and confirmed stable v12 targets from 12.4.0 accept `packageConfigs`
|
|
164
|
+
as package-name maps or matcher arrays, with `hoist`, `modulesDir`,
|
|
165
|
+
`overrides`, `saveExact`, and `savePrefix`. Supported subproject `.npmrc`
|
|
166
|
+
fields are moved there by package name. pnpm 12.0–12.3 does not support
|
|
167
|
+
`packageConfigs`.
|
|
168
|
+
- For v12 targets from 12.4.0, migrating `packageConfigs` or subproject settings
|
|
169
|
+
requires `sharedWorkspaceLockfile: false` in the merged workspace. Otherwise
|
|
170
|
+
source settings remain with a warning; existing `packageConfigs` blocks
|
|
171
|
+
migration until the effective lockfile mode is compatible. This restriction
|
|
172
|
+
does not apply to v11. The migrator does not change this mode automatically.
|
|
129
173
|
- Cleanup removes only source keys represented in the final workspace after
|
|
130
174
|
applying the selected merge strategy.
|
|
175
|
+
Each source is checked against its own values, including deprecated-key
|
|
176
|
+
replacements. Conflicting values in `.npmrc`, `package.json#pnpm`, or Yarn
|
|
177
|
+
resolutions remain in their original source.
|
|
131
178
|
Unrecognized, refused, incompatible, or otherwise unsupported
|
|
132
179
|
`package.json#pnpm` child keys remain in `package.json`.
|
|
180
|
+
- Runtime migration writes `devEngines.runtime` before removing a workspace
|
|
181
|
+
runtime declaration. A failed write preserves source settings for retry.
|
|
182
|
+
If an existing runtime declaration conflicts with a workspace runtime, migration
|
|
183
|
+
stops before writing any files. An identical Node.js declaration is reused.
|
|
184
|
+
- YAML aliases remain when their anchors are unchanged and precede them.
|
|
185
|
+
If replacement, removal, or sorting would invalidate an alias, its original
|
|
186
|
+
value is written explicitly so unrelated settings keep their values.
|
|
133
187
|
- If no auth/registry lines remain after a v11 or v12 migration, the empty
|
|
134
188
|
`.npmrc` is removed.
|
|
135
189
|
- Values moved from `auditConfig.ignoreCves` still contain CVE IDs. Replace them
|
|
@@ -137,11 +191,30 @@ Notes:
|
|
|
137
191
|
- The migrator does not update the `packageManager` version, CI environment variables,
|
|
138
192
|
shell setup, or pnpm commands in scripts. When `packageManager` still pins pnpm 10,
|
|
139
193
|
pass `--compatibility v11` explicitly and update the pin separately.
|
|
140
|
-
-
|
|
141
|
-
|
|
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
|
|
142
197
|
flag is outside this settings migrator's scope; replace it with
|
|
143
198
|
`pnpm peers check` in scripts before upgrading.
|
|
144
199
|
|
|
200
|
+
For example, `--target-version 12.4.0` migrates this legacy configuration:
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{ "pnpm": { "pipelines": { "ci": ["build", "test"] }, "pipelineBase": "main" } }
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
into `pnpm-workspace.yaml` and removes the applied `pnpm` keys:
|
|
207
|
+
|
|
208
|
+
```yaml
|
|
209
|
+
pipelines:
|
|
210
|
+
ci: [build, test]
|
|
211
|
+
pipelineBase: main
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
With `--target-version 12.3.4`, these settings remain in `package.json` with an
|
|
215
|
+
incompatibility warning. See the [version audit](docs/research/pnpm-recent-settings-audit-2026-09-10.md)
|
|
216
|
+
for the upstream release and schema references.
|
|
217
|
+
|
|
145
218
|
### `--replace-deprecated`
|
|
146
219
|
|
|
147
220
|
- **Type**: `boolean`
|
|
@@ -179,6 +252,22 @@ Strategy to handle conflicts when merging settings with existing `pnpm-workspace
|
|
|
179
252
|
|
|
180
253
|
Disable migrating `resolutions` field in `package.json`.
|
|
181
254
|
|
|
255
|
+
By default, plain package names are copied to pnpm overrides and global Yarn
|
|
256
|
+
selectors are translated: `**/foo` becomes `foo`, and `**/@scope/foo` becomes
|
|
257
|
+
`@scope/foo`. Path-specific selectors such as `parent/child` and
|
|
258
|
+
`parent/**/child` remain in `resolutions` with a warning. Conflicting selectors
|
|
259
|
+
that translate to the same pnpm key also remain for manual resolution.
|
|
260
|
+
Only individual resolutions whose values reach the final workspace are removed.
|
|
261
|
+
|
|
262
|
+
For example, an unsupported selector is now reported and retained instead of
|
|
263
|
+
being copied into an override that prevents pnpm from installing:
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
WARN Kept Yarn resolution "parent/**/child" in package.json: its selector cannot be translated safely to pnpm overrides.
|
|
267
|
+
|
|
268
|
+
ℹ No changes needed.
|
|
269
|
+
```
|
|
270
|
+
|
|
182
271
|
### `--no-show-changes`
|
|
183
272
|
|
|
184
273
|
- **Type**: `boolean`
|