@pnpm/global.commands 1100.0.2 → 1100.0.4
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/globalAdd.js +8 -16
- package/lib/globalUpdate.js +8 -16
- package/lib/promptApproveGlobalBuilds.d.ts +24 -0
- package/lib/promptApproveGlobalBuilds.js +35 -0
- package/package.json +10 -10
package/lib/globalAdd.js
CHANGED
|
@@ -8,6 +8,7 @@ import { isSubdir } from 'is-subdir';
|
|
|
8
8
|
import { symlinkDir } from 'symlink-dir';
|
|
9
9
|
import { checkGlobalBinConflicts } from './checkGlobalBinConflicts.js';
|
|
10
10
|
import { installGlobalPackages } from './installGlobalPackages.js';
|
|
11
|
+
import { promptApproveGlobalBuilds } from './promptApproveGlobalBuilds.js';
|
|
11
12
|
import { readInstalledPackages } from './readInstalledPackages.js';
|
|
12
13
|
export async function handleGlobalAdd(opts, params, commands) {
|
|
13
14
|
// Resolve relative path selectors to absolute paths before the working
|
|
@@ -56,22 +57,13 @@ export async function handleGlobalAdd(opts, params, commands) {
|
|
|
56
57
|
allowBuilds: builds,
|
|
57
58
|
});
|
|
58
59
|
const ignoredBuilds = await installGlobalPackages(makeInstallOpts(installDir, allowBuilds), params);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
lockfileDir: installDir,
|
|
67
|
-
rootProjectManifest: undefined,
|
|
68
|
-
rootProjectManifestDir: installDir,
|
|
69
|
-
workspaceDir: opts.globalPkgDir,
|
|
70
|
-
global: false,
|
|
71
|
-
pending: false,
|
|
72
|
-
allowBuilds,
|
|
73
|
-
}, [], commands);
|
|
74
|
-
}
|
|
60
|
+
await promptApproveGlobalBuilds({
|
|
61
|
+
globalPkgDir: globalDir,
|
|
62
|
+
installDir,
|
|
63
|
+
ignoredBuilds,
|
|
64
|
+
allowBuilds,
|
|
65
|
+
inheritedOpts: opts,
|
|
66
|
+
}, commands);
|
|
75
67
|
// Read resolved aliases from the installed package.json
|
|
76
68
|
const pkgJson = readPackageJsonFromDirRawSync(installDir);
|
|
77
69
|
const aliases = Object.keys(pkgJson.dependencies ?? {});
|
package/lib/globalUpdate.js
CHANGED
|
@@ -7,6 +7,7 @@ import { isSubdir } from 'is-subdir';
|
|
|
7
7
|
import { symlinkDir } from 'symlink-dir';
|
|
8
8
|
import { checkGlobalBinConflicts } from './checkGlobalBinConflicts.js';
|
|
9
9
|
import { installGlobalPackages } from './installGlobalPackages.js';
|
|
10
|
+
import { promptApproveGlobalBuilds } from './promptApproveGlobalBuilds.js';
|
|
10
11
|
import { readInstalledPackages } from './readInstalledPackages.js';
|
|
11
12
|
export async function handleGlobalUpdate(opts, params, commands) {
|
|
12
13
|
const globalDir = opts.globalPkgDir;
|
|
@@ -65,22 +66,13 @@ async function updateGlobalPackageGroup(opts, globalDir, globalBinDir, pkg, comm
|
|
|
65
66
|
includeDirect: include,
|
|
66
67
|
allowBuilds,
|
|
67
68
|
}, depSpecs);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
lockfileDir: installDir,
|
|
76
|
-
rootProjectManifest: undefined,
|
|
77
|
-
rootProjectManifestDir: installDir,
|
|
78
|
-
workspaceDir: opts.globalPkgDir,
|
|
79
|
-
global: false,
|
|
80
|
-
pending: false,
|
|
81
|
-
allowBuilds,
|
|
82
|
-
}, [], commands);
|
|
83
|
-
}
|
|
69
|
+
await promptApproveGlobalBuilds({
|
|
70
|
+
globalPkgDir: globalDir,
|
|
71
|
+
installDir,
|
|
72
|
+
ignoredBuilds,
|
|
73
|
+
allowBuilds,
|
|
74
|
+
inheritedOpts: opts,
|
|
75
|
+
}, commands);
|
|
84
76
|
// Check for bin name conflicts with other global packages
|
|
85
77
|
const pkgs = await readInstalledPackages(installDir);
|
|
86
78
|
let binsToSkip;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CommandHandlerMap } from '@pnpm/cli.command';
|
|
2
|
+
import type { IgnoredBuilds } from '@pnpm/types';
|
|
3
|
+
export interface PromptApproveGlobalBuildsOptions {
|
|
4
|
+
globalPkgDir: string;
|
|
5
|
+
installDir: string;
|
|
6
|
+
ignoredBuilds: IgnoredBuilds | undefined;
|
|
7
|
+
allowBuilds: Record<string, string | boolean>;
|
|
8
|
+
/** Inherited config opts from the global add/update handler. */
|
|
9
|
+
inheritedOpts: object;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* If the previous global install left builds awaiting approval, run the
|
|
13
|
+
* interactive `approve-builds` flow against the install directory.
|
|
14
|
+
*
|
|
15
|
+
* `settingsDir` points at the global packages directory so the resulting
|
|
16
|
+
* allowBuilds update lands in its pnpm-workspace.yaml. The
|
|
17
|
+
* workspace-context fields (`workspaceDir`, `allProjects`,
|
|
18
|
+
* `selectedProjectsGraph`, `workspacePackagePatterns`) are explicitly
|
|
19
|
+
* cleared so that the install run by approve-builds in GVS mode operates
|
|
20
|
+
* only on the install directory — otherwise it would treat the global
|
|
21
|
+
* packages dir as a workspace and discover sibling install directories as
|
|
22
|
+
* workspace projects.
|
|
23
|
+
*/
|
|
24
|
+
export declare function promptApproveGlobalBuilds(opts: PromptApproveGlobalBuildsOptions, commands: CommandHandlerMap): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
/**
|
|
3
|
+
* If the previous global install left builds awaiting approval, run the
|
|
4
|
+
* interactive `approve-builds` flow against the install directory.
|
|
5
|
+
*
|
|
6
|
+
* `settingsDir` points at the global packages directory so the resulting
|
|
7
|
+
* allowBuilds update lands in its pnpm-workspace.yaml. The
|
|
8
|
+
* workspace-context fields (`workspaceDir`, `allProjects`,
|
|
9
|
+
* `selectedProjectsGraph`, `workspacePackagePatterns`) are explicitly
|
|
10
|
+
* cleared so that the install run by approve-builds in GVS mode operates
|
|
11
|
+
* only on the install directory — otherwise it would treat the global
|
|
12
|
+
* packages dir as a workspace and discover sibling install directories as
|
|
13
|
+
* workspace projects.
|
|
14
|
+
*/
|
|
15
|
+
export async function promptApproveGlobalBuilds(opts, commands) {
|
|
16
|
+
if (!opts.ignoredBuilds?.size || !process.stdin.isTTY)
|
|
17
|
+
return;
|
|
18
|
+
await commands['approve-builds']({
|
|
19
|
+
...opts.inheritedOpts,
|
|
20
|
+
workspaceDir: undefined,
|
|
21
|
+
allProjects: undefined,
|
|
22
|
+
selectedProjectsGraph: undefined,
|
|
23
|
+
workspacePackagePatterns: undefined,
|
|
24
|
+
modulesDir: path.join(opts.installDir, 'node_modules'),
|
|
25
|
+
dir: opts.installDir,
|
|
26
|
+
lockfileDir: opts.installDir,
|
|
27
|
+
rootProjectManifest: undefined,
|
|
28
|
+
rootProjectManifestDir: opts.installDir,
|
|
29
|
+
settingsDir: opts.globalPkgDir,
|
|
30
|
+
global: false,
|
|
31
|
+
pending: false,
|
|
32
|
+
allowBuilds: opts.allowBuilds,
|
|
33
|
+
}, [], commands);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=promptApproveGlobalBuilds.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/global.commands",
|
|
3
|
-
"version": "1100.0.
|
|
3
|
+
"version": "1100.0.4",
|
|
4
4
|
"description": "Global package command handlers for pnpm",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -29,21 +29,21 @@
|
|
|
29
29
|
"is-subdir": "^2.0.0",
|
|
30
30
|
"symlink-dir": "^10.0.1",
|
|
31
31
|
"@pnpm/bins.linker": "1100.0.2",
|
|
32
|
-
"@pnpm/cli.utils": "1101.0.0",
|
|
33
|
-
"@pnpm/cli.command": "1100.0.0",
|
|
34
|
-
"@pnpm/config.matcher": "1100.0.0",
|
|
35
32
|
"@pnpm/bins.resolver": "1100.0.1",
|
|
36
|
-
"@pnpm/error": "1100.0.0",
|
|
37
33
|
"@pnpm/bins.remover": "1100.0.1",
|
|
38
|
-
"@pnpm/
|
|
34
|
+
"@pnpm/cli.command": "1100.0.0",
|
|
35
|
+
"@pnpm/error": "1100.0.0",
|
|
36
|
+
"@pnpm/config.matcher": "1100.0.0",
|
|
37
|
+
"@pnpm/cli.utils": "1101.0.0",
|
|
38
|
+
"@pnpm/config.reader": "1101.1.1",
|
|
39
39
|
"@pnpm/global.packages": "1100.0.1",
|
|
40
|
-
"@pnpm/installing.deps-installer": "1100.0.2",
|
|
41
40
|
"@pnpm/pkg-manifest.reader": "1100.0.1",
|
|
42
|
-
"@pnpm/
|
|
43
|
-
"@pnpm/types": "1101.0.0"
|
|
41
|
+
"@pnpm/installing.deps-installer": "1101.0.0",
|
|
42
|
+
"@pnpm/types": "1101.0.0",
|
|
43
|
+
"@pnpm/store.connection-manager": "1100.0.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@pnpm/global.commands": "1100.0.
|
|
46
|
+
"@pnpm/global.commands": "1100.0.4"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=22.13"
|