@vltpkg/cli-sdk 0.0.0-8 → 1.0.0-rc.1

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 (164) hide show
  1. package/dist/esm/commands/build.d.ts +25 -0
  2. package/dist/esm/commands/build.d.ts.map +1 -0
  3. package/dist/esm/commands/build.js +102 -0
  4. package/dist/esm/commands/build.js.map +1 -0
  5. package/dist/esm/commands/cache.d.ts +65 -0
  6. package/dist/esm/commands/cache.d.ts.map +1 -0
  7. package/dist/esm/commands/cache.js +257 -0
  8. package/dist/esm/commands/cache.js.map +1 -0
  9. package/dist/esm/commands/ci.d.ts +11 -0
  10. package/dist/esm/commands/ci.d.ts.map +1 -0
  11. package/dist/esm/commands/ci.js +32 -0
  12. package/dist/esm/commands/ci.js.map +1 -0
  13. package/dist/esm/commands/config.d.ts +3 -2
  14. package/dist/esm/commands/config.d.ts.map +1 -1
  15. package/dist/esm/commands/config.js +372 -101
  16. package/dist/esm/commands/config.js.map +1 -1
  17. package/dist/esm/commands/docs.d.ts +18 -0
  18. package/dist/esm/commands/docs.d.ts.map +1 -0
  19. package/dist/esm/commands/docs.js +154 -0
  20. package/dist/esm/commands/docs.js.map +1 -0
  21. package/dist/esm/commands/exec-cache.d.ts +49 -0
  22. package/dist/esm/commands/exec-cache.d.ts.map +1 -0
  23. package/dist/esm/commands/exec-cache.js +146 -0
  24. package/dist/esm/commands/exec-cache.js.map +1 -0
  25. package/dist/esm/commands/exec-local.d.ts +6 -0
  26. package/dist/esm/commands/exec-local.d.ts.map +1 -0
  27. package/dist/esm/commands/exec-local.js +24 -0
  28. package/dist/esm/commands/exec-local.js.map +1 -0
  29. package/dist/esm/commands/exec.d.ts +4 -0
  30. package/dist/esm/commands/exec.d.ts.map +1 -1
  31. package/dist/esm/commands/exec.js +75 -10
  32. package/dist/esm/commands/exec.js.map +1 -1
  33. package/dist/esm/commands/help.d.ts +1 -1
  34. package/dist/esm/commands/help.d.ts.map +1 -1
  35. package/dist/esm/commands/help.js +32 -3
  36. package/dist/esm/commands/help.js.map +1 -1
  37. package/dist/esm/commands/init.d.ts +4 -5
  38. package/dist/esm/commands/init.d.ts.map +1 -1
  39. package/dist/esm/commands/init.js +95 -9
  40. package/dist/esm/commands/init.js.map +1 -1
  41. package/dist/esm/commands/install/reporter.d.ts +3 -2
  42. package/dist/esm/commands/install/reporter.d.ts.map +1 -1
  43. package/dist/esm/commands/install/reporter.js +43 -15
  44. package/dist/esm/commands/install/reporter.js.map +1 -1
  45. package/dist/esm/commands/install.d.ts +24 -3
  46. package/dist/esm/commands/install.d.ts.map +1 -1
  47. package/dist/esm/commands/install.js +27 -3
  48. package/dist/esm/commands/install.js.map +1 -1
  49. package/dist/esm/commands/list.d.ts +2 -2
  50. package/dist/esm/commands/list.d.ts.map +1 -1
  51. package/dist/esm/commands/list.js +149 -49
  52. package/dist/esm/commands/list.js.map +1 -1
  53. package/dist/esm/commands/pack.d.ts +32 -0
  54. package/dist/esm/commands/pack.d.ts.map +1 -0
  55. package/dist/esm/commands/pack.js +147 -0
  56. package/dist/esm/commands/pack.js.map +1 -0
  57. package/dist/esm/commands/pkg.d.ts +2 -3
  58. package/dist/esm/commands/pkg.d.ts.map +1 -1
  59. package/dist/esm/commands/pkg.js +123 -38
  60. package/dist/esm/commands/pkg.js.map +1 -1
  61. package/dist/esm/commands/publish.d.ts +22 -0
  62. package/dist/esm/commands/publish.d.ts.map +1 -0
  63. package/dist/esm/commands/publish.js +245 -0
  64. package/dist/esm/commands/publish.js.map +1 -0
  65. package/dist/esm/commands/query.d.ts +2 -2
  66. package/dist/esm/commands/query.d.ts.map +1 -1
  67. package/dist/esm/commands/query.js +170 -39
  68. package/dist/esm/commands/query.js.map +1 -1
  69. package/dist/esm/commands/run-exec.d.ts +1 -0
  70. package/dist/esm/commands/run-exec.d.ts.map +1 -1
  71. package/dist/esm/commands/run-exec.js +1 -0
  72. package/dist/esm/commands/run-exec.js.map +1 -1
  73. package/dist/esm/commands/run.d.ts +1 -0
  74. package/dist/esm/commands/run.d.ts.map +1 -1
  75. package/dist/esm/commands/run.js +13 -16
  76. package/dist/esm/commands/run.js.map +1 -1
  77. package/dist/esm/commands/serve.d.ts +14 -0
  78. package/dist/esm/commands/serve.d.ts.map +1 -0
  79. package/dist/esm/commands/serve.js +103 -0
  80. package/dist/esm/commands/serve.js.map +1 -0
  81. package/dist/esm/commands/uninstall.d.ts +12 -3
  82. package/dist/esm/commands/uninstall.d.ts.map +1 -1
  83. package/dist/esm/commands/uninstall.js +8 -3
  84. package/dist/esm/commands/uninstall.js.map +1 -1
  85. package/dist/esm/commands/update.d.ts +14 -0
  86. package/dist/esm/commands/update.d.ts.map +1 -0
  87. package/dist/esm/commands/update.js +41 -0
  88. package/dist/esm/commands/update.js.map +1 -0
  89. package/dist/esm/commands/version.d.ts +26 -0
  90. package/dist/esm/commands/version.d.ts.map +1 -0
  91. package/dist/esm/commands/version.js +226 -0
  92. package/dist/esm/commands/version.js.map +1 -0
  93. package/dist/esm/commands/whoami.d.ts +4 -2
  94. package/dist/esm/commands/whoami.d.ts.map +1 -1
  95. package/dist/esm/commands/whoami.js +1 -1
  96. package/dist/esm/commands/whoami.js.map +1 -1
  97. package/dist/esm/config/definition.d.ts +123 -11
  98. package/dist/esm/config/definition.d.ts.map +1 -1
  99. package/dist/esm/config/definition.js +197 -34
  100. package/dist/esm/config/definition.js.map +1 -1
  101. package/dist/esm/config/index.d.ts +42 -37
  102. package/dist/esm/config/index.d.ts.map +1 -1
  103. package/dist/esm/config/index.js +116 -172
  104. package/dist/esm/config/index.js.map +1 -1
  105. package/dist/esm/config/merge.d.ts +3 -1
  106. package/dist/esm/config/merge.d.ts.map +1 -1
  107. package/dist/esm/config/merge.js +11 -6
  108. package/dist/esm/config/merge.js.map +1 -1
  109. package/dist/esm/config/usage.d.ts +3 -2
  110. package/dist/esm/config/usage.d.ts.map +1 -1
  111. package/dist/esm/config/usage.js.map +1 -1
  112. package/dist/esm/custom-help.d.ts +9 -0
  113. package/dist/esm/custom-help.d.ts.map +1 -0
  114. package/dist/esm/custom-help.js +400 -0
  115. package/dist/esm/custom-help.js.map +1 -0
  116. package/dist/esm/exec-command.d.ts +33 -14
  117. package/dist/esm/exec-command.d.ts.map +1 -1
  118. package/dist/esm/exec-command.js +214 -65
  119. package/dist/esm/exec-command.js.map +1 -1
  120. package/dist/esm/index.d.ts +1 -14
  121. package/dist/esm/index.d.ts.map +1 -1
  122. package/dist/esm/index.js +46 -20
  123. package/dist/esm/index.js.map +1 -1
  124. package/dist/esm/load-command.d.ts +16 -0
  125. package/dist/esm/load-command.d.ts.map +1 -0
  126. package/dist/esm/load-command.js +21 -0
  127. package/dist/esm/load-command.js.map +1 -0
  128. package/dist/esm/output.d.ts +6 -10
  129. package/dist/esm/output.d.ts.map +1 -1
  130. package/dist/esm/output.js +73 -35
  131. package/dist/esm/output.js.map +1 -1
  132. package/dist/esm/pack-tarball.d.ts +22 -0
  133. package/dist/esm/pack-tarball.d.ts.map +1 -0
  134. package/dist/esm/pack-tarball.js +249 -0
  135. package/dist/esm/pack-tarball.js.map +1 -0
  136. package/dist/esm/parse-add-remove-args.d.ts +1 -1
  137. package/dist/esm/parse-add-remove-args.d.ts.map +1 -1
  138. package/dist/esm/parse-add-remove-args.js +1 -1
  139. package/dist/esm/parse-add-remove-args.js.map +1 -1
  140. package/dist/esm/print-err.d.ts +12 -1
  141. package/dist/esm/print-err.d.ts.map +1 -1
  142. package/dist/esm/print-err.js +157 -26
  143. package/dist/esm/print-err.js.map +1 -1
  144. package/dist/esm/query-host-contexts.d.ts +16 -0
  145. package/dist/esm/query-host-contexts.d.ts.map +1 -0
  146. package/dist/esm/query-host-contexts.js +135 -0
  147. package/dist/esm/query-host-contexts.js.map +1 -0
  148. package/dist/esm/start-gui.d.ts +1 -0
  149. package/dist/esm/start-gui.d.ts.map +1 -1
  150. package/dist/esm/start-gui.js +25 -6
  151. package/dist/esm/start-gui.js.map +1 -1
  152. package/dist/esm/view.d.ts +2 -3
  153. package/dist/esm/view.d.ts.map +1 -1
  154. package/dist/esm/view.js +1 -1
  155. package/dist/esm/view.js.map +1 -1
  156. package/package.json +51 -35
  157. package/dist/esm/commands/gui.d.ts +0 -6
  158. package/dist/esm/commands/gui.d.ts.map +0 -1
  159. package/dist/esm/commands/gui.js +0 -13
  160. package/dist/esm/commands/gui.js.map +0 -1
  161. package/dist/esm/commands/install-exec.d.ts +0 -4
  162. package/dist/esm/commands/install-exec.d.ts.map +0 -1
  163. package/dist/esm/commands/install-exec.js +0 -13
  164. package/dist/esm/commands/install-exec.js.map +0 -1
