@pnpm/engine.pm.commands 1101.1.5 → 1101.1.6
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/lib/self-updater/selfUpdate.js +25 -0
- package/package.json +17 -17
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import { linkBins } from '@pnpm/bins.linker';
|
|
3
4
|
import { isExecutedByCorepack, packageManager } from '@pnpm/cli.meta';
|
|
@@ -179,11 +180,35 @@ export async function handler(opts, params) {
|
|
|
179
180
|
});
|
|
180
181
|
// Link bins to pnpmHomeDir/bin so the updated pnpm is the active global binary
|
|
181
182
|
await linkBins(path.join(baseDir, 'node_modules'), path.join(opts.pnpmHomeDir, 'bin'), { warn: globalWarn });
|
|
183
|
+
// pnpm v10 setup linked bins directly into pnpmHomeDir and added that
|
|
184
|
+
// directory to PATH (instead of pnpmHomeDir/bin as v11 does). When a v10
|
|
185
|
+
// user upgrades to v11 the legacy shims at pnpmHomeDir keep pointing into
|
|
186
|
+
// the old `.tools/<version>` install — so PATH still resolves `pnpm` to the
|
|
187
|
+
// pre-update version. Detect that case and refresh the legacy shims so the
|
|
188
|
+
// upgrade actually takes effect, then warn the user to run `pnpm setup`
|
|
189
|
+
// for a clean migration to the v11 layout. See pnpm/pnpm#11464.
|
|
190
|
+
if (hasLegacyHomeDirShim(opts.pnpmHomeDir)) {
|
|
191
|
+
await linkBins(path.join(baseDir, 'node_modules'), opts.pnpmHomeDir, { warn: globalWarn });
|
|
192
|
+
globalWarn('Detected a pnpm v10 installation layout at PNPM_HOME. The pnpm shims ' +
|
|
193
|
+
'at PNPM_HOME have been refreshed so the new version is active, but ' +
|
|
194
|
+
'pnpm v11 expects bins in PNPM_HOME/bin. Run "pnpm setup" to migrate ' +
|
|
195
|
+
'your PATH to the v11 layout.');
|
|
196
|
+
}
|
|
182
197
|
if (alreadyExisted) {
|
|
183
198
|
return `The ${bareSpecifier} version, v${resolution.manifest.version}, is already present on the system. It was activated by linking it from ${baseDir}.`;
|
|
184
199
|
}
|
|
185
200
|
return `Successfully updated pnpm to v${resolution.manifest.version}`;
|
|
186
201
|
}
|
|
202
|
+
// A fresh v11 setup never writes a `pnpm` shim at pnpmHomeDir itself — only
|
|
203
|
+
// under pnpmHomeDir/bin. The presence of a `pnpm` (or `pnpm.cmd`) file
|
|
204
|
+
// directly at pnpmHomeDir is therefore a reliable v10-layout marker.
|
|
205
|
+
function hasLegacyHomeDirShim(pnpmHomeDir) {
|
|
206
|
+
for (const name of ['pnpm', 'pnpm.cmd']) {
|
|
207
|
+
if (fs.existsSync(path.join(pnpmHomeDir, name)))
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
187
212
|
/**
|
|
188
213
|
* Returns the updated version constraint for devEngines.packageManager.
|
|
189
214
|
* - Exact versions and simple ranges (^, ~) are updated to the new version,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/engine.pm.commands",
|
|
3
|
-
"version": "1101.1.
|
|
3
|
+
"version": "1101.1.6",
|
|
4
4
|
"description": "pnpm commands for self-updating and setting up pnpm",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -32,26 +32,26 @@
|
|
|
32
32
|
"render-help": "^2.0.0",
|
|
33
33
|
"semver": "^7.7.2",
|
|
34
34
|
"symlink-dir": "^10.0.1",
|
|
35
|
-
"@pnpm/building.policy": "1100.0.
|
|
36
|
-
"@pnpm/
|
|
37
|
-
"@pnpm/cli.meta": "1100.0.2",
|
|
38
|
-
"@pnpm/cli.utils": "1101.0.2",
|
|
39
|
-
"@pnpm/deps.graph-hasher": "1100.1.2",
|
|
35
|
+
"@pnpm/building.policy": "1100.0.3",
|
|
36
|
+
"@pnpm/config.reader": "1101.2.0",
|
|
40
37
|
"@pnpm/error": "1100.0.0",
|
|
41
|
-
"@pnpm/
|
|
38
|
+
"@pnpm/deps.graph-hasher": "1100.1.2",
|
|
39
|
+
"@pnpm/bins.linker": "1100.0.3",
|
|
42
40
|
"@pnpm/global.packages": "1100.0.2",
|
|
43
|
-
"@pnpm/
|
|
44
|
-
"@pnpm/installing.client": "1100.0.
|
|
45
|
-
"@pnpm/
|
|
41
|
+
"@pnpm/installing.deps-restorer": "1101.0.5",
|
|
42
|
+
"@pnpm/installing.client": "1100.0.9",
|
|
43
|
+
"@pnpm/global.commands": "1100.0.11",
|
|
44
|
+
"@pnpm/installing.env-installer": "1101.0.4",
|
|
46
45
|
"@pnpm/lockfile.fs": "1100.0.4",
|
|
47
|
-
"@pnpm/installing.env-installer": "1101.0.3",
|
|
48
46
|
"@pnpm/lockfile.types": "1100.0.3",
|
|
49
|
-
"@pnpm/
|
|
50
|
-
"@pnpm/store.connection-manager": "1100.0.9",
|
|
47
|
+
"@pnpm/cli.utils": "1101.0.2",
|
|
51
48
|
"@pnpm/store.controller": "1101.0.2",
|
|
49
|
+
"@pnpm/resolving.npm-resolver": "1101.0.1",
|
|
50
|
+
"@pnpm/store.connection-manager": "1100.0.10",
|
|
51
|
+
"@pnpm/cli.meta": "1100.0.2",
|
|
52
|
+
"@pnpm/types": "1101.0.0",
|
|
52
53
|
"@pnpm/workspace.project-manifest-reader": "1100.0.3",
|
|
53
|
-
"@pnpm/shell.path": "1100.0.1"
|
|
54
|
-
"@pnpm/types": "1101.0.0"
|
|
54
|
+
"@pnpm/shell.path": "1100.0.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@pnpm/logger": ">=1001.0.0 <1002.0.0"
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"@types/cross-spawn": "^6.0.6",
|
|
62
62
|
"@types/ramda": "0.31.1",
|
|
63
63
|
"@types/semver": "7.7.1",
|
|
64
|
-
"@pnpm/engine.pm.commands": "1101.1.5",
|
|
65
|
-
"@pnpm/constants": "1100.0.0",
|
|
66
64
|
"@pnpm/error": "1100.0.0",
|
|
65
|
+
"@pnpm/constants": "1100.0.0",
|
|
67
66
|
"@pnpm/logger": "1100.0.0",
|
|
67
|
+
"@pnpm/engine.pm.commands": "1101.1.6",
|
|
68
68
|
"@pnpm/prepare": "1100.0.4",
|
|
69
69
|
"@pnpm/testing.mock-agent": "1100.0.2"
|
|
70
70
|
},
|