@procedures/pnpm 0.2.3 → 0.4.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +40 -7
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/index.d.ts +3 -3
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/module.d.ts.map +1 -1
  9. package/dist/module.js +111 -0
  10. package/dist/module.js.map +1 -1
  11. package/dist/procedures/pnpm/add.js +2 -2
  12. package/dist/procedures/pnpm/add.js.map +1 -1
  13. package/dist/procedures/pnpm/exec.d.ts +17 -0
  14. package/dist/procedures/pnpm/exec.d.ts.map +1 -0
  15. package/dist/procedures/pnpm/exec.js +19 -0
  16. package/dist/procedures/pnpm/exec.js.map +1 -0
  17. package/dist/procedures/pnpm/index.d.ts +6 -0
  18. package/dist/procedures/pnpm/index.d.ts.map +1 -1
  19. package/dist/procedures/pnpm/index.js +6 -0
  20. package/dist/procedures/pnpm/index.js.map +1 -1
  21. package/dist/procedures/pnpm/install.js +2 -2
  22. package/dist/procedures/pnpm/install.js.map +1 -1
  23. package/dist/procedures/pnpm/list.d.ts +22 -0
  24. package/dist/procedures/pnpm/list.d.ts.map +1 -0
  25. package/dist/procedures/pnpm/list.js +30 -0
  26. package/dist/procedures/pnpm/list.js.map +1 -0
  27. package/dist/procedures/pnpm/outdated.d.ts +19 -0
  28. package/dist/procedures/pnpm/outdated.d.ts.map +1 -0
  29. package/dist/procedures/pnpm/outdated.js +29 -0
  30. package/dist/procedures/pnpm/outdated.js.map +1 -0
  31. package/dist/procedures/pnpm/pack.d.ts +17 -0
  32. package/dist/procedures/pnpm/pack.d.ts.map +1 -0
  33. package/dist/procedures/pnpm/pack.js +24 -0
  34. package/dist/procedures/pnpm/pack.js.map +1 -0
  35. package/dist/procedures/pnpm/remove.js +2 -2
  36. package/dist/procedures/pnpm/remove.js.map +1 -1
  37. package/dist/procedures/pnpm/run.js +2 -2
  38. package/dist/procedures/pnpm/run.js.map +1 -1
  39. package/dist/procedures/pnpm/shared.d.ts +20 -1
  40. package/dist/procedures/pnpm/shared.d.ts.map +1 -1
  41. package/dist/procedures/pnpm/shared.js +33 -2
  42. package/dist/procedures/pnpm/shared.js.map +1 -1
  43. package/dist/procedures/pnpm/update.d.ts +16 -0
  44. package/dist/procedures/pnpm/update.d.ts.map +1 -0
  45. package/dist/procedures/pnpm/update.js +25 -0
  46. package/dist/procedures/pnpm/update.js.map +1 -0
  47. package/dist/procedures/pnpm/why.d.ts +16 -0
  48. package/dist/procedures/pnpm/why.d.ts.map +1 -0
  49. package/dist/procedures/pnpm/why.js +20 -0
  50. package/dist/procedures/pnpm/why.js.map +1 -0
  51. package/dist/types.d.ts +86 -0
  52. package/dist/types.d.ts.map +1 -1
  53. package/dist/types.js +104 -0
  54. package/dist/types.js.map +1 -1
  55. package/package.json +4 -4
  56. package/src/index.ts +19 -0
  57. package/src/module.ts +143 -0
  58. package/src/procedures/pnpm/add.ts +2 -2
  59. package/src/procedures/pnpm/exec.ts +22 -0
  60. package/src/procedures/pnpm/index.ts +6 -0
  61. package/src/procedures/pnpm/install.ts +2 -2
  62. package/src/procedures/pnpm/list.ts +31 -0
  63. package/src/procedures/pnpm/outdated.ts +29 -0
  64. package/src/procedures/pnpm/pack.ts +25 -0
  65. package/src/procedures/pnpm/remove.ts +2 -2
  66. package/src/procedures/pnpm/run.ts +2 -2
  67. package/src/procedures/pnpm/shared.ts +44 -3
  68. package/src/procedures/pnpm/update.ts +25 -0
  69. package/src/procedures/pnpm/why.ts +23 -0
  70. package/src/types.ts +211 -0