@@ -0,0 +1,25 @@
1
+ import type { BuildResult } from '@vltpkg/graph';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
3
+ export declare const views: {
4
+ readonly human: (result: BuildResult) => string;
5
+ readonly json: (result: BuildResult) => {
6
+ success: {
7
+ id: import("@vltpkg/dep-id").DepID;
8
+ name: string;
9
+ version: string | undefined;
10
+ }[];
11
+ failure: {
12
+ id: import("@vltpkg/dep-id").DepID;
13
+ name: string;
14
+ version: string | undefined;
15
+ }[];
16
+ message: string;
17
+ };
18
+ };
19
+ export declare const usage: CommandUsage;
20
+ /**
21
+ * Build command implementation. Runs any required "postinstall"
22
+ * lifecycle scripts and binary linking.
23
+ */
24
+ export declare const command: CommandFn<BuildResult>;
25
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAQ,MAAM,eAAe,CAAA;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1D,eAAO,MAAM,KAAK;6BACA,WAAW,KAAG,MAAM;4BAqBrB,WAAW;;;;;;;;;;;;;CAqBW,CAAA;AAEvC,eAAO,MAAM,KAAK,EAAE,YAsBhB,CAAA;AAWJ;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,WAAW,CAqC1C,CAAA"}
@@ -0,0 +1,102 @@
1
+ import { build } from '@vltpkg/graph';
2
+ import { error } from '@vltpkg/error-cause';
3
+ import { commandUsage } from "../config/usage.js";
4
+ import { isErrorWithCause } from '@vltpkg/types';
5
+ export const views = {
6
+ human: (result) => {
7
+ const successCount = result.success.length;
8
+ const failureCount = result.failure.length;
9
+ const messages = [];
10
+ if (successCount > 0) {
11
+ messages.push(`🔨 Built ${successCount} package${successCount === 1 ? '' : 's'} successfully.`);
12
+ }
13
+ else {
14
+ messages.push('📦 All packages are already built.');
15
+ }
16
+ if (failureCount > 0) {
17
+ messages.push(`🔎 ${failureCount} optional package${ /* c8 ignore next */failureCount === 1 ? '' : 's'} failed to build.`);
18
+ }
19
+ return messages.join('\n');
20
+ },
21
+ json: (result) => {
22
+ const successList = result.success.map(node => ({
23
+ id: node.id,
24
+ name: node.name,
25
+ version: node.version,
26
+ }));
27
+ const failureList = result.failure.map(node => ({
28
+ id: node.id,
29
+ name: node.name,
30
+ version: node.version,
31
+ }));
32
+ return {
33
+ success: successList,
34
+ failure: failureList,
35
+ message: successList.length > 0 ?
36
+ `Built ${successList.length} package${successList.length === 1 ? '' : 's'}.`
37
+ : 'No packages needed building.',
38
+ };
39
+ },
40
+ };
41
+ export const usage = () => commandUsage({
42
+ command: 'build',
43
+ usage: ['[query]', '[--target=<query>]'],
44
+ description: `Build the project based on the current dependency graph.
45
+
46
+ This command processes the installed packages in node_modules and runs
47
+ any necessary build steps, such as lifecycle scripts and binary linking.
48
+
49
+ The build process is idempotent and will only perform work that is
50
+ actually needed based on the current state of the dependency graph.
51
+
52
+ Use --target option or provide a query as a positional argument to filter
53
+ packages using DSS query language syntax, otherwise it will target
54
+ all packages with scripts (:scripts) by default.`,
55
+ options: {
56
+ target: {
57
+ value: '<query>',
58
+ description: 'Query selector to filter packages using DSS syntax.',
59
+ },
60
+ },
61
+ });
62
+ const isGraphRunError = (error) => typeof error === 'object' &&
63
+ error !== null &&
64
+ 'code' in error &&
65
+ error.code === 'GRAPHRUN_TRAVERSAL' &&
66
+ 'node' in error;
67
+ /**
68
+ * Build command implementation. Runs any required "postinstall"
69
+ * lifecycle scripts and binary linking.
70
+ */
71
+ export const command = async (conf) => {
72
+ const { options, projectRoot } = conf;
73
+ try {
74
+ // Get target from option or first positional, default to all scripts
75
+ const targetOption = conf.get('target');
76
+ const targetPositional = conf.positionals[0];
77
+ const target = targetOption ||
78
+ targetPositional ||
79
+ ':scripts:not(:built):not(:malware)';
80
+ // Run the build process using the graph build function
81
+ const result = await build({
82
+ ...options,
83
+ projectRoot,
84
+ packageJson: options.packageJson,
85
+ monorepo: options.monorepo,
86
+ scurry: options.scurry,
87
+ target,
88
+ });
89
+ return result;
90
+ }
91
+ catch (cause) {
92
+ const graphRunError = isErrorWithCause(cause) && isGraphRunError(cause.cause) ?
93
+ cause.cause
94
+ : undefined;
95
+ if (graphRunError?.code === 'GRAPHRUN_TRAVERSAL') {
96
+ throw error('Build failed:\n Failed to build package: ' +
97
+ `${graphRunError.node.name}@${graphRunError.node.version}`, { cause });
98
+ }
99
+ throw error('Build failed', { cause });
100
+ }
101
+ };
102
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,EAAE,CAAC,MAAmB,EAAU,EAAE;QACrC,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAA;QAC1C,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAA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AEF,OAAO,MAAM,CAAA;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,aAAa,GACjB,gBAAgB,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YACvD,KAAK,CAAC,KAAK;YACb,CAAC,CAAC,SAAS,CAAA;QACb,IAAI,aAAa,EAAE,IAAI,KAAK,oBAAoB,EAAE,CAAC;YACjD,MAAM,KAAK,CACT,4CAA4C;gBAC1C,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,EAC5D,EAAE,KAAK,EAAE,CACV,CAAA;QACH,CAAC;QACD,MAAM,KAAK,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IACxC,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { build } from '@vltpkg/graph'\nimport type { BuildResult, Node } from '@vltpkg/graph'\nimport { error } from '@vltpkg/error-cause'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport type { Views } from '../view.ts'\nimport { isErrorWithCause } from '@vltpkg/types'\n\nexport const views = {\n human: (result: BuildResult): string => {\n const successCount = result.success.length\n const failureCount = result.failure.length\n const messages: string[] = []\n\n if (successCount > 0) {\n messages.push(\n `🔨 Built ${successCount} package${successCount === 1 ? '' : 's'} successfully.`,\n )\n } else {\n messages.push('📦 All packages are already built.')\n }\n\n if (failureCount > 0) {\n messages.push(\n `🔎 ${failureCount} optional package${/* c8 ignore next */ failureCount === 1 ? '' : 's'} failed to build.`,\n )\n }\n\n return messages.join('\\n')\n },\n json: (result: BuildResult) => {\n const successList = result.success.map(node => ({\n id: node.id,\n name: node.name,\n version: node.version,\n }))\n const failureList = result.failure.map(node => ({\n id: node.id,\n name: node.name,\n version: node.version,\n }))\n\n return {\n success: successList,\n failure: failureList,\n message:\n successList.length > 0 ?\n `Built ${successList.length} package${successList.length === 1 ? '' : 's'}.`\n : 'No packages needed building.',\n }\n },\n} as const satisfies Views<BuildResult>\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'build',\n usage: ['[query]', '[--target=<query>]'],\n description: `Build the project based on the current dependency graph.\n\n This command processes the installed packages in node_modules and runs\n any necessary build steps, such as lifecycle scripts and binary linking.\n \n The build process is idempotent and will only perform work that is\n actually needed based on the current state of the dependency graph.\n \n Use --target option or provide a query as a positional argument to filter\n packages using DSS query language syntax, otherwise it will target\n all packages with scripts (:scripts) by default.`,\n options: {\n target: {\n value: '<query>',\n description:\n 'Query selector to filter packages using DSS syntax.',\n },\n },\n })\n\nconst isGraphRunError = (\n error: unknown,\n): error is Error & { code: string; node: Node } =>\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n error.code === 'GRAPHRUN_TRAVERSAL' &&\n 'node' in error\n\n/**\n * Build command implementation. Runs any required \"postinstall\"\n * lifecycle scripts and binary linking.\n */\nexport const command: CommandFn<BuildResult> = async conf => {\n const { options, projectRoot } = conf\n\n try {\n // Get target from option or first positional, default to all scripts\n const targetOption = conf.get('target')\n const targetPositional = conf.positionals[0]\n const target =\n targetOption ||\n targetPositional ||\n ':scripts:not(:built):not(:malware)'\n\n // Run the build process using the graph build function\n const result = await build({\n ...options,\n projectRoot,\n packageJson: options.packageJson,\n monorepo: options.monorepo,\n scurry: options.scurry,\n target,\n })\n\n return result\n } catch (cause) {\n const graphRunError =\n isErrorWithCause(cause) && isGraphRunError(cause.cause) ?\n cause.cause\n : undefined\n if (graphRunError?.code === 'GRAPHRUN_TRAVERSAL') {\n throw error(\n 'Build failed:\\n Failed to build package: ' +\n `${graphRunError.node.name}@${graphRunError.node.version}`,\n { cause },\n )\n }\n throw error('Build failed', { cause })\n }\n}\n"]}
@@ -0,0 +1,65 @@
1
+ import { CacheEntry } from '@vltpkg/registry-client';
2
+ import type { LoadedConfig } from '../config/index.ts';
3
+ import type { CommandFn, CommandUsage } from '../index.ts';
4
+ import type { ViewOptions, Views } from '../view.ts';
5
+ import { ViewClass } from '../view.ts';
6
+ export type CacheMap = Record<string, ReturnType<CacheEntry['toJSON']>>;
7
+ export type CacheSubcommands = keyof (typeof usageDef)['subcommands'];
8
+ export declare class CacheView extends ViewClass {
9
+ constructor(options: ViewOptions, conf: LoadedConfig);
10
+ stdout(...args: unknown[]): void;
11
+ }
12
+ export declare const views: Views<void | CacheMap>;
13
+ declare const usageDef: {
14
+ readonly command: "cache";
15
+ readonly usage: "<command> [flags]";
16
+ readonly description: "Work with vlt cache folders";
17
+ readonly subcommands: {
18
+ readonly add: {
19
+ readonly usage: "<package-spec> [<package-spec>...]";
20
+ readonly description: "Resolve the referenced package identifiers and ensure they\n are cached.";
21
+ };
22
+ readonly ls: {
23
+ readonly usage: "[<key>...]";
24
+ readonly description: "Show cache entries. If no keys are provided, then a list of\n available keys will be printed. If one or more keys are\n provided, then details will be shown for the specified\n items.";
25
+ };
26
+ readonly info: {
27
+ readonly usage: "<key>";
28
+ readonly description: "Print metadata details for the specified cache key to\n stderr, and the response body to stdout.";
29
+ };
30
+ readonly clean: {
31
+ readonly usage: "[<key>...]";
32
+ readonly description: "Purge expired cache entries. If one or more keys are\n provided, then only those cache entries will be\n considered.";
33
+ };
34
+ readonly delete: {
35
+ readonly usage: "<key> [<key>...]";
36
+ readonly description: "Purge items explicitly, whether expired or not. If one or\n more keys are provided, then only those cache entries will\n be considered.";
37
+ };
38
+ readonly 'delete-before': {
39
+ readonly usage: "<date>";
40
+ readonly description: "Purge all cache items from before a given date. Date can be\n provided in any format that JavaScript can parse.";
41
+ };
42
+ readonly 'delete-all': {
43
+ readonly usage: "";
44
+ readonly description: "Delete the entire cache folder to make vlt slower.";
45
+ };
46
+ };
47
+ readonly examples: {
48
+ readonly 'vlt cache ls https://registry.npmjs.org/typescript': {
49
+ readonly description: "Show cache metadata for a given registry URL";
50
+ };
51
+ readonly 'vlt cache add eslint@latest': {
52
+ readonly description: "Add a given package specifier to the cache by fetching\n its resolved value.";
53
+ };
54
+ readonly 'vlt cache info https://registry.npmjs.org/eslint/-/eslint-9.25.1.tgz > eslint.tgz': {
55
+ readonly description: "Print the cache metadata to stderr, and write the tarball\n on stdout, redirecting to a file.";
56
+ };
57
+ readonly 'vlt cache delete-before 2025-01-01': {
58
+ readonly description: "Delete all entries created before Jan 1, 2025";
59
+ };
60
+ };
61
+ };
62
+ export declare const usage: CommandUsage;
63
+ export declare const command: CommandFn<void | CacheMap>;
64
+ export {};
65
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/commands/cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAIpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAC3B,MAAM,EACN,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CACjC,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAA;AAGrE,qBAAa,SAAU,SAAQ,SAAS;gBAC1B,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY;IAIpD,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;CAG1B;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,IAAI,GAAG,QAAQ,CAExC,CAAA;AAED,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE6B,CAAA;AAE3C,eAAO,MAAM,KAAK,EAAE,YAA2C,CAAA;AAE/D,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,IAAI,GAAG,QAAQ,CAgC9C,CAAA"}
@@ -0,0 +1,257 @@
1
+ import { error } from '@vltpkg/error-cause';
2
+ import { CacheEntry } from '@vltpkg/registry-client';
3
+ import { Spec } from '@vltpkg/spec';
4
+ import { mkdir, rm } from 'node:fs/promises';
5
+ import prettyBytes from 'pretty-bytes';
6
+ import { commandUsage } from "../config/usage.js";
7
+ import { stderr, stdout } from "../output.js";
8
+ import { ViewClass } from "../view.js";
9
+ let view;
10
+ export class CacheView extends ViewClass {
11
+ constructor(options, conf) {
12
+ super(options, conf);
13
+ view = this;
14
+ }
15
+ stdout(...args) {
16
+ stdout(...args);
17
+ }
18
+ }
19
+ export const views = {
20
+ human: CacheView,
21
+ };
22
+ const usageDef = {
23
+ command: 'cache',
24
+ usage: '<command> [flags]',
25
+ description: 'Work with vlt cache folders',
26
+ subcommands: {
27
+ add: {
28
+ usage: '<package-spec> [<package-spec>...]',
29
+ description: `Resolve the referenced package identifiers and ensure they
30
+ are cached.`,
31
+ },
32
+ ls: {
33
+ usage: '[<key>...]',
34
+ description: `Show cache entries. If no keys are provided, then a list of
35
+ available keys will be printed. If one or more keys are
36
+ provided, then details will be shown for the specified
37
+ items.`,
38
+ },
39
+ info: {
40
+ usage: '<key>',
41
+ description: `Print metadata details for the specified cache key to
42
+ stderr, and the response body to stdout.`,
43
+ },
44
+ clean: {
45
+ usage: '[<key>...]',
46
+ description: `Purge expired cache entries. If one or more keys are
47
+ provided, then only those cache entries will be
48
+ considered.`,
49
+ },
50
+ delete: {
51
+ usage: '<key> [<key>...]',
52
+ description: `Purge items explicitly, whether expired or not. If one or
53
+ more keys are provided, then only those cache entries will
54
+ be considered.`,
55
+ },
56
+ 'delete-before': {
57
+ usage: '<date>',
58
+ description: `Purge all cache items from before a given date. Date can be
59
+ provided in any format that JavaScript can parse.`,
60
+ },
61
+ 'delete-all': {
62
+ usage: '',
63
+ description: `Delete the entire cache folder to make vlt slower.`,
64
+ },
65
+ },
66
+ examples: {
67
+ 'vlt cache ls https://registry.npmjs.org/typescript': {
68
+ description: `Show cache metadata for a given registry URL`,
69
+ },
70
+ 'vlt cache add eslint@latest': {
71
+ description: `Add a given package specifier to the cache by fetching
72
+ its resolved value.`,
73
+ },
74
+ 'vlt cache info https://registry.npmjs.org/eslint/-/eslint-9.25.1.tgz > eslint.tgz': {
75
+ description: `Print the cache metadata to stderr, and write the tarball
76
+ on stdout, redirecting to a file.`,
77
+ },
78
+ 'vlt cache delete-before 2025-01-01': {
79
+ description: 'Delete all entries created before Jan 1, 2025',
80
+ },
81
+ },
82
+ };
83
+ export const usage = () => commandUsage(usageDef);
84
+ export const command = async (conf) => {
85
+ const [sub, ...args] = conf.positionals;
86
+ switch (sub) {
87
+ case 'ls':
88
+ return ls(conf, args, view);
89
+ case 'info':
90
+ return info(conf, args, view);
91
+ case 'add':
92
+ return add(conf, args, view);
93
+ case 'clean':
94
+ return clean(conf, args, view);
95
+ case 'delete':
96
+ return deleteKeys(conf, args, view);
97
+ case 'delete-before':
98
+ return deleteBefore(conf, args, view);
99
+ case 'delete-all':
100
+ return deleteAll(conf, args, view);
101
+ default: {
102
+ throw error('Unrecognized cache command', {
103
+ code: 'EUSAGE',
104
+ found: sub,
105
+ validOptions: Object.keys(usageDef.subcommands),
106
+ });
107
+ }
108
+ }
109
+ };
110
+ const ls = async (conf, keys, view) => keys.length ?
111
+ await fetchKeys(conf, keys, (entry, key) => {
112
+ view?.stdout(key.includes(' ') ? JSON.stringify(key) : key, entry);
113
+ return true;
114
+ }, view)
115
+ : await fetchAll(conf, (_, key) => {
116
+ view?.stdout(key.includes(' ') ? JSON.stringify(key) : key);
117
+ return true;
118
+ });
119
+ const info = async (conf, keys, view) => {
120
+ const [key] = keys;
121
+ if (keys.length !== 1 || !key) {
122
+ throw error('Must provide exactly one cache key', {
123
+ code: 'EUSAGE',
124
+ });
125
+ }
126
+ await fetchKeys(conf, [key], (entry, key) => {
127
+ stderr(
128
+ /* c8 ignore next */
129
+ key.includes(' ') ? JSON.stringify(key) : key, entry);
130
+ if (entry.isJSON) {
131
+ stdout(JSON.stringify(entry.body, null, 2));
132
+ /* c8 ignore start - annoying to test, corrupts TAP output */
133
+ }
134
+ else {
135
+ process.stdout.write(entry.body);
136
+ }
137
+ /* c8 ignore stop */
138
+ return true;
139
+ }, view);
140
+ };
141
+ const fetchAll = async (conf, test) => {
142
+ const rc = conf.options.packageInfo.registryClient;
143
+ const { cache } = rc;
144
+ const map = {};
145
+ for await (const [key, val] of cache) {
146
+ const entry = CacheEntry.decode(val);
147
+ if (!test(entry, key, val))
148
+ continue;
149
+ map[key] = entry.toJSON();
150
+ }
151
+ return map;
152
+ };
153
+ const fetchKeys = async (conf, keys, test, view) => {
154
+ const rc = conf.options.packageInfo.registryClient;
155
+ const { cache } = rc;
156
+ const map = {};
157
+ const results = await Promise.all(keys.map(async (key) => {
158
+ return [key, await cache.fetch(key)];
159
+ }));
160
+ for (const [key, val] of results) {
161
+ if (!val) {
162
+ view?.stdout('Not found:', key);
163
+ }
164
+ else {
165
+ const entry = CacheEntry.decode(val);
166
+ if (!test(entry, key, val))
167
+ continue;
168
+ map[key] = entry.toJSON();
169
+ }
170
+ }
171
+ return map;
172
+ };
173
+ const deleteEntries = async (conf, keys, test, view) => {
174
+ const rc = conf.options.packageInfo.registryClient;
175
+ const { cache } = rc;
176
+ let count = 0;
177
+ let size = 0;
178
+ const testAction = (entry, key, val) => {
179
+ if (!test(entry)) {
180
+ return false;
181
+ }
182
+ count++;
183
+ const s = val.byteLength + key.length;
184
+ cache.delete(key, true, entry.integrity);
185
+ const k = key.includes(' ') ? JSON.stringify(key) : key;
186
+ view?.stdout('-', k, s);
187
+ size += s;
188
+ return true;
189
+ };
190
+ const map = await (keys.length ?
191
+ fetchKeys(conf, keys, testAction, view)
192
+ : fetchAll(conf, testAction));
193
+ const pb = prettyBytes(size, { binary: true });
194
+ const s = count === 1 ? '' : 's';
195
+ await cache.promise();
196
+ view?.stdout(`Removed ${count} item${s} totalling ${pb}`);
197
+ return map;
198
+ };
199
+ const clean = async (conf, keys, view) => deleteEntries(conf, keys, entry => !entry.valid, view);
200
+ const deleteBefore = async (conf, args, view) => {
201
+ if (!args.length) {
202
+ throw error('Must provide a date to delete before', {
203
+ code: 'EUSAGE',
204
+ });
205
+ }
206
+ const now = new Date();
207
+ const before = new Date(args.join(' '));
208
+ if (before >= now) {
209
+ throw error('Cannot delete cache entries from the future', {
210
+ code: 'EUSAGE',
211
+ found: before,
212
+ });
213
+ }
214
+ return deleteEntries(conf, [], entry => !!entry.date && entry.date < before, view);
215
+ };
216
+ const deleteKeys = async (conf, keys, view) => {
217
+ if (!keys.length) {
218
+ throw error('Must provide cache keys to delete', {
219
+ code: 'EUSAGE',
220
+ });
221
+ }
222
+ return deleteEntries(conf, keys, () => true, view);
223
+ };
224
+ const deleteAll = async (conf, _, view) => {
225
+ const { cache } = conf.options.packageInfo.registryClient;
226
+ await rm(cache.path(), { recursive: true, force: true });
227
+ await mkdir(cache.path(), { recursive: true });
228
+ view?.stdout('Deleted all cache entries.');
229
+ };
230
+ const add = async (conf, specs, view) => {
231
+ if (!specs.length) {
232
+ throw error('Must provide specs to add to the cache', {
233
+ code: 'EUSAGE',
234
+ });
235
+ }
236
+ const { packageInfo } = conf.options;
237
+ const promises = [];
238
+ for (const spec of specs) {
239
+ const p = packageInfo
240
+ .resolve(Spec.parseArgs(spec, conf.options), {
241
+ staleWhileRevalidate: false,
242
+ })
243
+ .then(async (r) => {
244
+ const { resolved, integrity } = r;
245
+ await packageInfo.registryClient.request(resolved, {
246
+ ...conf.options,
247
+ integrity,
248
+ staleWhileRevalidate: false,
249
+ query: undefined,
250
+ });
251
+ view?.stdout('+', spec, r.resolved);
252
+ });
253
+ promises.push(p);
254
+ }
255
+ await Promise.all(promises);
256
+ };
257
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceR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EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEJ,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAClB,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { CacheEntry } from '@vltpkg/registry-client'\nimport { Spec } from '@vltpkg/spec'\nimport { mkdir, rm } from 'node:fs/promises'\nimport prettyBytes from 'pretty-bytes'\nimport type { LoadedConfig } from '../config/index.ts'\nimport type { CommandUsageDefinition } from '../config/usage.ts'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { stderr, stdout } from '../output.ts'\nimport type { ViewOptions, Views } from '../view.ts'\nimport { ViewClass } from '../view.ts'\n\nexport type CacheMap = Record<\n string,\n ReturnType<CacheEntry['toJSON']>\n>\n\nexport type CacheSubcommands = keyof (typeof usageDef)['subcommands']\n\nlet view: CacheView\nexport class CacheView extends ViewClass {\n constructor(options: ViewOptions, conf: LoadedConfig) {\n super(options, conf)\n view = this\n }\n stdout(...args: unknown[]) {\n stdout(...args)\n }\n}\n\nexport const views: Views<void | CacheMap> = {\n human: CacheView,\n}\n\nconst usageDef = {\n command: 'cache',\n usage: '<command> [flags]',\n description: 'Work with vlt cache folders',\n\n subcommands: {\n add: {\n usage: '<package-spec> [<package-spec>...]',\n description: `Resolve the referenced package identifiers and ensure they\n are cached.`,\n },\n\n ls: {\n usage: '[<key>...]',\n description: `Show cache entries. If no keys are provided, then a list of\n available keys will be printed. If one or more keys are\n provided, then details will be shown for the specified\n items.`,\n },\n\n info: {\n usage: '<key>',\n description: `Print metadata details for the specified cache key to\n stderr, and the response body to stdout.`,\n },\n\n clean: {\n usage: '[<key>...]',\n description: `Purge expired cache entries. If one or more keys are\n provided, then only those cache entries will be\n considered.`,\n },\n\n delete: {\n usage: '<key> [<key>...]',\n description: `Purge items explicitly, whether expired or not. If one or\n more keys are provided, then only those cache entries will\n be considered.`,\n },\n\n 'delete-before': {\n usage: '<date>',\n description: `Purge all cache items from before a given date. Date can be\n provided in any format that JavaScript can parse.`,\n },\n\n 'delete-all': {\n usage: '',\n description: `Delete the entire cache folder to make vlt slower.`,\n },\n },\n examples: {\n 'vlt cache ls https://registry.npmjs.org/typescript': {\n description: `Show cache metadata for a given registry URL`,\n },\n 'vlt cache add eslint@latest': {\n description: `Add a given package specifier to the cache by fetching\n its resolved value.`,\n },\n 'vlt cache info https://registry.npmjs.org/eslint/-/eslint-9.25.1.tgz > eslint.tgz':\n {\n description: `Print the cache metadata to stderr, and write the tarball\n on stdout, redirecting to a file.`,\n },\n 'vlt cache delete-before 2025-01-01': {\n description: 'Delete all entries created before Jan 1, 2025',\n },\n },\n} as const satisfies CommandUsageDefinition\n\nexport const usage: CommandUsage = () => commandUsage(usageDef)\n\nexport const command: CommandFn<void | CacheMap> = async conf => {\n const [sub, ...args] = conf.positionals\n switch (sub) {\n case 'ls':\n return ls(conf, args, view)\n\n case 'info':\n return info(conf, args, view)\n\n case 'add':\n return add(conf, args, view)\n\n case 'clean':\n return clean(conf, args, view)\n\n case 'delete':\n return deleteKeys(conf, args, view)\n\n case 'delete-before':\n return deleteBefore(conf, args, view)\n\n case 'delete-all':\n return deleteAll(conf, args, view)\n\n default: {\n throw error('Unrecognized cache command', {\n code: 'EUSAGE',\n found: sub,\n validOptions: Object.keys(usageDef.subcommands),\n })\n }\n }\n}\n\nconst ls = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n): Promise<CacheMap> =>\n keys.length ?\n await fetchKeys(\n conf,\n keys,\n (entry: CacheEntry, key: string) => {\n view?.stdout(\n key.includes(' ') ? JSON.stringify(key) : key,\n entry,\n )\n return true\n },\n view,\n )\n : await fetchAll(conf, (_, key) => {\n view?.stdout(key.includes(' ') ? JSON.stringify(key) : key)\n return true\n })\n\nconst info = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n): Promise<void> => {\n const [key] = keys\n if (keys.length !== 1 || !key) {\n throw error('Must provide exactly one cache key', {\n code: 'EUSAGE',\n })\n }\n await fetchKeys(\n conf,\n [key],\n (entry: CacheEntry, key: string) => {\n stderr(\n /* c8 ignore next */\n key.includes(' ') ? JSON.stringify(key) : key,\n entry,\n )\n if (entry.isJSON) {\n stdout(JSON.stringify(entry.body, null, 2))\n /* c8 ignore start - annoying to test, corrupts TAP output */\n } else {\n process.stdout.write(entry.body as Buffer)\n }\n /* c8 ignore stop */\n return true\n },\n view,\n )\n}\n\nconst fetchAll = async (\n conf: LoadedConfig,\n test: (entry: CacheEntry, key: string, val: Buffer) => boolean,\n) => {\n const rc = conf.options.packageInfo.registryClient\n const { cache } = rc\n const map: CacheMap = {}\n for await (const [key, val] of cache) {\n const entry = CacheEntry.decode(val)\n if (!test(entry, key, val)) continue\n map[key] = entry.toJSON()\n }\n return map\n}\n\nconst fetchKeys = async (\n conf: LoadedConfig,\n keys: string[],\n test: (entry: CacheEntry, key: string, buf: Buffer) => boolean,\n view?: CacheView,\n) => {\n const rc = conf.options.packageInfo.registryClient\n const { cache } = rc\n const map: CacheMap = {}\n const results: [string, Buffer | undefined][] = await Promise.all(\n keys.map(async key => {\n return [key, await cache.fetch(key)]\n }),\n )\n for (const [key, val] of results) {\n if (!val) {\n view?.stdout('Not found:', key)\n } else {\n const entry = CacheEntry.decode(val)\n if (!test(entry, key, val)) continue\n map[key] = entry.toJSON()\n }\n }\n\n return map\n}\n\nconst deleteEntries = async (\n conf: LoadedConfig,\n keys: string[],\n test: (entry: CacheEntry) => boolean,\n view?: CacheView,\n) => {\n const rc = conf.options.packageInfo.registryClient\n const { cache } = rc\n\n let count = 0\n let size = 0\n const testAction = (\n entry: CacheEntry,\n key: string,\n val: Buffer,\n ) => {\n if (!test(entry)) {\n return false\n }\n count++\n const s = val.byteLength + key.length\n cache.delete(key, true, entry.integrity)\n const k = key.includes(' ') ? JSON.stringify(key) : key\n view?.stdout('-', k, s)\n size += s\n return true\n }\n\n const map = await (keys.length ?\n fetchKeys(conf, keys, testAction, view)\n : fetchAll(conf, testAction))\n\n const pb = prettyBytes(size, { binary: true })\n\n const s = count === 1 ? '' : 's'\n await cache.promise()\n view?.stdout(`Removed ${count} item${s} totalling ${pb}`)\n return map\n}\n\nconst clean = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n) => deleteEntries(conf, keys, entry => !entry.valid, view)\n\nconst deleteBefore = async (\n conf: LoadedConfig,\n args: string[],\n view?: CacheView,\n) => {\n if (!args.length) {\n throw error('Must provide a date to delete before', {\n code: 'EUSAGE',\n })\n }\n const now = new Date()\n const before = new Date(args.join(' '))\n if (before >= now) {\n throw error('Cannot delete cache entries from the future', {\n code: 'EUSAGE',\n found: before,\n })\n }\n return deleteEntries(\n conf,\n [],\n entry => !!entry.date && entry.date < before,\n view,\n )\n}\n\nconst deleteKeys = async (\n conf: LoadedConfig,\n keys: string[],\n view?: CacheView,\n) => {\n if (!keys.length) {\n throw error('Must provide cache keys to delete', {\n code: 'EUSAGE',\n })\n }\n return deleteEntries(conf, keys, () => true, view)\n}\n\nconst deleteAll = async (\n conf: LoadedConfig,\n _: string[],\n view?: CacheView,\n) => {\n const { cache } = conf.options.packageInfo.registryClient\n await rm(cache.path(), { recursive: true, force: true })\n await mkdir(cache.path(), { recursive: true })\n view?.stdout('Deleted all cache entries.')\n}\n\nconst add = async (\n conf: LoadedConfig,\n specs: string[],\n view?: CacheView,\n) => {\n if (!specs.length) {\n throw error('Must provide specs to add to the cache', {\n code: 'EUSAGE',\n })\n }\n const { packageInfo } = conf.options\n const promises: Promise<void>[] = []\n\n for (const spec of specs) {\n const p = packageInfo\n .resolve(Spec.parseArgs(spec, conf.options), {\n staleWhileRevalidate: false,\n })\n .then(async r => {\n const { resolved, integrity } = r\n await packageInfo.registryClient.request(resolved, {\n ...conf.options,\n integrity,\n staleWhileRevalidate: false,\n query: undefined,\n })\n view?.stdout('+', spec, r.resolved)\n })\n\n promises.push(p)\n }\n\n await Promise.all(promises)\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { InstallReporter } from './install/reporter.ts';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
3
+ import type { InstallResult } from './install.ts';
4
+ export type CIResult = Omit<InstallResult, 'buildQueue'>;
5
+ export declare const usage: CommandUsage;
6
+ export declare const views: {
7
+ readonly json: (i: CIResult) => import("@vltpkg/graph").LockfileData;
8
+ readonly human: typeof InstallReporter;
9
+ };
10
+ export declare const command: CommandFn<CIResult>;
11
+ //# sourceMappingURL=ci.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../../../src/commands/ci.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAA;AAExD,eAAO,MAAM,KAAK,EAAE,YAWhB,CAAA;AAEJ,eAAO,MAAM,KAAK;;;CAGkB,CAAA;AAEpC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,QAAQ,CAavC,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { install } from '@vltpkg/graph';
2
+ import { commandUsage } from "../config/usage.js";
3
+ import { InstallReporter } from "./install/reporter.js";
4
+ export const usage = () => commandUsage({
5
+ command: 'ci',
6
+ usage: '',
7
+ description: `Clean install from lockfile. Deletes node_modules and installs
8
+ dependencies exactly as specified in vlt-lock.json. This is
9
+ similar to running 'vlt install --expect-lockfile' but performs
10
+ a clean install by removing node_modules first.`,
11
+ examples: {
12
+ '': { description: 'Clean install from lockfile' },
13
+ },
14
+ });
15
+ export const views = {
16
+ json: i => i.graph.toJSON(),
17
+ human: InstallReporter,
18
+ };
19
+ export const command = async (conf) => {
20
+ const ciOptions = {
21
+ ...conf.options,
22
+ // allow all scripts by default on ci (unless user specifies a filter)
23
+ allowScripts: conf.get('allow-scripts') ?? '*',
24
+ expectLockfile: true,
25
+ frozenLockfile: true,
26
+ cleanInstall: true,
27
+ lockfileOnly: conf.options['lockfile-only'],
28
+ };
29
+ const { graph } = await install(ciOptions);
30
+ return { graph };
31
+ };
32
+ //# sourceMappingURL=ci.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci.js","sourceRoot":"","sources":["../../../src/commands/ci.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAOvD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,EAAE;IACT,WAAW,EAAE;;;kEAGiD;IAC9D,QAAQ,EAAE;QACR,EAAE,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE;KACnD;CACF,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;IAC3B,KAAK,EAAE,eAAe;CACY,CAAA;AAEpC,MAAM,CAAC,MAAM,OAAO,GAAwB,KAAK,EAAC,IAAI,EAAC,EAAE;IACvD,MAAM,SAAS,GAAG;QAChB,GAAG,IAAI,CAAC,OAAO;QACf,sEAAsE;QACtE,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,GAAG;QAC9C,cAAc,EAAE,IAAI;QACpB,cAAc,EAAE,IAAI;QACpB,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;KAC5C,CAAA;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,CAAA;IAC1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC,CAAA","sourcesContent":["import { install } from '@vltpkg/graph'\nimport { commandUsage } from '../config/usage.ts'\nimport { InstallReporter } from './install/reporter.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport type { Views } from '../view.ts'\nimport type { InstallResult } from './install.ts'\n\nexport type CIResult = Omit<InstallResult, 'buildQueue'>\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'ci',\n usage: '',\n description: `Clean install from lockfile. Deletes node_modules and installs \n dependencies exactly as specified in vlt-lock.json. This is \n similar to running 'vlt install --expect-lockfile' but performs \n a clean install by removing node_modules first.`,\n examples: {\n '': { description: 'Clean install from lockfile' },\n },\n })\n\nexport const views = {\n json: i => i.graph.toJSON(),\n human: InstallReporter,\n} as const satisfies Views<CIResult>\n\nexport const command: CommandFn<CIResult> = async conf => {\n const ciOptions = {\n ...conf.options,\n // allow all scripts by default on ci (unless user specifies a filter)\n allowScripts: conf.get('allow-scripts') ?? '*',\n expectLockfile: true,\n frozenLockfile: true,\n cleanInstall: true,\n lockfileOnly: conf.options['lockfile-only'],\n }\n\n const { graph } = await install(ciOptions)\n return { graph }\n}\n"]}
@@ -1,5 +1,6 @@
1
- import type { RecordPairs } from '../config/index.ts';
2
1
  import type { CommandFn, CommandUsage } from '../index.ts';
2
+ import type { Views } from '../view.ts';
3
+ export declare const views: Views;
3
4
  export declare const usage: CommandUsage;
4
- export declare const command: CommandFn<string | number | boolean | void | string[] | RecordPairs>;
5
+ export declare const command: CommandFn;
5
6
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/config.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGV,WAAW,EACZ,MAAM,oBAAoB,CAAA;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,eAAO,MAAM,KAAK,EAAE,YA8ChB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAC7B,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,EAAE,GAAG,WAAW,CA+B1D,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/config.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAKvC,eAAO,MAAM,KAAK,EAAE,KAUM,CAAA;AAE1B,eAAO,MAAM,KAAK,EAAE,YAwDhB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SA8DrB,CAAA"}