pnpm-settings-migrator 0.8.1 → 0.10.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 +71 -19
- package/dist/cli.mjs +1348 -378
- package/dist/index.d.mts +112 -27
- package/dist/index.mjs +1127 -361
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -19,7 +19,8 @@ After migration, the CLI reports how many root settings changed and shows a
|
|
|
19
19
|
GitHub-style YAML diff. Removed lines are red and added lines are green:
|
|
20
20
|
|
|
21
21
|
```text
|
|
22
|
-
|
|
22
|
+
✔ 2 settings changed
|
|
23
|
+
|
|
23
24
|
packages:
|
|
24
25
|
- packages/*
|
|
25
26
|
+ - apps/*
|
|
@@ -29,6 +30,40 @@ GitHub-style YAML diff. Removed lines are red and added lines are green:
|
|
|
29
30
|
+ bar: 2.0.0
|
|
30
31
|
```
|
|
31
32
|
|
|
33
|
+
When nothing needs updating, the only output is:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
ℹ No changes needed.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The CLI no longer prints a startup banner, missing optional files, a zero-change
|
|
40
|
+
count, or a duplicate completion message. Use `--version` to see the version.
|
|
41
|
+
Warnings are reserved for settings requiring attention. Information blocks have
|
|
42
|
+
one blank line between them, with no extra blank lines at the start or end.
|
|
43
|
+
|
|
44
|
+
Other outcomes are reported according to the files actually changed:
|
|
45
|
+
|
|
46
|
+
- No configuration files: `ℹ No configuration files found.`
|
|
47
|
+
- Source cleanup with no settings diff: `✔ Migration completed. Source settings cleaned up.`
|
|
48
|
+
- Runtime migration with no settings diff: `✔ Migration completed. Node.js runtime updated in package.json.`
|
|
49
|
+
- File formatting changes with no settings diff: `✔ Migration completed. Configuration files updated.`
|
|
50
|
+
- Failure: one error report and exit code `1`.
|
|
51
|
+
|
|
52
|
+
## Library usage
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { migratePnpmSettings } from 'pnpm-settings-migrator'
|
|
56
|
+
|
|
57
|
+
const result = await migratePnpmSettings({ cwd: '/path/to/workspace' })
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Library calls now return a `MigrationResult` and do not print logs. The result
|
|
61
|
+
contains `settingsChanges` (before/after root workspace settings), `changedFiles`
|
|
62
|
+
(absolute paths, including created or removed files), `sourceSettingsCleaned`,
|
|
63
|
+
`packageJsonRuntimeChanged`, `hasConfigurationFiles`, and `warnings`. Errors are
|
|
64
|
+
thrown to the caller. Consumers that relied on console output should render the
|
|
65
|
+
returned changes and warnings themselves.
|
|
66
|
+
|
|
32
67
|
## CLI Options
|
|
33
68
|
|
|
34
69
|
### `--cwd`
|
|
@@ -56,13 +91,13 @@ Compatibility target for migrated settings:
|
|
|
56
91
|
(`pnpm@12+` => `v12`, `pnpm@11` => `v11`, otherwise `v10`)
|
|
57
92
|
- `v10`: keep legacy settings as-is and migrate schema-aligned pnpm config keys from `.npmrc`
|
|
58
93
|
- `v11`: normalize to v11-compatible settings (`allowBuilds`, `allowUnusedPatches`, etc.)
|
|
59
|
-
and migrate
|
|
60
|
-
- `v12`: use the
|
|
61
|
-
|
|
94
|
+
and migrate recognized project settings from `.npmrc` to `pnpm-workspace.yaml`
|
|
95
|
+
- `v12`: use the shared v11 schema plus the v12 delta, including
|
|
96
|
+
`globalShims`, while rejecting v11-only workspace settings.
|
|
62
97
|
|
|
63
|
-
In `v11` and `v12` modes,
|
|
64
|
-
|
|
65
|
-
`pnpm-workspace.yaml`.
|
|
98
|
+
In `v11` and `v12` modes, the migrator validates existing workspace keys,
|
|
99
|
+
filters incoming settings against the selected schema, and applies required
|
|
100
|
+
normalization to legacy files and `pnpm-workspace.yaml`.
|
|
66
101
|
|
|
67
102
|
Automated v10 to v11 conversions include:
|
|
68
103
|
|
|
@@ -80,12 +115,21 @@ Automated v10 to v11 conversions include:
|
|
|
80
115
|
|
|
81
116
|
Notes:
|
|
82
117
|
|
|
83
|
-
- `.npmrc` migration is aligned with pnpm workspace
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
-
|
|
118
|
+
- `.npmrc` migration is aligned with the target pnpm workspace schema. Unknown
|
|
119
|
+
keys and settings supported only by a different pnpm major stay in `.npmrc`
|
|
120
|
+
with a warning.
|
|
121
|
+
- In `v11` and `v12`, auth/registry keys and project-refused machine settings
|
|
122
|
+
such as `globalDir`, `stateDir`, `configDir`, and `scope` stay in `.npmrc`.
|
|
123
|
+
- Registry declarations containing embedded credentials or dynamic `${...}`
|
|
124
|
+
URLs stay in their source with a warning.
|
|
125
|
+
- In v11 workspaces, supported subproject `.npmrc` fields are moved to
|
|
126
|
+
`packageConfigs` by package name. pnpm v11 accepts `hoist`, `modulesDir`,
|
|
127
|
+
`overrides`, `saveExact`, and `savePrefix` there. pnpm v12 does not support
|
|
128
|
+
`packageConfigs`, so subproject settings are retained with a warning.
|
|
129
|
+
- Cleanup removes only source keys represented in the final workspace after
|
|
130
|
+
applying the selected merge strategy.
|
|
131
|
+
Unrecognized, refused, incompatible, or otherwise unsupported
|
|
132
|
+
`package.json#pnpm` child keys remain in `package.json`.
|
|
89
133
|
- If no auth/registry lines remain after a v11 or v12 migration, the empty
|
|
90
134
|
`.npmrc` is removed.
|
|
91
135
|
- Values moved from `auditConfig.ignoreCves` still contain CVE IDs. Replace them
|
|
@@ -93,9 +137,10 @@ Notes:
|
|
|
93
137
|
- The migrator does not update the `packageManager` version, CI environment variables,
|
|
94
138
|
shell setup, or pnpm commands in scripts. When `packageManager` still pins pnpm 10,
|
|
95
139
|
pass `--compatibility v11` explicitly and update the pin separately.
|
|
96
|
-
- pnpm 12 is
|
|
97
|
-
`pnpm install --resolution-only` CLI
|
|
98
|
-
|
|
140
|
+
- pnpm 12 is stable; this project verifies migrated output against pnpm 12.2.1
|
|
141
|
+
as well as pnpm 11.25.0. Its removed `pnpm install --resolution-only` CLI
|
|
142
|
+
flag is outside this settings migrator's scope; replace it with
|
|
143
|
+
`pnpm peers check` in scripts before upgrading.
|
|
99
144
|
|
|
100
145
|
### `--replace-deprecated`
|
|
101
146
|
|
|
@@ -108,6 +153,13 @@ Example conversions:
|
|
|
108
153
|
|
|
109
154
|
- `allowNonAppliedPatches` -> `allowUnusedPatches`
|
|
110
155
|
- `onlyBuiltDependencies` / `ignoredBuiltDependencies` / `neverBuiltDependencies` -> `allowBuilds`
|
|
156
|
+
- `auditLevel` / `auditConfig` -> `audit`
|
|
157
|
+
- `updateConfig` -> `update`
|
|
158
|
+
- `cleanupUnusedCatalogs` -> `catalogPrune`
|
|
159
|
+
- `enableGlobalVirtualStore` -> `virtualStoreType`
|
|
160
|
+
- `sideEffectsCacheReadonly` / `remoteSideEffectsCache` -> structured
|
|
161
|
+
`sideEffectsCache`
|
|
162
|
+
- non-conflicting `namedRegistries` aliases -> URL-keyed `registries`
|
|
111
163
|
|
|
112
164
|
### `--strategy`
|
|
113
165
|
|
|
@@ -132,8 +184,8 @@ Disable migrating `resolutions` field in `package.json`.
|
|
|
132
184
|
- **Type**: `boolean`
|
|
133
185
|
- **Default behavior**: `showChanges=true` (use this flag to disable)
|
|
134
186
|
|
|
135
|
-
|
|
136
|
-
|
|
187
|
+
Hide the settings diff while keeping the outcome summary and warnings. This is a
|
|
188
|
+
CLI display preference; library results always include settings changes.
|
|
137
189
|
|
|
138
190
|
### `--no-clean-npmrc`
|
|
139
191
|
|
|
@@ -147,7 +199,7 @@ Disable removing pnpm settings in `.npmrc` file.
|
|
|
147
199
|
- **Type**: `boolean`
|
|
148
200
|
- **Default behavior**: `cleanPackageJson=true` (use this flag to disable)
|
|
149
201
|
|
|
150
|
-
Disable removing `pnpm` field in `package.json`.
|
|
202
|
+
Disable removing migrated child keys from the `pnpm` field in `package.json`.
|
|
151
203
|
|
|
152
204
|
### `--no-newline-between`
|
|
153
205
|
|