package/src/types.ts CHANGED
@@ -23,6 +23,25 @@ export interface PnpmCommandOutput {
23
23
  duration: number;
24
24
  }
25
25
 
26
+ /** The result of a pnpm command that writes JSON: `data` is its parsed standard output. */
27
+ export interface PnpmJsonOutput extends PnpmCommandOutput {
28
+ /** The parsed JSON of the standard output. It is absent when the output is not JSON. */
29
+ data?: unknown;
30
+ }
31
+
32
+ // =============================================================================
33
+ // The selection of the workspace packages (roadmap R41)
34
+ // =============================================================================
35
+
36
+ /** `--filter=<selector>` for each selector: pnpm runs the command in the packages that match. */
37
+ const FILTER = z
38
+ .array(z.string())
39
+ .optional()
40
+ .describe("Run in the workspace packages that these pnpm selectors match, for example @scope/app or ./packages/** (--filter)");
41
+
42
+ /** `--recursive`: pnpm runs the command in each package of the workspace. */
43
+ const RECURSIVE = z.boolean().optional().describe("Run in each package of the workspace (--recursive)");
44
+
26
45
  // =============================================================================
27
46
  // pnpm.install Types
28
47
  // =============================================================================
@@ -31,6 +50,8 @@ export const PnpmInstallInputSchema: z.ZodObject<{
31
50
  packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
32
51
  dev: z.ZodOptional<z.ZodBoolean>;
33
52
  frozen: z.ZodOptional<z.ZodBoolean>;
53
+ filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
54
+ recursive: z.ZodOptional<z.ZodBoolean>;
34
55
  cwd: z.ZodOptional<z.ZodString>;
35
56
  timeout: z.ZodOptional<z.ZodNumber>;
36
57
  }> = z.object({
@@ -40,6 +61,8 @@ export const PnpmInstallInputSchema: z.ZodObject<{
40
61
  dev: z.boolean().optional().describe("Save as dev dependency"),
41
62
  /** Use frozen lockfile (--frozen-lockfile) */
42
63
  frozen: z.boolean().optional().describe("Use frozen lockfile (--frozen-lockfile)"),
64
+ filter: FILTER,
65
+ recursive: RECURSIVE,
43
66
  /** Working directory */
44
67
  cwd: z.string().optional().describe("Working directory"),
45
68
  /** Timeout in milliseconds */
@@ -56,6 +79,8 @@ export const PnpmAddInputSchema: z.ZodObject<{
56
79
  packages: z.ZodArray<z.ZodString>;
57
80
  dev: z.ZodOptional<z.ZodBoolean>;
58
81
  global: z.ZodOptional<z.ZodBoolean>;
82
+ filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
83
+ recursive: z.ZodOptional<z.ZodBoolean>;
59
84
  cwd: z.ZodOptional<z.ZodString>;
60
85
  timeout: z.ZodOptional<z.ZodNumber>;
61
86
  }> = z.object({
@@ -65,6 +90,8 @@ export const PnpmAddInputSchema: z.ZodObject<{
65
90
  dev: z.boolean().optional().describe("Save as dev dependency"),
66
91
  /** Install globally */
67
92
  global: z.boolean().optional().describe("Install globally"),
93
+ filter: FILTER,
94
+ recursive: RECURSIVE,
68
95
  /** Working directory */
69
96
  cwd: z.string().optional().describe("Working directory"),
70
97
  /** Timeout in milliseconds */
@@ -80,6 +107,8 @@ export type PnpmAddInput = z.infer<typeof PnpmAddInputSchema>;
80
107
  export const PnpmRemoveInputSchema: z.ZodObject<{
81
108
  packages: z.ZodArray<z.ZodString>;
82
109
  global: z.ZodOptional<z.ZodBoolean>;
110
+ filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
+ recursive: z.ZodOptional<z.ZodBoolean>;
83
112
  cwd: z.ZodOptional<z.ZodString>;
84
113
  timeout: z.ZodOptional<z.ZodNumber>;
85
114
  }> = z.object({
@@ -87,6 +116,8 @@ export const PnpmRemoveInputSchema: z.ZodObject<{
87
116
  packages: z.array(z.string()).describe("Packages to remove"),
88
117
  /** Remove from global */
89
118
  global: z.boolean().optional().describe("Remove from global"),
119
+ filter: FILTER,
120
+ recursive: RECURSIVE,
90
121
  /** Working directory */
91
122
  cwd: z.string().optional().describe("Working directory"),
92
123
  /** Timeout in milliseconds */
@@ -124,6 +155,8 @@ export type PnpmLinkInput = z.infer<typeof PnpmLinkInputSchema>;
124
155
  export const PnpmRunInputSchema: z.ZodObject<{
125
156
  script: z.ZodString;
126
157
  args: z.ZodOptional<z.ZodArray<z.ZodString>>;
158
+ filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
159
+ recursive: z.ZodOptional<z.ZodBoolean>;
127
160
  cwd: z.ZodOptional<z.ZodString>;
128
161
  timeout: z.ZodOptional<z.ZodNumber>;
129
162
  }> = z.object({
@@ -131,6 +164,8 @@ export const PnpmRunInputSchema: z.ZodObject<{
131
164
  script: z.string().describe("Script name to run"),
132
165
  /** Additional arguments to pass to the script */
133
166
  args: z.array(z.string()).optional().describe("Additional arguments to pass to the script"),
167
+ filter: FILTER,
168
+ recursive: RECURSIVE,
134
169
  /** Working directory */
135
170
  cwd: z.string().optional().describe("Working directory"),
136
171
  /** Timeout in milliseconds */
@@ -178,3 +213,179 @@ export const PnpmStorePathOutputSchema: z.ZodType<PnpmStorePathOutput> = z.loose
178
213
  exists: z.boolean().describe("True when the store folder exists"),
179
214
  platform: z.string().describe("The platform (win32, darwin, linux)"),
180
215
  });
216
+
217
+ /** The result of a pnpm command that writes JSON: list, why, outdated and pack give it. */
218
+ export const PnpmJsonOutputSchema: z.ZodType<PnpmJsonOutput> = z.looseObject({
219
+ exitCode: z.number().describe("The exit code of pnpm (0 is success)"),
220
+ stdout: z.string().describe("The standard output of pnpm"),
221
+ stderr: z.string().describe("The standard error of pnpm"),
222
+ success: z.boolean().describe("True when the command succeeded"),
223
+ duration: z.number().describe("The time of the command, in milliseconds"),
224
+ data: z.unknown().optional().describe("The parsed JSON of the standard output, when it is JSON"),
225
+ });
226
+
227
+ // =============================================================================
228
+ // pnpm.exec Types - Run a program of the dependencies (roadmap R41)
229
+ // =============================================================================
230
+
231
+ export const PnpmExecInputSchema: z.ZodObject<{
232
+ command: z.ZodString;
233
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
234
+ filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
235
+ recursive: z.ZodOptional<z.ZodBoolean>;
236
+ cwd: z.ZodOptional<z.ZodString>;
237
+ timeout: z.ZodOptional<z.ZodNumber>;
238
+ }> = z.object({
239
+ command: z.string().describe("The program, for example tsc or eslint. pnpm finds it in node_modules/.bin"),
240
+ args: z.array(z.string()).optional().describe("The arguments of the program. No shell reads them"),
241
+ filter: FILTER,
242
+ recursive: RECURSIVE,
243
+ cwd: z.string().optional().describe("Working directory"),
244
+ timeout: z.number().optional().describe("Timeout in milliseconds"),
245
+ });
246
+
247
+ export type PnpmExecInput = z.infer<typeof PnpmExecInputSchema>;
248
+
249
+ export type PnpmExecOutput = PnpmCommandOutput;
250
+
251
+ export const PnpmExecOutputSchema: z.ZodType<PnpmExecOutput> = PnpmCommandOutputSchema;
252
+
253
+ // =============================================================================
254
+ // pnpm.list Types - The installed packages as JSON (roadmap R41)
255
+ // =============================================================================
256
+
257
+ export const PnpmListInputSchema: z.ZodObject<{
258
+ packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
259
+ depth: z.ZodOptional<z.ZodNumber>;
260
+ prod: z.ZodOptional<z.ZodBoolean>;
261
+ dev: z.ZodOptional<z.ZodBoolean>;
262
+ filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
263
+ recursive: z.ZodOptional<z.ZodBoolean>;
264
+ cwd: z.ZodOptional<z.ZodString>;
265
+ timeout: z.ZodOptional<z.ZodNumber>;
266
+ }> = z.object({
267
+ packages: z.array(z.string()).optional().describe("List only these packages (names or patterns)"),
268
+ depth: z.number().int().min(0).optional().describe("The depth of the dependency tree (default: 0, the direct dependencies)"),
269
+ prod: z.boolean().optional().describe("Only the dependencies, not the dev dependencies (--prod)"),
270
+ dev: z.boolean().optional().describe("Only the dev dependencies (--dev)"),
271
+ filter: FILTER,
272
+ recursive: RECURSIVE,
273
+ cwd: z.string().optional().describe("Working directory"),
274
+ timeout: z.number().optional().describe("Timeout in milliseconds"),
275
+ });
276
+
277
+ export type PnpmListInput = z.infer<typeof PnpmListInputSchema>;
278
+
279
+ export type PnpmListOutput = PnpmJsonOutput;
280
+
281
+ export const PnpmListOutputSchema: z.ZodType<PnpmListOutput> = PnpmJsonOutputSchema;
282
+
283
+ // =============================================================================
284
+ // pnpm.why Types - Why a package is installed (roadmap R41)
285
+ // =============================================================================
286
+
287
+ export const PnpmWhyInputSchema: z.ZodObject<{
288
+ packages: z.ZodArray<z.ZodString>;
289
+ depth: z.ZodOptional<z.ZodNumber>;
290
+ prod: z.ZodOptional<z.ZodBoolean>;
291
+ dev: z.ZodOptional<z.ZodBoolean>;
292
+ filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
293
+ recursive: z.ZodOptional<z.ZodBoolean>;
294
+ cwd: z.ZodOptional<z.ZodString>;
295
+ timeout: z.ZodOptional<z.ZodNumber>;
296
+ }> = z.object({
297
+ packages: z.array(z.string()).min(1).describe("The packages (names or patterns)"),
298
+ depth: z.number().int().min(0).optional().describe("The depth of the dependency tree"),
299
+ prod: z.boolean().optional().describe("Only the dependencies, not the dev dependencies (--prod)"),
300
+ dev: z.boolean().optional().describe("Only the dev dependencies (--dev)"),
301
+ filter: FILTER,
302
+ recursive: RECURSIVE,
303
+ cwd: z.string().optional().describe("Working directory"),
304
+ timeout: z.number().optional().describe("Timeout in milliseconds"),
305
+ });
306
+
307
+ export type PnpmWhyInput = z.infer<typeof PnpmWhyInputSchema>;
308
+
309
+ export type PnpmWhyOutput = PnpmJsonOutput;
310
+
311
+ export const PnpmWhyOutputSchema: z.ZodType<PnpmWhyOutput> = PnpmJsonOutputSchema;
312
+
313
+ // =============================================================================
314
+ // pnpm.outdated Types - The outdated packages (roadmap R41)
315
+ // =============================================================================
316
+
317
+ export const PnpmOutdatedInputSchema: z.ZodObject<{
318
+ packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
319
+ prod: z.ZodOptional<z.ZodBoolean>;
320
+ dev: z.ZodOptional<z.ZodBoolean>;
321
+ filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
322
+ recursive: z.ZodOptional<z.ZodBoolean>;
323
+ cwd: z.ZodOptional<z.ZodString>;
324
+ timeout: z.ZodOptional<z.ZodNumber>;
325
+ }> = z.object({
326
+ packages: z.array(z.string()).optional().describe("Examine only these packages (names or patterns)"),
327
+ prod: z.boolean().optional().describe("Only the dependencies, not the dev dependencies (--prod)"),
328
+ dev: z.boolean().optional().describe("Only the dev dependencies (--dev)"),
329
+ filter: FILTER,
330
+ recursive: RECURSIVE,
331
+ cwd: z.string().optional().describe("Working directory"),
332
+ timeout: z.number().optional().describe("Timeout in milliseconds"),
333
+ });
334
+
335
+ export type PnpmOutdatedInput = z.infer<typeof PnpmOutdatedInputSchema>;
336
+
337
+ export type PnpmOutdatedOutput = PnpmJsonOutput;
338
+
339
+ export const PnpmOutdatedOutputSchema: z.ZodType<PnpmOutdatedOutput> = PnpmJsonOutputSchema;
340
+
341
+ // =============================================================================
342
+ // pnpm.update Types - Update packages (roadmap R41)
343
+ // =============================================================================
344
+
345
+ export const PnpmUpdateInputSchema: z.ZodObject<{
346
+ packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
347
+ latest: z.ZodOptional<z.ZodBoolean>;
348
+ prod: z.ZodOptional<z.ZodBoolean>;
349
+ dev: z.ZodOptional<z.ZodBoolean>;
350
+ filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
351
+ recursive: z.ZodOptional<z.ZodBoolean>;
352
+ cwd: z.ZodOptional<z.ZodString>;
353
+ timeout: z.ZodOptional<z.ZodNumber>;
354
+ }> = z.object({
355
+ packages: z.array(z.string()).optional().describe("Update only these packages (names or patterns). Default: all"),
356
+ latest: z.boolean().optional().describe("Update to the latest versions, also out of the ranges of package.json (--latest)"),
357
+ prod: z.boolean().optional().describe("Only the dependencies, not the dev dependencies (--prod)"),
358
+ dev: z.boolean().optional().describe("Only the dev dependencies (--dev)"),
359
+ filter: FILTER,
360
+ recursive: RECURSIVE,
361
+ cwd: z.string().optional().describe("Working directory"),
362
+ timeout: z.number().optional().describe("Timeout in milliseconds"),
363
+ });
364
+
365
+ export type PnpmUpdateInput = z.infer<typeof PnpmUpdateInputSchema>;
366
+
367
+ export type PnpmUpdateOutput = PnpmCommandOutput;
368
+
369
+ export const PnpmUpdateOutputSchema: z.ZodType<PnpmUpdateOutput> = PnpmCommandOutputSchema;
370
+
371
+ // =============================================================================
372
+ // pnpm.pack Types - A tarball of the package (roadmap R41)
373
+ // =============================================================================
374
+
375
+ export const PnpmPackInputSchema: z.ZodObject<{
376
+ destination: z.ZodOptional<z.ZodString>;
377
+ dryRun: z.ZodOptional<z.ZodBoolean>;
378
+ cwd: z.ZodOptional<z.ZodString>;
379
+ timeout: z.ZodOptional<z.ZodNumber>;
380
+ }> = z.object({
381
+ destination: z.string().optional().describe("The folder of the tarball (default: the folder of the package)"),
382
+ dryRun: z.boolean().optional().describe("Give the files of the tarball, and write no tarball (--dry-run, default: false)"),
383
+ cwd: z.string().optional().describe("The folder of the package"),
384
+ timeout: z.number().optional().describe("Timeout in milliseconds"),
385
+ });
386
+
387
+ export type PnpmPackInput = z.infer<typeof PnpmPackInputSchema>;
388
+
389
+ export type PnpmPackOutput = PnpmJsonOutput;
390
+
391
+ export const PnpmPackOutputSchema: z.ZodType<PnpmPackOutput> = PnpmJsonOutputSchema;