@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
@@ -1 +1 @@
1
- {"version":3,"file":"help.js","sourceRoot":"","sources":["../../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGjD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,EAAE;IACT,WAAW,EAAE,wCAAwC;CACtD,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAsB,KAAK,EAAC,IAAI,EAAC,EAAE;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;AAC1B,CAAC,CAAA","sourcesContent":["import { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'help',\n usage: '',\n description: 'Print the full help output for the CLI',\n })\n\nexport const command: CommandFn<string> = async conf => {\n return conf.jack.usage()\n}\n"]}
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAA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AAC,CAAA;IAC/C,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAA;AAChC,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../load-command.ts'\nimport { loadCommand } from '../load-command.ts'\nimport { getCommand } from '../config/definition.ts'\nimport {\n generateDefaultHelp,\n generateFullHelp,\n} from '../custom-help.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'help',\n usage: '[<command>]',\n description:\n 'Print the full help output for the CLI, or help for a specific command',\n examples: {\n '': { description: 'Show general CLI help' },\n install: { description: 'Show help for the install command' },\n run: { description: 'Show help for the run command' },\n },\n })\n\nexport const command: CommandFn<string> = async conf => {\n // If no positional arguments, show general help\n if (conf.positionals.length === 0) {\n // Check for color support (prefer explicit config, fall back to TTY detection)\n const colors = conf.values.color ?? process.stdout.isTTY\n\n // Use full custom help if --all flag is set\n if (conf.values.all) {\n return generateFullHelp(colors)\n }\n return generateDefaultHelp(colors)\n }\n\n // Get the command name from the first positional argument\n const cmdName = conf.positionals[0]\n const canonicalCmd = getCommand(cmdName)\n\n if (!canonicalCmd) {\n throw error(`Unknown command: ${cmdName}`, {\n found: cmdName,\n code: 'EUSAGE',\n })\n }\n\n const command = await loadCommand(canonicalCmd)\n return command.usage().usage()\n}\n"]}
@@ -1,9 +1,8 @@
1
- import type { CommandFn, CommandUsage } from '../index.ts';
2
1
  import type { InitFileResults } from '@vltpkg/init';
3
- import type { ViewFn, Views } from '../view.ts';
2
+ import type { CommandFn, CommandUsage } from '../index.ts';
4
3
  export declare const usage: CommandUsage;
5
- export declare const views: Views<InitFileResults> & {
6
- human: ViewFn<InitFileResults>;
4
+ export declare const views: {
5
+ readonly human: (results: InitFileResults | InitFileResults[]) => string;
7
6
  };
8
- export declare const command: CommandFn<InitFileResults>;
7
+ export declare const command: CommandFn<InitFileResults | InitFileResults[]>;
9
8
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAE/C,eAAO,MAAM,KAAK,EAAE,YAKhB,CAAA;AAEJ,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC,eAAe,CAAC,CAAA;CAgB/B,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,eAAe,CACX,CAAA"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1D,eAAO,MAAM,KAAK,EAAE,YAKhB,CAAA;AAGJ,eAAO,MAAM,KAAK;8BACC,eAAe,GAAG,eAAe,EAAE;CAsBX,CAAA;AAE3C,eAAO,MAAM,OAAO,EAAE,SAAS,CAC7B,eAAe,GAAG,eAAe,EAAE,CAoFpC,CAAA"}
@@ -1,25 +1,111 @@
1
- import { commandUsage } from "../config/usage.js";
1
+ import { mkdirSync } from 'node:fs';
2
+ import { relative, resolve } from 'node:path';
3
+ import { minimatch } from 'minimatch';
2
4
  import { init } from '@vltpkg/init';
5
+ import { load, save } from '@vltpkg/vlt-json';
6
+ import { assertWSConfig, asWSConfig } from '@vltpkg/workspaces';
7
+ import { commandUsage } from "../config/usage.js";
3
8
  export const usage = () => commandUsage({
4
9
  command: 'init',
5
10
  usage: '',
6
11
  description: `Create a new package.json file in the current directory.`,
7
12
  });
13
+ // TODO: colorize the JSON if config.options.color
8
14
  export const views = {
9
- human: (results, _options, _config) => {
15
+ human: (results) => {
10
16
  const output = [];
11
- // TODO: colorize the JSON if config.options.color
12
- for (const [type, { path, data }] of Object.entries(results)) {
13
- output.push(`Wrote ${type} to ${path}:
17
+ // if results is an array, it means multiple workspaces were initialized
18
+ if (Array.isArray(results)) {
19
+ for (const result of results) {
20
+ for (const [type, { path }] of Object.entries(result)) {
21
+ output.push(`Wrote ${type} to ${path}:`);
22
+ }
23
+ }
24
+ }
25
+ else {
26
+ // otherwise, it's a single result
27
+ for (const [type, { path, data }] of Object.entries(results)) {
28
+ output.push(`Wrote ${type} to ${path}:
14
29
 
15
- ${JSON.stringify(data, null, 2)}
16
- `);
30
+ ${JSON.stringify(data, null, 2)}`);
31
+ }
17
32
  }
18
- output.push(`Modify/add properties using \`vlt pkg\`. For example:
33
+ output.push(`\nModify/add properties using \`vlt pkg\`. For example:
19
34
 
20
35
  vlt pkg set "description=My new project"`);
21
36
  return output.join('\n');
22
37
  },
23
38
  };
24
- export const command = async () => await init({ cwd: process.cwd() });
39
+ export const command = async (conf) => {
40
+ if (conf.values.workspace?.length) {
41
+ const workspacesConfig = load('workspaces', assertWSConfig);
42
+ const parsedWSConfig = asWSConfig(workspacesConfig ?? {});
43
+ const results = [];
44
+ const addToConfig = [];
45
+ // create a new package.json file for every workspace
46
+ // defined as cli --workspace options
47
+ for (const workspace of conf.values.workspace) {
48
+ // cwd is the resolved location of the workspace
49
+ const cwd = resolve(conf.options.projectRoot, workspace);
50
+ // create the folder in case it's missing
51
+ mkdirSync(cwd, { recursive: true });
52
+ // run the initialization script and collect results
53
+ results.push(await init({ cwd }));
54
+ // Check if this workspace path is covered by existing workspace patterns
55
+ const isMatched = Object.values(parsedWSConfig).some((patterns) => {
56
+ return patterns.some(pattern => minimatch(workspace, pattern));
57
+ });
58
+ // When a workspace is not matched we track it for insertion later
59
+ if (!isMatched) {
60
+ addToConfig.push(relative(conf.options.projectRoot, cwd).replace(/\\/g, '/'));
61
+ }
62
+ }
63
+ // if there are workspaces that were not matched by existing
64
+ // patterns, we add them to the workspaces config
65
+ if (addToConfig.length > 0) {
66
+ let workspaces = workspacesConfig;
67
+ // if the original workspaces config is a string, we'll need
68
+ // to convert it to an array in order to append the recently
69
+ // added workspaces
70
+ if (typeof workspacesConfig === 'string') {
71
+ workspaces = [workspacesConfig, ...addToConfig];
72
+ }
73
+ else if (Array.isArray(workspacesConfig)) {
74
+ // if the original workspaces config is an array, we simply
75
+ // append the missing items to it
76
+ workspaces = [...workspacesConfig, ...addToConfig];
77
+ }
78
+ else {
79
+ // otherwise we assume it's an Record<string, string[]> object
80
+ // and we'll add the new workspaces to the `packages` keys
81
+ workspaces = (workspacesConfig ?? {});
82
+ // if the `packages` key is not being used
83
+ if (!workspaces.packages) {
84
+ workspaces.packages = addToConfig;
85
+ }
86
+ else {
87
+ // if the `packages` key is defined as a string, we
88
+ // convert it to an array to append the new items
89
+ if (typeof workspaces.packages === 'string') {
90
+ workspaces.packages = [
91
+ workspaces.packages,
92
+ ...addToConfig,
93
+ ];
94
+ }
95
+ else {
96
+ // if it is, we simply append the new workspaces
97
+ workspaces.packages = [
98
+ ...workspaces.packages,
99
+ ...addToConfig,
100
+ ];
101
+ }
102
+ }
103
+ }
104
+ // finally, we add the new workspaces to the config file
105
+ save('workspaces', workspaces);
106
+ }
107
+ return results;
108
+ }
109
+ return init({ cwd: process.cwd() });
110
+ };
25
111
  //# sourceMappingURL=init.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAInC,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,EAAE;IACT,WAAW,EAAE,0DAA0D;CACxE,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAEd;IACF,KAAK,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;QACpC,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,kDAAkD;QAClD,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7D,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,OAAO,IAAI;;EAExC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;CAC9B,CAAC,CAAA;QACE,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;;2CAE2B,CAAC,CAAA;QACxC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,IAAI,EAAE,CAC5D,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA","sourcesContent":["import { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { init } from '@vltpkg/init'\nimport type { InitFileResults } from '@vltpkg/init'\nimport type { ViewFn, Views } from '../view.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'init',\n usage: '',\n description: `Create a new package.json file in the current directory.`,\n })\n\nexport const views: Views<InitFileResults> & {\n human: ViewFn<InitFileResults>\n} = {\n human: (results, _options, _config) => {\n const output: string[] = []\n // TODO: colorize the JSON if config.options.color\n for (const [type, { path, data }] of Object.entries(results)) {\n output.push(`Wrote ${type} to ${path}:\n\n${JSON.stringify(data, null, 2)}\n`)\n }\n output.push(`Modify/add properties using \\`vlt pkg\\`. For example:\n\n vlt pkg set \"description=My new project\"`)\n return output.join('\\n')\n },\n}\n\nexport const command: CommandFn<InitFileResults> = async () =>\n await init({ cwd: process.cwd() })\n"]}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAKjD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,EAAE;IACT,WAAW,EAAE,0DAA0D;CACxE,CAAC,CAAA;AAEJ,kDAAkD;AAClD,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,EAAE,CAAC,OAA4C,EAAE,EAAE;QACtD,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,wEAAwE;QACxE,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7B,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBACtD,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,OAAO,IAAI,GAAG,CAAC,CAAA;gBAC1C,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,kCAAkC;YAClC,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE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4BACnB,GAAG,WAAW;yBACf,CAAA;oBACH,CAAC;yBAAM,CAAC;wBACN,gDAAgD;wBAChD,UAAU,CAAC,QAAQ,GAAG;4BACpB,GAAG,UAAU,CAAC,QAAQ;4BACtB,GAAG,WAAW;yBACf,CAAA;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YACD,wDAAwD;YACxD,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;QAChC,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;AACrC,CAAC,CAAA","sourcesContent":["import { mkdirSync } from 'node:fs'\nimport { relative, resolve } from 'node:path'\nimport { minimatch } from 'minimatch'\nimport { init } from '@vltpkg/init'\nimport { load, save } from '@vltpkg/vlt-json'\nimport { assertWSConfig, asWSConfig } from '@vltpkg/workspaces'\nimport { commandUsage } from '../config/usage.ts'\nimport type { InitFileResults } from '@vltpkg/init'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport type { Views } from '../view.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'init',\n usage: '',\n description: `Create a new package.json file in the current directory.`,\n })\n\n// TODO: colorize the JSON if config.options.color\nexport const views = {\n human: (results: InitFileResults | InitFileResults[]) => {\n const output: string[] = []\n // if results is an array, it means multiple workspaces were initialized\n if (Array.isArray(results)) {\n for (const result of results) {\n for (const [type, { path }] of Object.entries(result)) {\n output.push(`Wrote ${type} to ${path}:`)\n }\n }\n } else {\n // otherwise, it's a single result\n for (const [type, { path, data }] of Object.entries(results)) {\n output.push(`Wrote ${type} to ${path}:\n\n${JSON.stringify(data, null, 2)}`)\n }\n }\n output.push(`\\nModify/add properties using \\`vlt pkg\\`. For example:\n\n vlt pkg set \"description=My new project\"`)\n return output.join('\\n')\n },\n} as const satisfies Views<InitFileResults>\n\nexport const command: CommandFn<\n InitFileResults | InitFileResults[]\n> = async conf => {\n if (conf.values.workspace?.length) {\n const workspacesConfig = load('workspaces', assertWSConfig)\n const parsedWSConfig = asWSConfig(workspacesConfig ?? {})\n const results: InitFileResults[] = []\n const addToConfig: string[] = []\n\n // create a new package.json file for every workspace\n // defined as cli --workspace options\n for (const workspace of conf.values.workspace) {\n // cwd is the resolved location of the workspace\n const cwd = resolve(conf.options.projectRoot, workspace)\n\n // create the folder in case it's missing\n mkdirSync(cwd, { recursive: true })\n\n // run the initialization script and collect results\n results.push(await init({ cwd }))\n\n // Check if this workspace path is covered by existing workspace patterns\n const isMatched = Object.values(parsedWSConfig).some(\n (patterns: string[]) => {\n return patterns.some(pattern =>\n minimatch(workspace, pattern),\n )\n },\n )\n\n // When a workspace is not matched we track it for insertion later\n if (!isMatched) {\n addToConfig.push(\n relative(conf.options.projectRoot, cwd).replace(/\\\\/g, '/'),\n )\n }\n }\n\n // if there are workspaces that were not matched by existing\n // patterns, we add them to the workspaces config\n if (addToConfig.length > 0) {\n let workspaces = workspacesConfig\n // if the original workspaces config is a string, we'll need\n // to convert it to an array in order to append the recently\n // added workspaces\n if (typeof workspacesConfig === 'string') {\n workspaces = [workspacesConfig, ...addToConfig]\n } else if (Array.isArray(workspacesConfig)) {\n // if the original workspaces config is an array, we simply\n // append the missing items to it\n workspaces = [...workspacesConfig, ...addToConfig]\n } else {\n // otherwise we assume it's an Record<string, string[]> object\n // and we'll add the new workspaces to the `packages` keys\n workspaces = (workspacesConfig ?? {}) as Record<\n string,\n string[]\n >\n // if the `packages` key is not being used\n if (!workspaces.packages) {\n workspaces.packages = addToConfig\n } else {\n // if the `packages` key is defined as a string, we\n // convert it to an array to append the new items\n if (typeof workspaces.packages === 'string') {\n workspaces.packages = [\n workspaces.packages,\n ...addToConfig,\n ]\n } else {\n // if it is, we simply append the new workspaces\n workspaces.packages = [\n ...workspaces.packages,\n ...addToConfig,\n ]\n }\n }\n }\n // finally, we add the new workspaces to the config file\n save('workspaces', workspaces)\n }\n return results\n }\n\n return init({ cwd: process.cwd() })\n}\n"]}
@@ -1,10 +1,11 @@
1
1
  import { ViewClass } from '../../view.ts';
2
+ import type { InstallResult } from '../install.ts';
2
3
  export declare class InstallReporter extends ViewClass {
3
4
  #private;
4
5
  start(): void;
5
- done(_result: unknown, { time }: {
6
+ done(_result: InstallResult, { time }: {
6
7
  time: number;
7
- }): undefined;
8
+ }): Promise<undefined>;
8
9
  error(err: unknown): void;
9
10
  }
10
11
  //# sourceMappingURL=reporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../../../../src/commands/install/reporter.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAgFzC,qBAAa,eAAgB,SAAQ,SAAS;;IAG5C,KAAK;IAIL,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IAMjD,KAAK,CAAC,GAAG,EAAE,OAAO;CAGnB"}
1
+ {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../../../../src/commands/install/reporter.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAqGlD,qBAAa,eAAgB,SAAQ,SAAS;;IAG5C,KAAK;IAIC,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IAe7D,KAAK,CAAC,GAAG,EAAE,OAAO;CAGnB"}
@@ -1,20 +1,26 @@
1
1
  import { emitter } from '@vltpkg/output';
2
2
  import { Box, render, Text } from 'ink';
3
3
  import Spinner from 'ink-spinner';
4
- import { createElement as $, Fragment, useLayoutEffect, useState, } from 'react';
5
- import { stdout } from "../../output.js";
4
+ import { createElement as $, Fragment, useEffect, useState, } from 'react';
6
5
  import { ViewClass } from "../../view.js";
6
+ import { asError } from '@vltpkg/types';
7
+ const labels = {
8
+ build: 'resolving dependencies',
9
+ actual: '',
10
+ reify: 'extracting files',
11
+ };
7
12
  const GraphStep = ({ text, step }) => {
8
13
  if (step.state === 'waiting') {
9
14
  return $(Text, { color: 'gray' }, text);
10
15
  }
11
16
  if (step.state === 'in_progress') {
12
- return $(Text, { color: 'yellow' }, text, $(Spinner, { type: 'dots' }));
17
+ return $(Text, { color: 'yellow' }, text + ' ', $(Spinner, { type: 'dots' }));
13
18
  }
14
19
  return $(Text, { color: 'green' }, text, ' āœ“');
15
20
  };
16
- const App = () => {
21
+ const App = ({ trailer }) => {
17
22
  const [requests, setRequests] = useState(0);
23
+ const [cacheHit, setCacheHit] = useState(0);
18
24
  const [steps, setSteps] = useState({
19
25
  build: {
20
26
  state: 'waiting',
@@ -26,12 +32,19 @@ const App = () => {
26
32
  state: 'waiting',
27
33
  },
28
34
  });
29
- useLayoutEffect(() => {
30
- const update = () => setRequests(p => p + 1);
31
- emitter.on('request', update);
32
- return () => emitter.off('request', update);
35
+ useEffect(() => {
36
+ const updateRequests = ({ state }) => {
37
+ if (state === 'start') {
38
+ setRequests(p => p + 1);
39
+ }
40
+ else if (state === 'cache' || state === 'stale') {
41
+ setCacheHit(p => p + 1);
42
+ }
43
+ };
44
+ emitter.on('request', updateRequests);
45
+ return () => emitter.off('request', updateRequests);
33
46
  }, []);
34
- useLayoutEffect(() => {
47
+ useEffect(() => {
35
48
  const update = ({ step, state }) => {
36
49
  setSteps(p => ({
37
50
  ...p,
@@ -46,21 +59,36 @@ const App = () => {
46
59
  }, []);
47
60
  return $(Fragment, null, $(Box, null, ...['build', 'actual', 'reify'].map((step, idx, list) => {
48
61
  const separator = idx === list.length - 1 ? '' : ' > ';
49
- return $(Text, { key: step }, $(GraphStep, { text: step, step: steps[step] }), $(Text, { color: 'gray' }, separator));
50
- })), requests > 0 ? $(Text, null, `${requests} requests`) : null);
62
+ const label = labels[step];
63
+ if (!label)
64
+ return null;
65
+ return $(Text, { key: step }, $(GraphStep, { text: label, step: steps[step] }), $(Text, { color: 'gray' }, separator));
66
+ })), cacheHit > 0 ?
67
+ $(Text, null, `${cacheHit} cache hit${cacheHit > 1 ? 's' : ''}`)
68
+ : null, requests > 0 ?
69
+ $(Text, null, `${requests} request${requests > 1 ? 's' : ''}`)
70
+ : null, trailer ? $(Text, null, trailer) : null);
51
71
  };
52
72
  export class InstallReporter extends ViewClass {
53
73
  #instance = null;
54
74
  start() {
55
75
  this.#instance = render($(App));
56
76
  }
57
- done(_result, { time }) {
58
- this.#instance?.unmount();
59
- stdout(`Done in ${time}ms`);
77
+ async done(_result, { time }) {
78
+ let out = `Done in ${time}ms`;
79
+ // prints a very complete message explaining users the next steps
80
+ // in case there are packages to be built
81
+ if (_result.buildQueue?.length) {
82
+ out += `\n\nšŸ“¦ ${_result.buildQueue.length} packages have install scripts defined & were not fully built\n`;
83
+ out += 'šŸ”Ž Run `vlt query :scripts` to list them\n';
84
+ out +=
85
+ 'šŸ”Ø Run `vlt build` to run all required scripts to build installed packages.\n';
86
+ }
87
+ this.#instance?.rerender($(App, { trailer: out }));
60
88
  return undefined;
61
89
  }
62
90
  error(err) {
63
- this.#instance?.unmount(err);
91
+ this.#instance?.unmount(asError(err));
64
92
  }
65
93
  }
66
94
  //# sourceMappingURL=reporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../../../src/commands/install/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAEvC,OAAO,OAAO,MAAM,aAAa,CAAA;AACjC,OAAO,EACL,aAAa,IAAI,CAAC,EAClB,QAAQ,EACR,eAAe,EACf,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC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C,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAC5D,CAAA;AACH,CAAC,CAAA;AAED,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,SAAS,GAAoB,IAAI,CAAA;IAEjC,KAAK;QACH,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IACjC,CAAC;IAED,IAAI,CAAC,OAAgB,EAAE,EAAE,IAAI,EAAoB;QAC/C,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,CAAA;QACzB,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,CAAA;QAC3B,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,GAAY;QAChB,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,GAAY,CAAC,CAAA;IACvC,CAAC;CACF","sourcesContent":["import { emitter } from '@vltpkg/output'\nimport type { Events } from '@vltpkg/output'\nimport { Box, render, Text } from 'ink'\nimport type { Instance } from 'ink'\nimport Spinner from 'ink-spinner'\nimport {\n createElement as $,\n Fragment,\n useLayoutEffect,\n useState,\n} from 'react'\nimport { stdout } from '../../output.ts'\nimport { ViewClass } from '../../view.ts'\n\ntype Step = {\n state: 'waiting' | 'in_progress' | 'completed'\n}\n\nconst GraphStep = ({ text, step }: { text: string; step: Step }) => {\n if (step.state === 'waiting') {\n return $(Text, { color: 'gray' }, text)\n }\n if (step.state === 'in_progress') {\n return $(\n Text,\n { color: 'yellow' },\n text,\n $(Spinner, { type: 'dots' }),\n )\n }\n return $(Text, { color: 'green' }, text, ' āœ“')\n}\n\nconst App = () => {\n const [requests, setRequests] = useState(0)\n\n const [steps, setSteps] = useState<\n Record<Events['graphStep']['step'], Step>\n >({\n build: {\n state: 'waiting',\n },\n actual: {\n state: 'waiting',\n },\n reify: {\n state: 'waiting',\n },\n })\n\n useLayoutEffect(() => {\n const update = () => setRequests(p => p + 1)\n emitter.on('request', update)\n return () => emitter.off('request', update)\n }, [])\n\n useLayoutEffect(() => {\n const update = ({ step, state }: Events['graphStep']) => {\n setSteps(p => ({\n ...p,\n [step]: {\n ...p[step],\n state: state === 'start' ? 'in_progress' : 'completed',\n },\n }))\n }\n emitter.on('graphStep', update)\n return () => emitter.off('graphStep', update)\n }, [])\n\n return $(\n Fragment,\n null,\n $(\n Box,\n null,\n ...(['build', 'actual', 'reify'] as const).map(\n (step, idx, list) => {\n const separator = idx === list.length - 1 ? '' : ' > '\n return $(\n Text,\n { key: step },\n $(GraphStep, { text: step, step: steps[step] }),\n $(Text, { color: 'gray' }, separator),\n )\n },\n ),\n ),\n requests > 0 ? $(Text, null, `${requests} requests`) : null,\n )\n}\n\nexport class InstallReporter extends ViewClass {\n #instance: Instance | null = null\n\n start() {\n this.#instance = render($(App))\n }\n\n done(_result: unknown, { time }: { time: number }) {\n this.#instance?.unmount()\n stdout(`Done in ${time}ms`)\n return undefined\n }\n\n error(err: unknown) {\n this.#instance?.unmount(err as Error)\n }\n}\n"]}
1
+ {"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../../../src/commands/install/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAEvC,OAAO,OAAO,MAAM,aAAa,CAAA;AACjC,OAAO,EACL,aAAa,IAAI,CAAC,EAClB,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAOvC,MAAM,MAAM,GAAgD;IAC1D,KAAK,EAAE,wBAAwB;IAC/B,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,kBAAkB;CAC1B,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,EA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M,EAAE,CAAC;YAC/B,GAAG,IAAI,UAAU,OAAO,CAAC,UAAU,CAAC,MAAM,iEAAiE,CAAA;YAC3G,GAAG,IAAI,4CAA4C,CAAA;YACnD,GAAG;gBACD,+EAA+E,CAAA;QACnF,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;QAClD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,GAAY;QAChB,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IACvC,CAAC;CACF","sourcesContent":["import { emitter } from '@vltpkg/output'\nimport type { Events } from '@vltpkg/output'\nimport { Box, render, Text } from 'ink'\nimport type { Instance } from 'ink'\nimport Spinner from 'ink-spinner'\nimport {\n createElement as $,\n Fragment,\n useEffect,\n useState,\n} from 'react'\nimport { ViewClass } from '../../view.ts'\nimport { asError } from '@vltpkg/types'\nimport type { InstallResult } from '../install.ts'\n\ntype Step = {\n state: 'waiting' | 'in_progress' | 'completed'\n}\n\nconst labels: Record<Events['graphStep']['step'], string> = {\n build: 'resolving dependencies',\n actual: '',\n reify: 'extracting files',\n}\n\nconst GraphStep = ({ text, step }: { text: string; step: Step }) => {\n if (step.state === 'waiting') {\n return $(Text, { color: 'gray' }, text)\n }\n if (step.state === 'in_progress') {\n return $(\n Text,\n { color: 'yellow' },\n text + ' ',\n $(Spinner, { type: 'dots' }),\n )\n }\n return $(Text, { color: 'green' }, text, ' āœ“')\n}\n\nconst App = ({ trailer }: { trailer?: string }) => {\n const [requests, setRequests] = useState(0)\n const [cacheHit, setCacheHit] = useState(0)\n\n const [steps, setSteps] = useState<\n Record<Events['graphStep']['step'], Step>\n >({\n build: {\n state: 'waiting',\n },\n actual: {\n state: 'waiting',\n },\n reify: {\n state: 'waiting',\n },\n })\n\n useEffect(() => {\n const updateRequests = ({ state }: Events['request']) => {\n if (state === 'start') {\n setRequests(p => p + 1)\n } else if (state === 'cache' || state === 'stale') {\n setCacheHit(p => p + 1)\n }\n }\n emitter.on('request', updateRequests)\n return () => emitter.off('request', updateRequests)\n }, [])\n\n useEffect(() => {\n const update = ({ step, state }: Events['graphStep']) => {\n setSteps(p => ({\n ...p,\n [step]: {\n ...p[step],\n state: state === 'start' ? 'in_progress' : 'completed',\n },\n }))\n }\n emitter.on('graphStep', update)\n return () => emitter.off('graphStep', update)\n }, [])\n\n return $(\n Fragment,\n null,\n $(\n Box,\n null,\n ...(['build', 'actual', 'reify'] as const).map(\n (step, idx, list) => {\n const separator = idx === list.length - 1 ? '' : ' > '\n const label = labels[step]\n if (!label) return null\n return $(\n Text,\n { key: step },\n $(GraphStep, { text: label, step: steps[step] }),\n $(Text, { color: 'gray' }, separator),\n )\n },\n ),\n ),\n cacheHit > 0 ?\n $(Text, null, `${cacheHit} cache hit${cacheHit > 1 ? 's' : ''}`)\n : null,\n requests > 0 ?\n $(Text, null, `${requests} request${requests > 1 ? 's' : ''}`)\n : null,\n trailer ? $(Text, null, trailer) : null,\n )\n}\n\nexport class InstallReporter extends ViewClass {\n #instance: Instance | null = null\n\n start() {\n this.#instance = render($(App))\n }\n\n async done(_result: InstallResult, { time }: { time: number }) {\n let out = `Done in ${time}ms`\n\n // prints a very complete message explaining users the next steps\n // in case there are packages to be built\n if (_result.buildQueue?.length) {\n out += `\\n\\nšŸ“¦ ${_result.buildQueue.length} packages have install scripts defined & were not fully built\\n`\n out += 'šŸ”Ž Run `vlt query :scripts` to list them\\n'\n out +=\n 'šŸ”Ø Run `vlt build` to run all required scripts to build installed packages.\\n'\n }\n this.#instance?.rerender($(App, { trailer: out }))\n return undefined\n }\n\n error(err: unknown) {\n this.#instance?.unmount(asError(err))\n }\n}\n"]}
@@ -1,7 +1,28 @@
1
+ import { InstallReporter } from './install/reporter.ts';
2
+ import type { DepID } from '@vltpkg/dep-id';
1
3
  import type { Graph } from '@vltpkg/graph';
2
4
  import type { CommandFn, CommandUsage } from '../index.ts';
3
- import type { Views } from '../view.ts';
5
+ /**
6
+ * The resulting object of an install operation. To be used by the view impl.
7
+ */
8
+ export type InstallResult = {
9
+ /**
10
+ * A queue of package IDs that need to be built after the install is complete.
11
+ */
12
+ buildQueue?: DepID[];
13
+ /**
14
+ * The resulting graph structure at the end of an install.
15
+ */
16
+ graph: Graph;
17
+ };
4
18
  export declare const usage: CommandUsage;
5
- export declare const views: Views<Graph>;
6
- export declare const command: CommandFn<Graph>;
19
+ export declare const views: {
20
+ readonly json: (i: InstallResult) => {
21
+ graph: import("@vltpkg/graph").LockfileData;
22
+ buildQueue?: DepID[] | undefined;
23
+ message?: string | undefined;
24
+ };
25
+ readonly human: typeof InstallReporter;
26
+ };
27
+ export declare const command: CommandFn<InstallResult>;
7
28
  //# sourceMappingURL=install.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGvC,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAG9B,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,KAAK,CAKpC,CAAA"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/install.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,EAAE,CAAA;IACpB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,KAAK;;;;;;;CAWuB,CAAA;AAEzC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,aAAa,CAyB5C,CAAA"}
@@ -9,13 +9,37 @@ export const usage = () => commandUsage({
9
9
  vlt-lock.json appropriately.`,
10
10
  });
11
11
  export const views = {
12
- json: g => g.toJSON(),
12
+ json: i => ({
13
+ ...(i.buildQueue?.length ?
14
+ {
15
+ buildQueue: i.buildQueue,
16
+ message: `${i.buildQueue.length} packages that will need to be built, run "vlt build" to complete the install.`,
17
+ }
18
+ : null),
19
+ graph: i.graph.toJSON(),
20
+ }),
13
21
  human: InstallReporter,
14
22
  };
15
23
  export const command = async (conf) => {
24
+ // TODO: we should probably throw an error if the user
25
+ // tries to install using either view=mermaid or view=gui
16
26
  const monorepo = conf.options.monorepo;
17
27
  const { add } = parseAddArgs(conf, monorepo);
18
- const { graph } = await install(conf.options, add);
19
- return graph;
28
+ const frozenLockfile = conf.options['frozen-lockfile'];
29
+ const expectLockfile = conf.options['expect-lockfile'];
30
+ const lockfileOnly = conf.options['lockfile-only'];
31
+ /* c8 ignore start */
32
+ const allowScripts = conf.get('allow-scripts') ?
33
+ String(conf.get('allow-scripts'))
34
+ : ':not(*)';
35
+ /* c8 ignore stop */
36
+ const { buildQueue, graph } = await install({
37
+ ...conf.options,
38
+ frozenLockfile,
39
+ expectLockfile,
40
+ allowScripts,
41
+ lockfileOnly,
42
+ }, add);
43
+ return { buildQueue, graph };
20
44
  };
21
45
  //# sourceMappingURL=install.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE;+CAC8B;CAC5C,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,eAAe;CACvB,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAqB,KAAK,EAAC,IAAI,EAAC,EAAE;IACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IACtC,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC5C,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IAClD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import type { Graph } from '@vltpkg/graph'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { install } from '@vltpkg/graph'\nimport { parseAddArgs } from '../parse-add-remove-args.ts'\nimport type { Views } from '../view.ts'\nimport { InstallReporter } from './install/reporter.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'install',\n usage: '[packages ...]',\n description: `Install the specified packages, updating package.json and\n vlt-lock.json appropriately.`,\n })\n\nexport const views: Views<Graph> = {\n json: g => g.toJSON(),\n human: InstallReporter,\n}\n\nexport const command: CommandFn<Graph> = async conf => {\n const monorepo = conf.options.monorepo\n const { add } = parseAddArgs(conf, monorepo)\n const { graph } = await install(conf.options, add)\n return graph\n}\n"]}
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAoBvD,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE;+CAC8B;CAC5C,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACV,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YACxB;gBACE,UAAU,EAAE,CAAC,CAAC,UAAU;gBACxB,OAAO,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,gFAAgF;aAChH;YACH,CAAC,CAAC,IAAI,CAAC;QACP,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;KACxB,CAAC;IACF,KAAK,EAAE,eAAe;CACiB,CAAA;AAEzC,MAAM,CAAC,MAAM,OAAO,GAA6B,KAAK,EAAC,IAAI,EAAC,EAAE;IAC5D,sDAAsD;IACtD,yDAAyD;IACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IACtC,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC5C,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACtD,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACtD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;IAClD,qBAAqB;IACrB,MAAM,YAAY,GAChB,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACnC,CAAC,CAAC,SAAS,CAAA;IACb,oBAAoB;IACpB,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CACzC;QACE,GAAG,IAAI,CAAC,OAAO;QACf,cAAc;QACd,cAAc;QACd,YAAY;QACZ,YAAY;KACb,EACD,GAAG,CACJ,CAAA;IACD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAA;AAC9B,CAAC,CAAA","sourcesContent":["import { commandUsage } from '../config/usage.ts'\nimport { install } from '@vltpkg/graph'\nimport { parseAddArgs } from '../parse-add-remove-args.ts'\nimport { InstallReporter } from './install/reporter.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { Graph } from '@vltpkg/graph'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport type { Views } from '../view.ts'\n\n/**\n * The resulting object of an install operation. To be used by the view impl.\n */\nexport type InstallResult = {\n /**\n * A queue of package IDs that need to be built after the install is complete.\n */\n buildQueue?: DepID[]\n /**\n * The resulting graph structure at the end of an install.\n */\n graph: Graph\n}\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'install',\n usage: '[packages ...]',\n description: `Install the specified packages, updating package.json and\n vlt-lock.json appropriately.`,\n })\n\nexport const views = {\n json: i => ({\n ...(i.buildQueue?.length ?\n {\n buildQueue: i.buildQueue,\n message: `${i.buildQueue.length} packages that will need to be built, run \"vlt build\" to complete the install.`,\n }\n : null),\n graph: i.graph.toJSON(),\n }),\n human: InstallReporter,\n} as const satisfies Views<InstallResult>\n\nexport const command: CommandFn<InstallResult> = async conf => {\n // TODO: we should probably throw an error if the user\n // tries to install using either view=mermaid or view=gui\n const monorepo = conf.options.monorepo\n const { add } = parseAddArgs(conf, monorepo)\n const frozenLockfile = conf.options['frozen-lockfile']\n const expectLockfile = conf.options['expect-lockfile']\n const lockfileOnly = conf.options['lockfile-only']\n /* c8 ignore start */\n const allowScripts =\n conf.get('allow-scripts') ?\n String(conf.get('allow-scripts'))\n : ':not(*)'\n /* c8 ignore stop */\n const { buildQueue, graph } = await install(\n {\n ...conf.options,\n frozenLockfile,\n expectLockfile,\n allowScripts,\n lockfileOnly,\n },\n add,\n )\n return { buildQueue, graph }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { HumanReadableOutputGraph, JSONOutputGraph, MermaidOutputGraph } from '@vltpkg/graph';
2
1
  import { humanReadableOutput, jsonOutput, mermaidOutput } from '@vltpkg/graph';
2
+ import type { HumanReadableOutputGraph, JSONOutputGraph, MermaidOutputGraph } from '@vltpkg/graph';
3
3
  import type { CommandFn, CommandUsage } from '../index.ts';
4
4
  export declare const usage: CommandUsage;
5
5
  export type ListResult = JSONOutputGraph & MermaidOutputGraph & HumanReadableOutputGraph & {
@@ -9,7 +9,7 @@ export declare const views: {
9
9
  readonly json: typeof jsonOutput;
10
10
  readonly mermaid: typeof mermaidOutput;
11
11
  readonly human: typeof humanReadableOutput;
12
- readonly gui: ({ queryString }: ListResult, _: import("../view.ts").ViewOptions, conf: import("../config/index.ts").LoadedConfig) => Promise<void>;
12
+ readonly gui: ({ queryString }: ListResult, _: import("../view.ts").ViewOptions, conf: import("../config/index.ts").ParsedConfig) => Promise<void>;
13
13
  };
14
14
  export declare const command: CommandFn<ListResult>;
15
15
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,eAAe,EACf,kBAAkB,EAEnB,MAAM,eAAe,CAAA;AACtB,OAAO,EAEL,mBAAmB,EACnB,UAAU,EACV,aAAa,EACd,MAAM,eAAe,CAAA;AAItB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1D,eAAO,MAAM,KAAK,EAAE,YAkChB,CAAA;AAEJ,MAAM,MAAM,UAAU,GAAG,eAAe,GACtC,kBAAkB,GAClB,wBAAwB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpD,eAAO,MAAM,KAAK;;;;;CAUoB,CAAA;AAEtC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,UAAU,CAmEzC,CAAA"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EACnB,UAAU,EACV,aAAa,EAEd,MAAM,eAAe,CAAA;AAQtB,OAAO,KAAK,EACV,wBAAwB,EACxB,eAAe,EACf,kBAAkB,EAGnB,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1D,eAAO,MAAM,KAAK,EAAE,YAyDhB,CAAA;AAEJ,MAAM,MAAM,UAAU,GAAG,eAAe,GACtC,kBAAkB,GAClB,wBAAwB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpD,eAAO,MAAM,KAAK;;;;;CAUoB,CAAA;AAEtC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,UAAU,CA+JzC,CAAA"}