@pnpm/engine.pm.commands 1101.1.5 → 1101.1.7

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.
@@ -295,12 +295,23 @@ export function linkExePlatformBinary(installDir) {
295
295
  const dest = path.join(exePkgDir, executable);
296
296
  forceLink(src, dest);
297
297
  if (platform === 'win32') {
298
+ // Aliases (pn / pnpx / pnx) need to be .exe hardlinks of the SEA binary,
299
+ // not the .cmd wrappers we ship in the tarball. cmd-shim's Bash shim for
300
+ // a .cmd target wraps it in `exec cmd /C ...`, and MSYS2 / Git Bash
301
+ // mangles `/C` into a Windows path — cmd.exe then falls into interactive
302
+ // mode and prints its banner instead of running the alias. .exe sources
303
+ // sidestep cmd-shim's wrapper. The SEA binary detects which name it was
304
+ // launched as via process.execPath and prepends `dlx` for pnpx / pnx.
305
+ // See https://github.com/pnpm/pnpm/issues/11486.
306
+ for (const alias of ['pn', 'pnpx', 'pnx']) {
307
+ forceLink(src, path.join(exePkgDir, `${alias}.exe`));
308
+ }
298
309
  const exePkgJsonPath = path.join(exePkgDir, 'package.json');
299
310
  const exePkg = JSON.parse(fs.readFileSync(exePkgJsonPath, 'utf8'));
300
311
  exePkg.bin.pnpm = 'pnpm.exe';
301
- exePkg.bin.pn = 'pn.cmd';
302
- exePkg.bin.pnpx = 'pnpx.cmd';
303
- exePkg.bin.pnx = 'pnx.cmd';
312
+ exePkg.bin.pn = 'pn.exe';
313
+ exePkg.bin.pnpx = 'pnpx.exe';
314
+ exePkg.bin.pnx = 'pnx.exe';
304
315
  fs.writeFileSync(exePkgJsonPath, JSON.stringify(exePkg, null, 2));
305
316
  }
306
317
  }
@@ -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.5",
3
+ "version": "1101.1.7",
4
4
  "description": "pnpm commands for self-updating and setting up pnpm",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -26,46 +26,46 @@
26
26
  "dependencies": {
27
27
  "@pnpm/os.env.path-extender": "^3.0.0",
28
28
  "cross-spawn": "^7.0.6",
29
- "detect-libc": "^2.0.3",
29
+ "detect-libc": "^2.1.2",
30
30
  "path-name": "^1.0.0",
31
31
  "ramda": "npm:@pnpm/ramda@0.28.1",
32
32
  "render-help": "^2.0.0",
33
- "semver": "^7.7.2",
33
+ "semver": "^7.7.4",
34
34
  "symlink-dir": "^10.0.1",
35
- "@pnpm/building.policy": "1100.0.2",
36
35
  "@pnpm/bins.linker": "1100.0.3",
37
36
  "@pnpm/cli.meta": "1100.0.2",
37
+ "@pnpm/building.policy": "1100.0.3",
38
38
  "@pnpm/cli.utils": "1101.0.2",
39
- "@pnpm/deps.graph-hasher": "1100.1.2",
39
+ "@pnpm/config.reader": "1101.2.1",
40
+ "@pnpm/deps.graph-hasher": "1100.1.3",
40
41
  "@pnpm/error": "1100.0.0",
41
- "@pnpm/global.commands": "1100.0.10",
42
+ "@pnpm/global.commands": "1100.0.12",
42
43
  "@pnpm/global.packages": "1100.0.2",
43
- "@pnpm/config.reader": "1101.1.4",
44
- "@pnpm/installing.client": "1100.0.8",
45
- "@pnpm/installing.deps-restorer": "1101.0.4",
46
- "@pnpm/lockfile.fs": "1100.0.4",
47
- "@pnpm/installing.env-installer": "1101.0.3",
48
- "@pnpm/lockfile.types": "1100.0.3",
49
- "@pnpm/resolving.npm-resolver": "1101.0.1",
50
- "@pnpm/store.connection-manager": "1100.0.9",
51
- "@pnpm/store.controller": "1101.0.2",
52
- "@pnpm/workspace.project-manifest-reader": "1100.0.3",
44
+ "@pnpm/installing.client": "1100.0.10",
45
+ "@pnpm/installing.deps-restorer": "1101.0.6",
46
+ "@pnpm/installing.env-installer": "1101.0.5",
47
+ "@pnpm/lockfile.fs": "1100.0.5",
48
+ "@pnpm/lockfile.types": "1100.0.4",
49
+ "@pnpm/resolving.npm-resolver": "1101.0.2",
53
50
  "@pnpm/shell.path": "1100.0.1",
51
+ "@pnpm/store.connection-manager": "1100.0.11",
52
+ "@pnpm/store.controller": "1101.0.3",
53
+ "@pnpm/workspace.project-manifest-reader": "1100.0.3",
54
54
  "@pnpm/types": "1101.0.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "@pnpm/logger": ">=1001.0.0 <1002.0.0"
57
+ "@pnpm/logger": "^1001.0.1"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@jest/globals": "30.3.0",
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
64
  "@pnpm/constants": "1100.0.0",
65
+ "@pnpm/engine.pm.commands": "1101.1.7",
66
66
  "@pnpm/error": "1100.0.0",
67
67
  "@pnpm/logger": "1100.0.0",
68
- "@pnpm/prepare": "1100.0.4",
68
+ "@pnpm/prepare": "1100.0.5",
69
69
  "@pnpm/testing.mock-agent": "1100.0.2"
70
70
  },
71
71
  "engines": {