@procedures/pnpm 0.0.0-stage → 0.2.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/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +792 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/module.d.ts +21 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +132 -0
- package/dist/module.js.map +1 -0
- package/dist/procedures/pnpm/add.d.ts +25 -0
- package/dist/procedures/pnpm/add.d.ts.map +1 -0
- package/dist/procedures/pnpm/add.js +34 -0
- package/dist/procedures/pnpm/add.js.map +1 -0
- package/dist/procedures/pnpm/index.d.ts +10 -0
- package/dist/procedures/pnpm/index.d.ts.map +1 -0
- package/dist/procedures/pnpm/index.js +10 -0
- package/dist/procedures/pnpm/index.js.map +1 -0
- package/dist/procedures/pnpm/install.d.ts +23 -0
- package/dist/procedures/pnpm/install.d.ts.map +1 -0
- package/dist/procedures/pnpm/install.js +36 -0
- package/dist/procedures/pnpm/install.js.map +1 -0
- package/dist/procedures/pnpm/link.d.ts +24 -0
- package/dist/procedures/pnpm/link.d.ts.map +1 -0
- package/dist/procedures/pnpm/link.js +35 -0
- package/dist/procedures/pnpm/link.js.map +1 -0
- package/dist/procedures/pnpm/remove.d.ts +18 -0
- package/dist/procedures/pnpm/remove.d.ts.map +1 -0
- package/dist/procedures/pnpm/remove.js +25 -0
- package/dist/procedures/pnpm/remove.js.map +1 -0
- package/dist/procedures/pnpm/run.d.ts +25 -0
- package/dist/procedures/pnpm/run.d.ts.map +1 -0
- package/dist/procedures/pnpm/run.js +33 -0
- package/dist/procedures/pnpm/run.js.map +1 -0
- package/dist/procedures/pnpm/shared.d.ts +25 -0
- package/dist/procedures/pnpm/shared.d.ts.map +1 -0
- package/dist/procedures/pnpm/shared.js +75 -0
- package/dist/procedures/pnpm/shared.js.map +1 -0
- package/dist/procedures/pnpm/store.d.ts +23 -0
- package/dist/procedures/pnpm/store.d.ts.map +1 -0
- package/dist/procedures/pnpm/store.js +85 -0
- package/dist/procedures/pnpm/store.js.map +1 -0
- package/dist/register.d.ts +7 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +9 -0
- package/dist/register.js.map +1 -0
- package/dist/types.d.ts +71 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +98 -0
- package/dist/types.js.map +1 -0
- package/package.json +79 -3
- package/src/index.ts +57 -0
- package/src/module.ts +162 -0
- package/src/procedures/pnpm/add.ts +40 -0
- package/src/procedures/pnpm/index.ts +10 -0
- package/src/procedures/pnpm/install.ts +43 -0
- package/src/procedures/pnpm/link.ts +43 -0
- package/src/procedures/pnpm/remove.ts +32 -0
- package/src/procedures/pnpm/run.ts +41 -0
- package/src/procedures/pnpm/shared.ts +85 -0
- package/src/procedures/pnpm/store.ts +97 -0
- package/src/register.ts +11 -0
- package/src/types.ts +180 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for client-pnpm procedures
|
|
3
|
+
*
|
|
4
|
+
* client-pnpm wraps pnpm commands as procedures using client-shell.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
export interface PnpmCommandOutput {
|
|
8
|
+
/** Exit code of the command */
|
|
9
|
+
exitCode: number;
|
|
10
|
+
/** Standard output */
|
|
11
|
+
stdout: string;
|
|
12
|
+
/** Standard error */
|
|
13
|
+
stderr: string;
|
|
14
|
+
/** Whether command succeeded (exit code 0) */
|
|
15
|
+
success: boolean;
|
|
16
|
+
/** Duration in milliseconds */
|
|
17
|
+
duration: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const PnpmInstallInputSchema: z.ZodObject<{
|
|
20
|
+
packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
+
dev: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
frozen: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
24
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
}>;
|
|
26
|
+
export type PnpmInstallInput = z.infer<typeof PnpmInstallInputSchema>;
|
|
27
|
+
export declare const PnpmAddInputSchema: z.ZodObject<{
|
|
28
|
+
packages: z.ZodArray<z.ZodString>;
|
|
29
|
+
dev: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
global: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
32
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
}>;
|
|
34
|
+
export type PnpmAddInput = z.infer<typeof PnpmAddInputSchema>;
|
|
35
|
+
export declare const PnpmRemoveInputSchema: z.ZodObject<{
|
|
36
|
+
packages: z.ZodArray<z.ZodString>;
|
|
37
|
+
global: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
39
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
}>;
|
|
41
|
+
export type PnpmRemoveInput = z.infer<typeof PnpmRemoveInputSchema>;
|
|
42
|
+
export declare const PnpmLinkInputSchema: z.ZodObject<{
|
|
43
|
+
path: z.ZodOptional<z.ZodString>;
|
|
44
|
+
global: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
46
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
}>;
|
|
48
|
+
export type PnpmLinkInput = z.infer<typeof PnpmLinkInputSchema>;
|
|
49
|
+
export declare const PnpmRunInputSchema: z.ZodObject<{
|
|
50
|
+
script: z.ZodString;
|
|
51
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
53
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
}>;
|
|
55
|
+
export type PnpmRunInput = z.infer<typeof PnpmRunInputSchema>;
|
|
56
|
+
export declare const PnpmStorePathInputSchema: z.ZodObject<{
|
|
57
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}>;
|
|
59
|
+
export type PnpmStorePathInput = z.infer<typeof PnpmStorePathInputSchema>;
|
|
60
|
+
export interface PnpmStorePathOutput {
|
|
61
|
+
/** Absolute path to the pnpm store */
|
|
62
|
+
path: string;
|
|
63
|
+
/** Whether store exists */
|
|
64
|
+
exists: boolean;
|
|
65
|
+
/** Platform (win32, darwin, linux) */
|
|
66
|
+
platform: string;
|
|
67
|
+
}
|
|
68
|
+
/** The result of a pnpm command: add, install, remove, link and run give it. */
|
|
69
|
+
export declare const PnpmCommandOutputSchema: z.ZodType<PnpmCommandOutput>;
|
|
70
|
+
export declare const PnpmStorePathOutputSchema: z.ZodType<PnpmStorePathOutput>;
|
|
71
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAMD,eAAO,MAAM,sBAAsB,EAAE,CAAC,CAAC,SAAS,CAAC;IAC/C,QAAQ,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACjD,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CAAC,CAAC;AAE1E,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAKD,gFAAgF;AAChF,eAAO,MAAM,uBAAuB,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAM/D,CAAC;AAEH,eAAO,MAAM,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAInE,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for client-pnpm procedures
|
|
3
|
+
*
|
|
4
|
+
* client-pnpm wraps pnpm commands as procedures using client-shell.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// pnpm.install Types
|
|
9
|
+
// =============================================================================
|
|
10
|
+
export const PnpmInstallInputSchema = z.object({
|
|
11
|
+
/** Packages to install. If not provided, installs from package.json */
|
|
12
|
+
packages: z.array(z.string()).optional().describe("Packages to install. If not provided, installs from package.json"),
|
|
13
|
+
/** Save as dev dependency */
|
|
14
|
+
dev: z.boolean().optional().describe("Save as dev dependency"),
|
|
15
|
+
/** Use frozen lockfile (--frozen-lockfile) */
|
|
16
|
+
frozen: z.boolean().optional().describe("Use frozen lockfile (--frozen-lockfile)"),
|
|
17
|
+
/** Working directory */
|
|
18
|
+
cwd: z.string().optional().describe("Working directory"),
|
|
19
|
+
/** Timeout in milliseconds */
|
|
20
|
+
timeout: z.number().optional().describe("Timeout in milliseconds"),
|
|
21
|
+
});
|
|
22
|
+
// =============================================================================
|
|
23
|
+
// pnpm.add Types
|
|
24
|
+
// =============================================================================
|
|
25
|
+
export const PnpmAddInputSchema = z.object({
|
|
26
|
+
/** Packages to add */
|
|
27
|
+
packages: z.array(z.string()).describe("Packages to add"),
|
|
28
|
+
/** Save as dev dependency */
|
|
29
|
+
dev: z.boolean().optional().describe("Save as dev dependency"),
|
|
30
|
+
/** Install globally */
|
|
31
|
+
global: z.boolean().optional().describe("Install globally"),
|
|
32
|
+
/** Working directory */
|
|
33
|
+
cwd: z.string().optional().describe("Working directory"),
|
|
34
|
+
/** Timeout in milliseconds */
|
|
35
|
+
timeout: z.number().optional().describe("Timeout in milliseconds"),
|
|
36
|
+
});
|
|
37
|
+
// =============================================================================
|
|
38
|
+
// pnpm.remove Types
|
|
39
|
+
// =============================================================================
|
|
40
|
+
export const PnpmRemoveInputSchema = z.object({
|
|
41
|
+
/** Packages to remove */
|
|
42
|
+
packages: z.array(z.string()).describe("Packages to remove"),
|
|
43
|
+
/** Remove from global */
|
|
44
|
+
global: z.boolean().optional().describe("Remove from global"),
|
|
45
|
+
/** Working directory */
|
|
46
|
+
cwd: z.string().optional().describe("Working directory"),
|
|
47
|
+
/** Timeout in milliseconds */
|
|
48
|
+
timeout: z.number().optional().describe("Timeout in milliseconds"),
|
|
49
|
+
});
|
|
50
|
+
// =============================================================================
|
|
51
|
+
// pnpm.link Types
|
|
52
|
+
// =============================================================================
|
|
53
|
+
export const PnpmLinkInputSchema = z.object({
|
|
54
|
+
/** Path to package to link. If not provided, links current directory globally */
|
|
55
|
+
path: z.string().optional().describe("Path to package to link. If not provided, links current directory globally"),
|
|
56
|
+
/** Link globally */
|
|
57
|
+
global: z.boolean().optional().describe("Link globally"),
|
|
58
|
+
/** Working directory */
|
|
59
|
+
cwd: z.string().optional().describe("Working directory"),
|
|
60
|
+
/** Timeout in milliseconds */
|
|
61
|
+
timeout: z.number().optional().describe("Timeout in milliseconds"),
|
|
62
|
+
});
|
|
63
|
+
// =============================================================================
|
|
64
|
+
// pnpm.run Types
|
|
65
|
+
// =============================================================================
|
|
66
|
+
export const PnpmRunInputSchema = z.object({
|
|
67
|
+
/** Script name to run */
|
|
68
|
+
script: z.string().describe("Script name to run"),
|
|
69
|
+
/** Additional arguments to pass to the script */
|
|
70
|
+
args: z.array(z.string()).optional().describe("Additional arguments to pass to the script"),
|
|
71
|
+
/** Working directory */
|
|
72
|
+
cwd: z.string().optional().describe("Working directory"),
|
|
73
|
+
/** Timeout in milliseconds */
|
|
74
|
+
timeout: z.number().optional().describe("Timeout in milliseconds"),
|
|
75
|
+
});
|
|
76
|
+
// =============================================================================
|
|
77
|
+
// pnpm.store.path Types - Get pnpm store path for snapshot/restore
|
|
78
|
+
// =============================================================================
|
|
79
|
+
export const PnpmStorePathInputSchema = z.object({
|
|
80
|
+
/** Working directory (affects store path on some configurations) */
|
|
81
|
+
cwd: z.string().optional().describe("Working directory (affects store path on some configurations)"),
|
|
82
|
+
});
|
|
83
|
+
// Output schemas (roadmap 2.1). Loose objects: a field that a schema does not name stays in the
|
|
84
|
+
// result (a strict schema would remove it when the output is validated).
|
|
85
|
+
/** The result of a pnpm command: add, install, remove, link and run give it. */
|
|
86
|
+
export const PnpmCommandOutputSchema = z.looseObject({
|
|
87
|
+
exitCode: z.number().describe("The exit code of pnpm (0 is success)"),
|
|
88
|
+
stdout: z.string().describe("The standard output of pnpm"),
|
|
89
|
+
stderr: z.string().describe("The standard error of pnpm"),
|
|
90
|
+
success: z.boolean().describe("True when the exit code is 0"),
|
|
91
|
+
duration: z.number().describe("The time of the command, in milliseconds"),
|
|
92
|
+
});
|
|
93
|
+
export const PnpmStorePathOutputSchema = z.looseObject({
|
|
94
|
+
path: z.string().describe("The absolute path of the pnpm store"),
|
|
95
|
+
exists: z.boolean().describe("True when the store folder exists"),
|
|
96
|
+
platform: z.string().describe("The platform (win32, darwin, linux)"),
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,gFAAgF;AAChF,qBAAqB;AACr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O,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC7D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;CAC1E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAmC,CAAC,CAAC,WAAW,CAAC;IACrF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAChE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IACjE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;CACrE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,82 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package",
|
|
2
3
|
"name": "@procedures/pnpm",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"version": "0.2.0",
|
|
5
|
+
"description": "pnpm commands as typed procedures: install, add, remove, run and link, run with argv and option-injection guards.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pnpm",
|
|
8
|
+
"package-manager",
|
|
9
|
+
"monorepo",
|
|
10
|
+
"procedures"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://mark1russell7.github.io/client/",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/mark1russell7/client/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/mark1russell7/client.git",
|
|
19
|
+
"directory": "packages/client-pnpm"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Mark Russell (https://github.com/mark1russell7)",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./module": {
|
|
32
|
+
"types": "./dist/module.d.ts",
|
|
33
|
+
"import": "./dist/module.js"
|
|
34
|
+
},
|
|
35
|
+
"./register": {
|
|
36
|
+
"types": "./dist/register.d.ts",
|
|
37
|
+
"import": "./dist/register.js"
|
|
38
|
+
},
|
|
39
|
+
"./register.js": {
|
|
40
|
+
"import": "./dist/register.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"src",
|
|
46
|
+
"!src/**/*.test.ts",
|
|
47
|
+
"!src/**/*.test.tsx",
|
|
48
|
+
"!src/**/__tests__",
|
|
49
|
+
"CHANGELOG.md"
|
|
50
|
+
],
|
|
51
|
+
"sideEffects": [
|
|
52
|
+
"./dist/register.js"
|
|
53
|
+
],
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=22"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public",
|
|
59
|
+
"provenance": true
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@procedures/client": "0.2.0",
|
|
63
|
+
"@procedures/shell": "0.2.0",
|
|
64
|
+
"zod": "^4.6.5"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"typescript": "^7.0.2",
|
|
68
|
+
"@types/node": "^22.0.0",
|
|
69
|
+
"@mark1russell7/cue": "^1.0.0",
|
|
70
|
+
"vitest": "^5.0.3"
|
|
71
|
+
},
|
|
72
|
+
"client": {
|
|
73
|
+
"procedures": "./dist/register.js"
|
|
74
|
+
},
|
|
75
|
+
"scripts": {
|
|
76
|
+
"build": "tsc -b",
|
|
77
|
+
"typecheck": "tsc --noEmit",
|
|
78
|
+
"clean": "rm -rf dist .tsbuildinfo",
|
|
79
|
+
"test": "vitest run",
|
|
80
|
+
"test:watch": "vitest"
|
|
81
|
+
}
|
|
6
82
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @procedures/pnpm
|
|
3
|
+
*
|
|
4
|
+
* Wraps pnpm commands as procedures using client-shell.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { Client } from "@procedures/client";
|
|
9
|
+
*
|
|
10
|
+
* // Install dependencies
|
|
11
|
+
* await client.call(["pnpm", "install"], {});
|
|
12
|
+
*
|
|
13
|
+
* // Add a package
|
|
14
|
+
* await client.call(["pnpm", "add"], {
|
|
15
|
+
* packages: ["lodash"],
|
|
16
|
+
* dev: true,
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Link a package
|
|
20
|
+
* await client.call(["pnpm", "link"], {
|
|
21
|
+
* path: "../other-package",
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// Types
|
|
27
|
+
export type {
|
|
28
|
+
PnpmInstallInput,
|
|
29
|
+
PnpmAddInput,
|
|
30
|
+
PnpmRemoveInput,
|
|
31
|
+
PnpmLinkInput,
|
|
32
|
+
PnpmRunInput,
|
|
33
|
+
PnpmCommandOutput,
|
|
34
|
+
} from "./types.js";
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
PnpmInstallInputSchema,
|
|
38
|
+
PnpmAddInputSchema,
|
|
39
|
+
PnpmRemoveInputSchema,
|
|
40
|
+
PnpmLinkInputSchema,
|
|
41
|
+
PnpmRunInputSchema,
|
|
42
|
+
} from "./types.js";
|
|
43
|
+
|
|
44
|
+
// Procedures
|
|
45
|
+
export {
|
|
46
|
+
pnpmInstall,
|
|
47
|
+
pnpmAdd,
|
|
48
|
+
pnpmRemove,
|
|
49
|
+
pnpmLink,
|
|
50
|
+
pnpmRun,
|
|
51
|
+
} from "./procedures/pnpm/index.js";
|
|
52
|
+
|
|
53
|
+
// How the procedures find pnpm (no shell): other packages that run pnpm use it too
|
|
54
|
+
export { resolvePnpm } from "./procedures/pnpm/shared.js";
|
|
55
|
+
|
|
56
|
+
// Registration
|
|
57
|
+
export { registerPnpmProcedures } from "./module.js";
|
package/src/module.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module (no side effects): the procedures of this package as data, for `createRegistry()`.
|
|
3
|
+
*
|
|
4
|
+
* Procedure Registration for pnpm operations
|
|
5
|
+
*
|
|
6
|
+
* Provides pnpm.install, pnpm.add, pnpm.remove, pnpm.link, pnpm.run procedures.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import { createProcedure, zodAdapter, defineModule, type ProcedureModule, PROCEDURE_REGISTRY, registerModules, type ProcedureRegistry } from "@procedures/client";
|
|
11
|
+
import shellModule from "@procedures/shell/module";
|
|
12
|
+
import { pnpmInstall, pnpmAdd, pnpmRemove, pnpmLink, pnpmRun, pnpmStorePath } from "./procedures/pnpm/index.js";
|
|
13
|
+
import {
|
|
14
|
+
PnpmInstallInputSchema,
|
|
15
|
+
PnpmAddInputSchema,
|
|
16
|
+
PnpmRemoveInputSchema,
|
|
17
|
+
PnpmLinkInputSchema,
|
|
18
|
+
PnpmRunInputSchema,
|
|
19
|
+
type PnpmInstallInput,
|
|
20
|
+
type PnpmAddInput,
|
|
21
|
+
type PnpmRemoveInput,
|
|
22
|
+
type PnpmLinkInput,
|
|
23
|
+
type PnpmRunInput,
|
|
24
|
+
type PnpmCommandOutput,
|
|
25
|
+
PnpmStorePathInputSchema,
|
|
26
|
+
type PnpmStorePathInput,
|
|
27
|
+
type PnpmStorePathOutput,
|
|
28
|
+
PnpmCommandOutputSchema,
|
|
29
|
+
PnpmStorePathOutputSchema,
|
|
30
|
+
} from "./types.js";
|
|
31
|
+
import type { ProcedureContext } from "@procedures/client";
|
|
32
|
+
|
|
33
|
+
// =============================================================================
|
|
34
|
+
// Procedures
|
|
35
|
+
// =============================================================================
|
|
36
|
+
|
|
37
|
+
const pnpmInstallProcedure = createProcedure()
|
|
38
|
+
.path(["pnpm", "install"])
|
|
39
|
+
.input(zodAdapter<PnpmInstallInput>(PnpmInstallInputSchema))
|
|
40
|
+
.output(zodAdapter<PnpmCommandOutput>(PnpmCommandOutputSchema))
|
|
41
|
+
.meta({
|
|
42
|
+
description: "Install packages using pnpm",
|
|
43
|
+
// pnpm reads the npm registry, rewrites node_modules and the lockfile, and runs the
|
|
44
|
+
// lifecycle scripts and the pnpmfile of the project
|
|
45
|
+
effects: { reads: ["fs", "network"], writes: ["fs", "process"] },
|
|
46
|
+
shorts: { cwd: "C", dev: "D", frozen: "F" },
|
|
47
|
+
output: "json",
|
|
48
|
+
})
|
|
49
|
+
.handler(async (input: PnpmInstallInput, ctx: ProcedureContext): Promise<PnpmCommandOutput> => {
|
|
50
|
+
return pnpmInstall(input, ctx);
|
|
51
|
+
})
|
|
52
|
+
.build();
|
|
53
|
+
|
|
54
|
+
const pnpmAddProcedure = createProcedure()
|
|
55
|
+
.path(["pnpm", "add"])
|
|
56
|
+
.input(zodAdapter<PnpmAddInput>(PnpmAddInputSchema))
|
|
57
|
+
.output(zodAdapter<PnpmCommandOutput>(PnpmCommandOutputSchema))
|
|
58
|
+
.meta({
|
|
59
|
+
description: "Add packages using pnpm",
|
|
60
|
+
effects: { reads: ["fs", "network"], writes: ["fs", "process"] },
|
|
61
|
+
args: ["packages"],
|
|
62
|
+
shorts: { cwd: "C", dev: "D", global: "g" },
|
|
63
|
+
output: "json",
|
|
64
|
+
})
|
|
65
|
+
.handler(async (input: PnpmAddInput, ctx: ProcedureContext): Promise<PnpmCommandOutput> => {
|
|
66
|
+
return pnpmAdd(input, ctx);
|
|
67
|
+
})
|
|
68
|
+
.build();
|
|
69
|
+
|
|
70
|
+
const pnpmRemoveProcedure = createProcedure()
|
|
71
|
+
.path(["pnpm", "remove"])
|
|
72
|
+
.input(zodAdapter<PnpmRemoveInput>(PnpmRemoveInputSchema))
|
|
73
|
+
.output(zodAdapter<PnpmCommandOutput>(PnpmCommandOutputSchema))
|
|
74
|
+
.meta({
|
|
75
|
+
description: "Remove packages using pnpm",
|
|
76
|
+
// pnpm resolves the remaining dependencies again, so it can read the npm registry
|
|
77
|
+
effects: { reads: ["fs", "network"], writes: ["fs", "process"] },
|
|
78
|
+
args: ["packages"],
|
|
79
|
+
shorts: { cwd: "C", global: "g" },
|
|
80
|
+
output: "json",
|
|
81
|
+
})
|
|
82
|
+
.handler(async (input: PnpmRemoveInput, ctx: ProcedureContext): Promise<PnpmCommandOutput> => {
|
|
83
|
+
return pnpmRemove(input, ctx);
|
|
84
|
+
})
|
|
85
|
+
.build();
|
|
86
|
+
|
|
87
|
+
const pnpmLinkProcedure = createProcedure()
|
|
88
|
+
.path(["pnpm", "link"])
|
|
89
|
+
.input(zodAdapter<PnpmLinkInput>(PnpmLinkInputSchema))
|
|
90
|
+
.output(zodAdapter<PnpmCommandOutput>(PnpmCommandOutputSchema))
|
|
91
|
+
.meta({
|
|
92
|
+
description: "Link packages using pnpm",
|
|
93
|
+
effects: { reads: ["fs", "network"], writes: ["fs", "process"] },
|
|
94
|
+
shorts: { cwd: "C", global: "g" },
|
|
95
|
+
output: "json",
|
|
96
|
+
})
|
|
97
|
+
.handler(async (input: PnpmLinkInput, ctx: ProcedureContext): Promise<PnpmCommandOutput> => {
|
|
98
|
+
return pnpmLink(input, ctx);
|
|
99
|
+
})
|
|
100
|
+
.build();
|
|
101
|
+
|
|
102
|
+
const pnpmRunProcedure = createProcedure()
|
|
103
|
+
.path(["pnpm", "run"])
|
|
104
|
+
.input(zodAdapter<PnpmRunInput>(PnpmRunInputSchema))
|
|
105
|
+
.output(zodAdapter<PnpmCommandOutput>(PnpmCommandOutputSchema))
|
|
106
|
+
.meta({
|
|
107
|
+
description: "Run package scripts using pnpm",
|
|
108
|
+
// A package script is code of the project: it can do anything
|
|
109
|
+
effects: { reads: ["fs"], writes: ["process"] },
|
|
110
|
+
args: ["script"],
|
|
111
|
+
shorts: { cwd: "C" },
|
|
112
|
+
output: "json",
|
|
113
|
+
})
|
|
114
|
+
.handler(async (input: PnpmRunInput, ctx: ProcedureContext): Promise<PnpmCommandOutput> => {
|
|
115
|
+
return pnpmRun(input, ctx);
|
|
116
|
+
})
|
|
117
|
+
.build();
|
|
118
|
+
|
|
119
|
+
const pnpmStorePathProcedure = createProcedure()
|
|
120
|
+
.path(["pnpm", "store", "path"])
|
|
121
|
+
.input(zodAdapter<PnpmStorePathInput>(PnpmStorePathInputSchema))
|
|
122
|
+
.output(zodAdapter<PnpmStorePathOutput>(PnpmStorePathOutputSchema))
|
|
123
|
+
.meta({
|
|
124
|
+
description: "Get pnpm store path for snapshot/restore",
|
|
125
|
+
// `pnpm store path` only reads the configuration of pnpm
|
|
126
|
+
effects: { reads: ["fs"], writes: [] },
|
|
127
|
+
args: [],
|
|
128
|
+
shorts: { cwd: "C" },
|
|
129
|
+
output: "json",
|
|
130
|
+
})
|
|
131
|
+
.handler(async (input: PnpmStorePathInput): Promise<PnpmStorePathOutput> => {
|
|
132
|
+
return pnpmStorePath(input);
|
|
133
|
+
})
|
|
134
|
+
.build();
|
|
135
|
+
|
|
136
|
+
// =============================================================================
|
|
137
|
+
// Registration
|
|
138
|
+
// =============================================================================
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The module of this package, for `createRegistry()`: its procedures as data. Importing this
|
|
142
|
+
* file registers nothing. (`register.ts` registers the same procedures in the global registry.)
|
|
143
|
+
*/
|
|
144
|
+
export const pnpmModule: ProcedureModule = defineModule("@procedures/pnpm", [
|
|
145
|
+
pnpmInstallProcedure,
|
|
146
|
+
pnpmAddProcedure,
|
|
147
|
+
pnpmRemoveProcedure,
|
|
148
|
+
pnpmLinkProcedure,
|
|
149
|
+
pnpmRunProcedure,
|
|
150
|
+
pnpmStorePathProcedure,
|
|
151
|
+
], [shellModule]);
|
|
152
|
+
|
|
153
|
+
export default pnpmModule;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* This function registers the procedures of @procedures/pnpm, and of the modules that it requires, in
|
|
157
|
+
* a registry. The default is the global registry. Importing this file registers nothing: the
|
|
158
|
+
* `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
159
|
+
*/
|
|
160
|
+
export function registerPnpmProcedures(registry: ProcedureRegistry = PROCEDURE_REGISTRY): void {
|
|
161
|
+
registerModules(registry, [pnpmModule]);
|
|
162
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pnpm.add procedure
|
|
3
|
+
*
|
|
4
|
+
* Add packages using pnpm.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ProcedureContext } from "@procedures/client";
|
|
8
|
+
import { pnpmArg, runPnpm } from "./shared.js";
|
|
9
|
+
import type { PnpmAddInput, PnpmCommandOutput } from "../../types.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Add packages using pnpm
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Add a package
|
|
16
|
+
* await client.call(["pnpm", "add"], {
|
|
17
|
+
* packages: ["lodash"],
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Add as dev dependency
|
|
22
|
+
* await client.call(["pnpm", "add"], {
|
|
23
|
+
* packages: ["vitest", "@types/node"],
|
|
24
|
+
* dev: true,
|
|
25
|
+
* });
|
|
26
|
+
*/
|
|
27
|
+
export async function pnpmAdd(
|
|
28
|
+
input: PnpmAddInput,
|
|
29
|
+
ctx: ProcedureContext
|
|
30
|
+
): Promise<PnpmCommandOutput> {
|
|
31
|
+
{
|
|
32
|
+
const args: string[] = ["add", ...input.packages.map((p) => pnpmArg("package", p))];
|
|
33
|
+
|
|
34
|
+
// Add flags
|
|
35
|
+
if (input.dev) args.push("--save-dev");
|
|
36
|
+
if (input.global) args.push("--global");
|
|
37
|
+
|
|
38
|
+
return runPnpm(args, input, ctx);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pnpm Procedures
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export { pnpmInstall } from "./install.js";
|
|
6
|
+
export { pnpmAdd } from "./add.js";
|
|
7
|
+
export { pnpmRemove } from "./remove.js";
|
|
8
|
+
export { pnpmLink } from "./link.js";
|
|
9
|
+
export { pnpmRun } from "./run.js";
|
|
10
|
+
export { pnpmStorePath } from "./store.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pnpm.install procedure
|
|
3
|
+
*
|
|
4
|
+
* Install packages using pnpm.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ProcedureContext } from "@procedures/client";
|
|
8
|
+
import { pnpmArg, runPnpm } from "./shared.js";
|
|
9
|
+
import type { PnpmInstallInput, PnpmCommandOutput } from "../../types.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Install packages using pnpm
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Install all dependencies from package.json
|
|
16
|
+
* await client.call(["pnpm", "install"], {});
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Install specific packages as dev dependencies
|
|
20
|
+
* await client.call(["pnpm", "install"], {
|
|
21
|
+
* packages: ["vitest", "@types/node"],
|
|
22
|
+
* dev: true,
|
|
23
|
+
* });
|
|
24
|
+
*/
|
|
25
|
+
export async function pnpmInstall(
|
|
26
|
+
input: PnpmInstallInput,
|
|
27
|
+
ctx: ProcedureContext
|
|
28
|
+
): Promise<PnpmCommandOutput> {
|
|
29
|
+
{
|
|
30
|
+
const args: string[] = ["install"];
|
|
31
|
+
|
|
32
|
+
// Add packages if specified
|
|
33
|
+
if (input.packages && input.packages.length > 0) {
|
|
34
|
+
args.push(...input.packages.map((p) => pnpmArg("package", p)));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Add flags
|
|
38
|
+
if (input.dev) args.push("--save-dev");
|
|
39
|
+
if (input.frozen) args.push("--frozen-lockfile");
|
|
40
|
+
|
|
41
|
+
return runPnpm(args, input, ctx);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pnpm.link procedure
|
|
3
|
+
*
|
|
4
|
+
* Link packages using pnpm.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ProcedureContext } from "@procedures/client";
|
|
8
|
+
import { pnpmArg, runPnpm } from "./shared.js";
|
|
9
|
+
import type { PnpmLinkInput, PnpmCommandOutput } from "../../types.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Link packages using pnpm
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Link current directory globally
|
|
16
|
+
* await client.call(["pnpm", "link"], {
|
|
17
|
+
* global: true,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Link a specific path
|
|
22
|
+
* await client.call(["pnpm", "link"], {
|
|
23
|
+
* path: "../other-package",
|
|
24
|
+
* });
|
|
25
|
+
*/
|
|
26
|
+
export async function pnpmLink(
|
|
27
|
+
input: PnpmLinkInput,
|
|
28
|
+
ctx: ProcedureContext
|
|
29
|
+
): Promise<PnpmCommandOutput> {
|
|
30
|
+
{
|
|
31
|
+
const args: string[] = ["link"];
|
|
32
|
+
|
|
33
|
+
// Add path if specified
|
|
34
|
+
if (input.path !== undefined) {
|
|
35
|
+
args.push(pnpmArg("path", input.path));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Add flags
|
|
39
|
+
if (input.global) args.push("--global");
|
|
40
|
+
|
|
41
|
+
return runPnpm(args, input, ctx);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pnpm.remove procedure
|
|
3
|
+
*
|
|
4
|
+
* Remove packages using pnpm.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ProcedureContext } from "@procedures/client";
|
|
8
|
+
import { pnpmArg, runPnpm } from "./shared.js";
|
|
9
|
+
import type { PnpmRemoveInput, PnpmCommandOutput } from "../../types.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Remove packages using pnpm
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Remove packages
|
|
16
|
+
* await client.call(["pnpm", "remove"], {
|
|
17
|
+
* packages: ["lodash"],
|
|
18
|
+
* });
|
|
19
|
+
*/
|
|
20
|
+
export async function pnpmRemove(
|
|
21
|
+
input: PnpmRemoveInput,
|
|
22
|
+
ctx: ProcedureContext
|
|
23
|
+
): Promise<PnpmCommandOutput> {
|
|
24
|
+
{
|
|
25
|
+
const args: string[] = ["remove", ...input.packages.map((p) => pnpmArg("package", p))];
|
|
26
|
+
|
|
27
|
+
// Add flags
|
|
28
|
+
if (input.global) args.push("--global");
|
|
29
|
+
|
|
30
|
+
return runPnpm(args, input, ctx);
|
|
31
|
+
}
|
|
32
|
+
}
|