@pnpm/global.commands 1100.0.6 → 1100.0.8

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.
@@ -20,5 +20,12 @@ export interface PromptApproveGlobalBuildsOptions {
20
20
  * only on the install directory — otherwise it would treat the global
21
21
  * packages dir as a workspace and discover sibling install directories as
22
22
  * workspace projects.
23
+ *
24
+ * `modulesDir` is left undefined so that downstream consumers compute it
25
+ * relative to `lockfileDir`. Passing an absolute value here would be
26
+ * forwarded as-is to `install.handler`, which treats `modulesDir` as a
27
+ * path relative to `lockfileDir` and joins it again — producing a
28
+ * doubled path on Windows (path.join does not collapse an embedded
29
+ * absolute path).
23
30
  */
24
31
  export declare function promptApproveGlobalBuilds(opts: PromptApproveGlobalBuildsOptions, commands: CommandHandlerMap): Promise<void>;
@@ -1,4 +1,14 @@
1
- import path from 'node:path';
1
+ /**
2
+ * Test-only env var. When set, `promptApproveGlobalBuilds` bypasses the
3
+ * TTY check and forwards `all: true` so the `approve-builds` command
4
+ * skips both its multiselect and confirm prompts. The flow then runs
5
+ * the same install machinery as a real interactive approval, which is
6
+ * what e2e tests need to reproduce regressions in this code path.
7
+ *
8
+ * Not for production use — pnpm has no UI to opt into "approve every
9
+ * pending build" silently, by design.
10
+ */
11
+ const AUTO_APPROVE_FOR_TESTS_ENV = 'PNPM_AUTO_APPROVE_BUILDS_FOR_TESTS';
2
12
  /**
3
13
  * If the previous global install left builds awaiting approval, run the
4
14
  * interactive `approve-builds` flow against the install directory.
@@ -11,9 +21,19 @@ import path from 'node:path';
11
21
  * only on the install directory — otherwise it would treat the global
12
22
  * packages dir as a workspace and discover sibling install directories as
13
23
  * workspace projects.
24
+ *
25
+ * `modulesDir` is left undefined so that downstream consumers compute it
26
+ * relative to `lockfileDir`. Passing an absolute value here would be
27
+ * forwarded as-is to `install.handler`, which treats `modulesDir` as a
28
+ * path relative to `lockfileDir` and joins it again — producing a
29
+ * doubled path on Windows (path.join does not collapse an embedded
30
+ * absolute path).
14
31
  */
15
32
  export async function promptApproveGlobalBuilds(opts, commands) {
16
- if (!opts.ignoredBuilds?.size || !process.stdin.isTTY)
33
+ if (!opts.ignoredBuilds?.size)
34
+ return;
35
+ const autoApproveForTests = process.env[AUTO_APPROVE_FOR_TESTS_ENV] === '1';
36
+ if (!autoApproveForTests && !process.stdin.isTTY)
17
37
  return;
18
38
  await commands['approve-builds']({
19
39
  ...opts.inheritedOpts,
@@ -21,7 +41,7 @@ export async function promptApproveGlobalBuilds(opts, commands) {
21
41
  allProjects: undefined,
22
42
  selectedProjectsGraph: undefined,
23
43
  workspacePackagePatterns: undefined,
24
- modulesDir: path.join(opts.installDir, 'node_modules'),
44
+ modulesDir: undefined,
25
45
  dir: opts.installDir,
26
46
  lockfileDir: opts.installDir,
27
47
  rootProjectManifest: undefined,
@@ -30,6 +50,9 @@ export async function promptApproveGlobalBuilds(opts, commands) {
30
50
  global: false,
31
51
  pending: false,
32
52
  allowBuilds: opts.allowBuilds,
53
+ // When set, makes `approve-builds` skip both its multiselect and
54
+ // confirm prompts and approve every pending build.
55
+ all: autoApproveForTests ? true : undefined,
33
56
  }, [], commands);
34
57
  }
35
58
  //# sourceMappingURL=promptApproveGlobalBuilds.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/global.commands",
3
- "version": "1100.0.6",
3
+ "version": "1100.0.8",
4
4
  "description": "Global package command handlers for pnpm",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -28,23 +28,23 @@
28
28
  "@pnpm/util.lex-comparator": "^3.0.2",
29
29
  "is-subdir": "^2.0.0",
30
30
  "symlink-dir": "^10.0.1",
31
- "@pnpm/bins.remover": "1100.0.1",
32
- "@pnpm/bins.linker": "1100.0.2",
33
- "@pnpm/bins.resolver": "1100.0.1",
34
- "@pnpm/cli.command": "1100.0.0",
35
- "@pnpm/config.reader": "1101.1.2",
36
- "@pnpm/cli.utils": "1101.0.0",
31
+ "@pnpm/bins.linker": "1100.0.3",
32
+ "@pnpm/bins.remover": "1100.0.2",
33
+ "@pnpm/bins.resolver": "1100.0.2",
34
+ "@pnpm/cli.command": "1100.0.1",
35
+ "@pnpm/cli.utils": "1101.0.2",
36
+ "@pnpm/config.reader": "1101.1.3",
37
+ "@pnpm/config.matcher": "1100.0.1",
38
+ "@pnpm/global.packages": "1100.0.2",
37
39
  "@pnpm/error": "1100.0.0",
38
- "@pnpm/global.packages": "1100.0.1",
39
- "@pnpm/installing.deps-installer": "1101.0.2",
40
- "@pnpm/config.matcher": "1100.0.0",
41
- "@pnpm/pkg-manifest.reader": "1100.0.1",
42
- "@pnpm/store.connection-manager": "1100.0.6",
40
+ "@pnpm/installing.deps-installer": "1101.0.4",
41
+ "@pnpm/pkg-manifest.reader": "1100.0.2",
42
+ "@pnpm/store.connection-manager": "1100.0.8",
43
43
  "@pnpm/types": "1101.0.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@jest/globals": "30.3.0",
47
- "@pnpm/global.commands": "1100.0.6"
47
+ "@pnpm/global.commands": "1100.0.8"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=22.13"