@vltpkg/cli-sdk 1.0.0-rc.2 → 1.0.0-rc.22

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 (174) hide show
  1. package/package.json +66 -83
  2. package/dist/esm/commands/build.d.ts +0 -25
  3. package/dist/esm/commands/build.d.ts.map +0 -1
  4. package/dist/esm/commands/build.js +0 -102
  5. package/dist/esm/commands/build.js.map +0 -1
  6. package/dist/esm/commands/cache.d.ts +0 -65
  7. package/dist/esm/commands/cache.d.ts.map +0 -1
  8. package/dist/esm/commands/cache.js +0 -257
  9. package/dist/esm/commands/cache.js.map +0 -1
  10. package/dist/esm/commands/ci.d.ts +0 -11
  11. package/dist/esm/commands/ci.d.ts.map +0 -1
  12. package/dist/esm/commands/ci.js +0 -32
  13. package/dist/esm/commands/ci.js.map +0 -1
  14. package/dist/esm/commands/config.d.ts +0 -6
  15. package/dist/esm/commands/config.d.ts.map +0 -1
  16. package/dist/esm/commands/config.js +0 -424
  17. package/dist/esm/commands/config.js.map +0 -1
  18. package/dist/esm/commands/docs.d.ts +0 -18
  19. package/dist/esm/commands/docs.d.ts.map +0 -1
  20. package/dist/esm/commands/docs.js +0 -154
  21. package/dist/esm/commands/docs.js.map +0 -1
  22. package/dist/esm/commands/exec-cache.d.ts +0 -49
  23. package/dist/esm/commands/exec-cache.d.ts.map +0 -1
  24. package/dist/esm/commands/exec-cache.js +0 -146
  25. package/dist/esm/commands/exec-cache.js.map +0 -1
  26. package/dist/esm/commands/exec-local.d.ts +0 -6
  27. package/dist/esm/commands/exec-local.d.ts.map +0 -1
  28. package/dist/esm/commands/exec-local.js +0 -24
  29. package/dist/esm/commands/exec-local.js.map +0 -1
  30. package/dist/esm/commands/exec.d.ts +0 -9
  31. package/dist/esm/commands/exec.d.ts.map +0 -1
  32. package/dist/esm/commands/exec.js +0 -87
  33. package/dist/esm/commands/exec.js.map +0 -1
  34. package/dist/esm/commands/help.d.ts +0 -4
  35. package/dist/esm/commands/help.d.ts.map +0 -1
  36. package/dist/esm/commands/help.js +0 -39
  37. package/dist/esm/commands/help.js.map +0 -1
  38. package/dist/esm/commands/init.d.ts +0 -8
  39. package/dist/esm/commands/init.d.ts.map +0 -1
  40. package/dist/esm/commands/init.js +0 -111
  41. package/dist/esm/commands/init.js.map +0 -1
  42. package/dist/esm/commands/install/reporter.d.ts +0 -11
  43. package/dist/esm/commands/install/reporter.d.ts.map +0 -1
  44. package/dist/esm/commands/install/reporter.js +0 -94
  45. package/dist/esm/commands/install/reporter.js.map +0 -1
  46. package/dist/esm/commands/install.d.ts +0 -28
  47. package/dist/esm/commands/install.d.ts.map +0 -1
  48. package/dist/esm/commands/install.js +0 -45
  49. package/dist/esm/commands/install.js.map +0 -1
  50. package/dist/esm/commands/list.d.ts +0 -15
  51. package/dist/esm/commands/list.d.ts.map +0 -1
  52. package/dist/esm/commands/list.js +0 -199
  53. package/dist/esm/commands/list.js.map +0 -1
  54. package/dist/esm/commands/login.d.ts +0 -4
  55. package/dist/esm/commands/login.d.ts.map +0 -1
  56. package/dist/esm/commands/login.js +0 -13
  57. package/dist/esm/commands/login.js.map +0 -1
  58. package/dist/esm/commands/logout.d.ts +0 -4
  59. package/dist/esm/commands/logout.d.ts.map +0 -1
  60. package/dist/esm/commands/logout.js +0 -13
  61. package/dist/esm/commands/logout.js.map +0 -1
  62. package/dist/esm/commands/pack.d.ts +0 -32
  63. package/dist/esm/commands/pack.d.ts.map +0 -1
  64. package/dist/esm/commands/pack.js +0 -147
  65. package/dist/esm/commands/pack.js.map +0 -1
  66. package/dist/esm/commands/pkg.d.ts +0 -7
  67. package/dist/esm/commands/pkg.d.ts.map +0 -1
  68. package/dist/esm/commands/pkg.js +0 -206
  69. package/dist/esm/commands/pkg.js.map +0 -1
  70. package/dist/esm/commands/publish.d.ts +0 -22
  71. package/dist/esm/commands/publish.d.ts.map +0 -1
  72. package/dist/esm/commands/publish.js +0 -245
  73. package/dist/esm/commands/publish.js.map +0 -1
  74. package/dist/esm/commands/query.d.ts +0 -16
  75. package/dist/esm/commands/query.d.ts.map +0 -1
  76. package/dist/esm/commands/query.js +0 -214
  77. package/dist/esm/commands/query.js.map +0 -1
  78. package/dist/esm/commands/run-exec.d.ts +0 -6
  79. package/dist/esm/commands/run-exec.d.ts.map +0 -1
  80. package/dist/esm/commands/run-exec.js +0 -14
  81. package/dist/esm/commands/run-exec.js.map +0 -1
  82. package/dist/esm/commands/run.d.ts +0 -6
  83. package/dist/esm/commands/run.d.ts.map +0 -1
  84. package/dist/esm/commands/run.js +0 -36
  85. package/dist/esm/commands/run.js.map +0 -1
  86. package/dist/esm/commands/serve.d.ts +0 -14
  87. package/dist/esm/commands/serve.d.ts.map +0 -1
  88. package/dist/esm/commands/serve.js +0 -103
  89. package/dist/esm/commands/serve.js.map +0 -1
  90. package/dist/esm/commands/token.d.ts +0 -4
  91. package/dist/esm/commands/token.d.ts.map +0 -1
  92. package/dist/esm/commands/token.js +0 -30
  93. package/dist/esm/commands/token.js.map +0 -1
  94. package/dist/esm/commands/uninstall.d.ts +0 -16
  95. package/dist/esm/commands/uninstall.d.ts.map +0 -1
  96. package/dist/esm/commands/uninstall.js +0 -26
  97. package/dist/esm/commands/uninstall.js.map +0 -1
  98. package/dist/esm/commands/update.d.ts +0 -14
  99. package/dist/esm/commands/update.d.ts.map +0 -1
  100. package/dist/esm/commands/update.js +0 -41
  101. package/dist/esm/commands/update.js.map +0 -1
  102. package/dist/esm/commands/version.d.ts +0 -26
  103. package/dist/esm/commands/version.d.ts.map +0 -1
  104. package/dist/esm/commands/version.js +0 -226
  105. package/dist/esm/commands/version.js.map +0 -1
  106. package/dist/esm/commands/whoami.d.ts +0 -13
  107. package/dist/esm/commands/whoami.d.ts.map +0 -1
  108. package/dist/esm/commands/whoami.js +0 -19
  109. package/dist/esm/commands/whoami.js.map +0 -1
  110. package/dist/esm/config/definition.d.ts +0 -404
  111. package/dist/esm/config/definition.d.ts.map +0 -1
  112. package/dist/esm/config/definition.js +0 -657
  113. package/dist/esm/config/definition.js.map +0 -1
  114. package/dist/esm/config/index.d.ts +0 -219
  115. package/dist/esm/config/index.d.ts.map +0 -1
  116. package/dist/esm/config/index.js +0 -454
  117. package/dist/esm/config/index.js.map +0 -1
  118. package/dist/esm/config/merge.d.ts +0 -4
  119. package/dist/esm/config/merge.d.ts.map +0 -1
  120. package/dist/esm/config/merge.js +0 -28
  121. package/dist/esm/config/merge.js.map +0 -1
  122. package/dist/esm/config/usage.d.ts +0 -19
  123. package/dist/esm/config/usage.d.ts.map +0 -1
  124. package/dist/esm/config/usage.js +0 -40
  125. package/dist/esm/config/usage.js.map +0 -1
  126. package/dist/esm/custom-help.d.ts +0 -9
  127. package/dist/esm/custom-help.d.ts.map +0 -1
  128. package/dist/esm/custom-help.js +0 -400
  129. package/dist/esm/custom-help.js.map +0 -1
  130. package/dist/esm/exec-command.d.ts +0 -53
  131. package/dist/esm/exec-command.d.ts.map +0 -1
  132. package/dist/esm/exec-command.js +0 -308
  133. package/dist/esm/exec-command.js.map +0 -1
  134. package/dist/esm/index.d.ts +0 -4
  135. package/dist/esm/index.d.ts.map +0 -1
  136. package/dist/esm/index.js +0 -73
  137. package/dist/esm/index.js.map +0 -1
  138. package/dist/esm/load-command.d.ts +0 -16
  139. package/dist/esm/load-command.d.ts.map +0 -1
  140. package/dist/esm/load-command.js +0 -21
  141. package/dist/esm/load-command.js.map +0 -1
  142. package/dist/esm/output.d.ts +0 -21
  143. package/dist/esm/output.d.ts.map +0 -1
  144. package/dist/esm/output.js +0 -126
  145. package/dist/esm/output.js.map +0 -1
  146. package/dist/esm/pack-tarball.d.ts +0 -22
  147. package/dist/esm/pack-tarball.d.ts.map +0 -1
  148. package/dist/esm/pack-tarball.js +0 -249
  149. package/dist/esm/pack-tarball.js.map +0 -1
  150. package/dist/esm/package.json +0 -3
  151. package/dist/esm/parse-add-remove-args.d.ts +0 -22
  152. package/dist/esm/parse-add-remove-args.d.ts.map +0 -1
  153. package/dist/esm/parse-add-remove-args.js +0 -71
  154. package/dist/esm/parse-add-remove-args.js.map +0 -1
  155. package/dist/esm/print-err.d.ts +0 -14
  156. package/dist/esm/print-err.d.ts.map +0 -1
  157. package/dist/esm/print-err.js +0 -178
  158. package/dist/esm/print-err.js.map +0 -1
  159. package/dist/esm/query-host-contexts.d.ts +0 -16
  160. package/dist/esm/query-host-contexts.d.ts.map +0 -1
  161. package/dist/esm/query-host-contexts.js +0 -135
  162. package/dist/esm/query-host-contexts.js.map +0 -1
  163. package/dist/esm/read-password.d.ts +0 -8
  164. package/dist/esm/read-password.d.ts.map +0 -1
  165. package/dist/esm/read-password.js +0 -33
  166. package/dist/esm/read-password.js.map +0 -1
  167. package/dist/esm/start-gui.d.ts +0 -10
  168. package/dist/esm/start-gui.d.ts.map +0 -1
  169. package/dist/esm/start-gui.js +0 -60
  170. package/dist/esm/start-gui.js.map +0 -1
  171. package/dist/esm/view.d.ts +0 -30
  172. package/dist/esm/view.d.ts.map +0 -1
  173. package/dist/esm/view.js +0 -31
  174. package/dist/esm/view.js.map +0 -1
@@ -1,657 +0,0 @@
1
- import { error } from '@vltpkg/error-cause';
2
- import { XDG } from '@vltpkg/xdg';
3
- import { jack } from 'jackspeak';
4
- export const defaultView =
5
- // If stdout is a TTY, use human output
6
- process.stdout.isTTY ? 'human'
7
- // If its not a TTY but is a CI environment, use human output
8
- // TODO: make a better view option for CI environments
9
- : process.env.CI ? 'human'
10
- // Otherwise, use json output
11
- : 'json';
12
- export const defaultEditor = () => process.env.EDITOR ||
13
- process.env.VISUAL ||
14
- (process.platform === 'win32' ?
15
- `${process.env.SYSTEMROOT}\\notepad.exe`
16
- : 'vi');
17
- const canonicalCommands = {
18
- build: 'build',
19
- cache: 'cache',
20
- ci: 'ci',
21
- config: 'config',
22
- docs: 'docs',
23
- exec: 'exec',
24
- 'exec-local': 'exec-local',
25
- help: 'help',
26
- init: 'init',
27
- install: 'install',
28
- login: 'login',
29
- logout: 'logout',
30
- list: 'list',
31
- ls: 'ls',
32
- pack: 'pack',
33
- pkg: 'pkg',
34
- publish: 'publish',
35
- query: 'query',
36
- 'run-exec': 'run-exec',
37
- run: 'run',
38
- serve: 'serve',
39
- token: 'token',
40
- uninstall: 'uninstall',
41
- update: 'update',
42
- 'exec-cache': 'exec-cache',
43
- version: 'version',
44
- whoami: 'whoami',
45
- };
46
- const aliases = {
47
- i: 'install',
48
- add: 'install',
49
- rm: 'uninstall',
50
- u: 'update',
51
- p: 'pkg',
52
- pub: 'publish',
53
- q: 'query',
54
- b: 'build',
55
- r: 'run',
56
- 'run-script': 'run',
57
- rx: 'run-exec',
58
- s: 'serve',
59
- x: 'exec',
60
- xl: 'exec-local',
61
- h: 'help',
62
- '?': 'help',
63
- ls: 'list',
64
- xc: 'exec-cache',
65
- };
66
- /**
67
- * Command aliases mapped to their canonical names
68
- */
69
- export const commands = {
70
- ...canonicalCommands,
71
- ...aliases,
72
- };
73
- /**
74
- * Canonical command names mapped to an array of its aliases
75
- */
76
- export const commandAliases = Object.entries(aliases).reduce((acc, [alias, canonical]) => {
77
- const commandAliases = acc.get(canonical);
78
- if (commandAliases) {
79
- commandAliases.push(alias);
80
- }
81
- else {
82
- acc.set(canonical, [alias]);
83
- }
84
- return acc;
85
- }, new Map());
86
- export const getCommand = (s) => s && s in commands ? commands[s] : undefined;
87
- const xdg = new XDG('vlt');
88
- const cacheDir = xdg.cache();
89
- /**
90
- * Fields that are parsed as a set of key=value pairs
91
- */
92
- export const recordFields = [
93
- 'git-hosts',
94
- 'registries',
95
- 'git-host-archives',
96
- 'scope-registries',
97
- 'jsr-registries',
98
- ];
99
- export const isRecordField = (s) => recordFields.includes(s);
100
- const stopParsingCommands = [
101
- 'run',
102
- 'run-exec',
103
- 'exec-local',
104
- 'exec',
105
- ];
106
- let stopParsing = undefined;
107
- const j = jack({
108
- envPrefix: 'VLT',
109
- allowPositionals: true,
110
- usage: `vlt [<options>] [<cmd> [<args> ...]]`,
111
- stopAtPositionalTest: arg => {
112
- if (stopParsing)
113
- return true;
114
- const a = arg;
115
- // we stop parsing AFTER the thing, so you can do
116
- // vlt run --vlt --configs scriptName --args --for --script
117
- // or
118
- // vlt exec --vlt --configs command --args --for --command
119
- if (stopParsingCommands.includes(commands[a])) {
120
- stopParsing = true;
121
- }
122
- return false;
123
- },
124
- })
125
- .heading('vlt')
126
- .description(`More documentation available at <https://docs.vlt.sh>`)
127
- .heading('Subcommands');
128
- j.description(Object.keys(canonicalCommands).join(', '), {
129
- pre: true,
130
- }).description('Run `vlt <cmd> --help` for more information about a specific command');
131
- export const definition = j
132
- /**
133
- * Definition of all configuration values used by vlt.
134
- */
135
- .heading('Configuration')
136
- .description(`If a \`vlt.json\` file is present in the root of the current project,
137
- then that will be used as a source of configuration information.
138
-
139
- Next, the \`vlt.json\` file in the XDG specified config directory
140
- will be checked, and loaded for any fields not set in the local project.
141
-
142
- Object type values will be merged together. Set a field to \`null\` in
143
- the JSON configuration to explicitly remove it.
144
-
145
- Command-specific fields may be set in a nested \`command\` object that
146
- overrides any options defined at the top level.
147
- `)
148
- .flag({
149
- color: {
150
- short: 'c',
151
- description: 'Use colors (Default for TTY)',
152
- },
153
- 'no-color': {
154
- short: 'C',
155
- description: 'Do not use colors (Default for non-TTY)',
156
- },
157
- })
158
- .opt({
159
- registry: {
160
- hint: 'url',
161
- default: 'https://registry.npmjs.org/',
162
- description: `Sets the registry for fetching packages, when no registry
163
- is explicitly set on a specifier.
164
-
165
- For example, \`express@latest\` will be resolved by looking
166
- up the metadata from this registry.
167
-
168
- Note that alias specifiers starting with \`npm:\` will
169
- still map to \`https://registry.npmjs.org/\` if this is
170
- changed, unless the a new mapping is created via the
171
- \`--registries\` option.
172
- `,
173
- },
174
- })
175
- .optList({
176
- registries: {
177
- hint: 'name=url',
178
- description: `Specify named registry hosts by their prefix. To set the
179
- default registry used for non-namespaced specifiers,
180
- use the \`--registry\` option.
181
-
182
- Prefixes can be used as a package alias. For example:
183
-
184
- \`\`\`
185
- vlt --registries loc=http://reg.local install foo@loc:foo@1.x
186
- \`\`\`
187
-
188
- By default, the public npm registry is registered to the
189
- \`npm:\` prefix. It is not recommended to change this
190
- mapping in most cases.
191
- `,
192
- },
193
- 'scope-registries': {
194
- hint: '@scope=url',
195
- description: `Map package name scopes to registry URLs.
196
-
197
- For example,
198
- \`--scope-registries @acme=https://registry.acme/\`
199
- would tell vlt to fetch any packages named
200
- \`@acme/...\` from the \`https://registry.acme/\`
201
- registry.
202
-
203
- Note: this way of specifying registries is more ambiguous,
204
- compared with using the \`--registries\` field and explicit
205
- prefixes, because instead of failing when the configuration
206
- is absent, it will instead attempt to fetch from the
207
- default registry.
208
-
209
- By comparison, using
210
- \`--registries acme=https://registry.acme/\` and then
211
- specifying dependencies such as \`"foo": "acme:foo@1.x"\`
212
- means that regardless of the name, the package will be
213
- fetched from the explicitly named registry, or fail if
214
- no registry is defined with that name.
215
-
216
- However, custom registry aliases are not supported by other
217
- package managers.`,
218
- },
219
- 'jsr-registries': {
220
- hint: 'name=url',
221
- description: `Map alias names to JSR.io registry urls.
222
-
223
- For example,
224
- \`--jsr-registries acme=https://jsr.acme.io/\` would
225
- tell vlt to fetch any packages with the \`acme:\` registry
226
- prefix from the \`https://jsr.acme.io/\` registry, using
227
- the "npm Compatibility" translation. So for example,
228
- the package \`acme:@foo/bar\` would fetch the
229
- \`@jsr/foo__bar\` package from the \`jsr.acme.io\`
230
- registry.
231
-
232
- By default the \`jsr\` alias is always mapped to
233
- \`https://npm.jsr.io/\`, so existing \`jsr:\` packages will
234
- be fetched from the public \`jsr\` registry appropriately.
235
- `,
236
- },
237
- 'git-hosts': {
238
- hint: `name=template`,
239
- short: 'G',
240
- description: `Map a shorthand name to a git remote URL template.
241
-
242
- The \`template\` may contain placeholders, which will be
243
- swapped with the relevant values.
244
-
245
- \`$1\`, \`$2\`, etc. are replaced with the appropriate
246
- n-th path portion. For example, \`github:user/project\`
247
- would replace the \`$1\` in the template with \`user\`,
248
- and \`$2\` with \`project\`.`,
249
- },
250
- 'git-host-archives': {
251
- hint: `name=template`,
252
- short: 'A',
253
- description: `Similar to the \`--git-host <name>=<template>\` option,
254
- this option can define a template string that will be
255
- expanded to provide the URL to download a pre-built
256
- tarball of the git repository.
257
-
258
- In addition to the n-th path portion expansions performed
259
- by \`--git-host\`, this field will also expand the
260
- string \`$committish\` in the template, replacing it with
261
- the resolved git committish value to be fetched.`,
262
- },
263
- })
264
- .opt({
265
- cache: {
266
- hint: 'path',
267
- description: `
268
- Location of the vlt on-disk cache. Defaults to the platform-specific
269
- directory recommended by the XDG specification.
270
- `,
271
- default: cacheDir,
272
- },
273
- tag: {
274
- description: `Default \`dist-tag\` to install or publish`,
275
- default: 'latest',
276
- },
277
- before: {
278
- hint: 'date',
279
- description: `Do not install any packages published after this date`,
280
- },
281
- os: {
282
- description: `The operating system to use as the selector when choosing
283
- packages based on their \`os\` value.`,
284
- default: process.platform,
285
- },
286
- arch: {
287
- description: `CPU architecture to use as the selector when choosing
288
- packages based on their \`cpu\` value.`,
289
- default: process.arch,
290
- },
291
- 'node-version': {
292
- hint: 'version',
293
- description: `Node version to use when choosing packages based on
294
- their \`engines.node\` value.`,
295
- default: process.version,
296
- },
297
- })
298
- .flag({
299
- 'git-shallow': {
300
- description: `Set to force \`--depth=1\` on all git clone actions.
301
- When set explicitly to false with --no-git-shallow,
302
- then \`--depth=1\` will not be used.
303
-
304
- When not set explicitly, \`--depth=1\` will be used for
305
- git hosts known to support this behavior.`,
306
- },
307
- })
308
- .num({
309
- 'fetch-retries': {
310
- hint: 'n',
311
- description: `Number of retries to perform when encountering network
312
- errors or likely-transient errors from git hosts.`,
313
- default: 3,
314
- },
315
- 'fetch-retry-factor': {
316
- hint: 'n',
317
- description: `The exponential backoff factor to use when retrying
318
- requests due to network issues.`,
319
- default: 2,
320
- },
321
- 'fetch-retry-mintimeout': {
322
- hint: 'n',
323
- description: `Number of milliseconds before starting first retry`,
324
- default: 0,
325
- },
326
- 'fetch-retry-maxtimeout': {
327
- hint: 'n',
328
- description: `Maximum number of milliseconds between two retries`,
329
- default: 30_000,
330
- },
331
- 'stale-while-revalidate-factor': {
332
- hint: 'n',
333
- default: 60,
334
- description: `If the server does not serve a \`stale-while-revalidate\`
335
- value in the \`cache-control\` header, then this multiplier
336
- is applied to the \`max-age\` or \`s-maxage\` values.
337
-
338
- By default, this is \`60\`, so for example a response that
339
- is cacheable for 5 minutes will allow a stale response
340
- while revalidating for up to 5 hours.
341
-
342
- If the server *does* provide a \`stale-while-revalidate\`
343
- value, then that is always used.
344
-
345
- Set to 0 to prevent any \`stale-while-revalidate\` behavior
346
- unless explicitly allowed by the server's \`cache-control\`
347
- header.
348
- `,
349
- },
350
- })
351
- .opt({
352
- identity: {
353
- short: 'i',
354
- validate: (v) => typeof v === 'string' && /^[a-z0-9]*$/.test(v),
355
- hint: 'name',
356
- default: '',
357
- description: `Provide a string to define an identity for storing auth
358
- information when logging into registries.
359
-
360
- Authentication tokens will be stored in the XDG data
361
- directory, in \`vlt/auth/$\{identity}/keychain.json\`.
362
-
363
- If no identity is provided, then the default \`''\` will
364
- be used, storing the file at \`vlt/auth/keychain.json\`.
365
-
366
- May only contain lowercase alphanumeric characters.
367
- `,
368
- },
369
- })
370
- .optList({
371
- workspace: {
372
- hint: 'ws',
373
- short: 'w',
374
- description: `Set to limit the spaces being worked on when working on
375
- workspaces.
376
-
377
- Can be paths or glob patterns matching paths.
378
-
379
- Specifying workspaces by package.json name is not
380
- supported.`,
381
- },
382
- 'workspace-group': {
383
- short: 'g',
384
- description: `Specify named workspace group names to load and operate on
385
- when doing recursive operations on workspaces.`,
386
- },
387
- })
388
- .opt({
389
- scope: {
390
- short: 's',
391
- hint: 'query',
392
- description: 'Set to filter the scope of an operation using a DSS Query.',
393
- },
394
- target: {
395
- short: 't',
396
- hint: 'query',
397
- description: 'Set to select packages using a DSS Query selector.',
398
- },
399
- })
400
- .flag({
401
- 'if-present': {
402
- description: `When running scripts across multiple packages,
403
- only include packages that have the script.
404
-
405
- If this is not set, then the run will fail if any
406
- packages do not have the script.
407
-
408
- This will default to true if --scope, --workspace,
409
- --workspace-group, or --recursive is set. Otherwise,
410
- it will default to false.`,
411
- },
412
- })
413
- .flag({
414
- recursive: {
415
- short: 'r',
416
- description: `Run an operation across multiple workspaces.
417
-
418
- No effect when used in non-monorepo projects.
419
-
420
- Implied by setting --workspace or --workspace-group. If
421
- not set, then the action is run on the project root.`,
422
- },
423
- bail: {
424
- short: 'b',
425
- description: `When running scripts across multiple workspaces, stop
426
- on the first failure.`,
427
- default: true,
428
- },
429
- 'no-bail': {
430
- short: 'B',
431
- description: `When running scripts across multiple workspaces, continue
432
- on failure, running the script for all workspaces.`,
433
- },
434
- })
435
- .opt({
436
- config: {
437
- hint: 'all | user | project',
438
- description: `Specify which configuration to show or operate on when running
439
- \`vlt config\` commands. For read operations (get, pick, list):
440
- \`all\` shows merged configuration from both user and project
441
- files (default). For write operations (set, delete, edit):
442
- defaults to \`project\`. \`user\` shows/modifies only user-level
443
- configuration, \`project\` shows/modifies only project-level
444
- configuration.`,
445
- validOptions: ['all', 'user', 'project'],
446
- default: 'all',
447
- },
448
- editor: {
449
- hint: 'program',
450
- description: `The blocking editor to use for \`vlt config edit\` and
451
- any other cases where a file should be opened for
452
- editing.
453
-
454
- Defaults to the \`EDITOR\` or \`VISUAL\` env if set, or
455
- \`notepad.exe\` on Windows, or \`vi\` elsewhere.`,
456
- default: defaultEditor(),
457
- },
458
- 'script-shell': {
459
- hint: 'program',
460
- description: `The shell to use when executing \`package.json#scripts\`.
461
-
462
- For \`vlt exec\` and \`vlt exec-local\`, this is never set,
463
- meaning that command arguments are run exactly as provided.
464
-
465
- For \`vlt run\` (and other things that run lifecycle
466
- scripts in \`package.json#scripts\`), the entire command
467
- with all arguments is provided as a single string, meaning
468
- that some value must be provided for shell interpretation,
469
- and so for these contexts, the \`script-shell\` value will
470
- default to \`/bin/sh\` on POSIX systems or \`cmd.exe\` on
471
- Windows.
472
- `,
473
- },
474
- 'fallback-command': {
475
- hint: 'command',
476
- description: `The command to run when the first argument doesn't
477
- match any known commands.
478
-
479
- For pnpm-style behavior, set this to 'run-exec'. e.g:
480
- \`\`\`
481
- vlt config set fallback-command=run-exec
482
- \`\`\``,
483
- default: 'help',
484
- validOptions: Object.keys(canonicalCommands),
485
- },
486
- })
487
- .opt({
488
- package: {
489
- hint: 'p',
490
- description: `When running \`vlt exec\`, this allows you to explicitly
491
- set the package to search for bins. If not provided, then
492
- vlt will interpret the first argument as the package, and
493
- attempt to run the default executable.`,
494
- },
495
- })
496
- .opt({
497
- view: {
498
- hint: 'output',
499
- default: defaultView,
500
- description: `Configures the output format for commands.
501
-
502
- Defaults to \`human\` if stdout is a TTY, or \`json\`
503
- if it is not.
504
-
505
- - human: Maximally ergonomic output reporting for human
506
- consumption.
507
- - json: Parseable JSON output for machines.
508
- - inspect: Output results with \`util.inspect\`.
509
- - gui: Start a local web server and opens a browser to
510
- explore the results. (Only relevant for certain
511
- commands.)
512
- - mermaid: Output mermaid diagramming syntax. (Only
513
- relevant for certain commands.)
514
- - silent: Suppress all output to stdout.
515
-
516
- If the requested view format is not supported for the
517
- current command, or if no option is provided, then it
518
- will fall back to the default.
519
- `,
520
- validOptions: [
521
- 'human',
522
- 'json',
523
- 'mermaid',
524
- 'gui',
525
- 'inspect',
526
- 'silent',
527
- ],
528
- },
529
- })
530
- .optList({
531
- 'dashboard-root': {
532
- hint: 'path',
533
- description: `The root directory to use for the dashboard browser-based UI.
534
- If not set, the user home directory is used.`,
535
- },
536
- })
537
- .flag({
538
- 'save-dev': {
539
- short: 'D',
540
- description: `Save installed packages to a package.json file as
541
- devDependencies`,
542
- },
543
- 'save-optional': {
544
- short: 'O',
545
- description: `Save installed packages to a package.json file as
546
- optionalDependencies`,
547
- },
548
- 'save-peer': {
549
- description: `Save installed packages to a package.json file as
550
- peerDependencies`,
551
- },
552
- 'save-prod': {
553
- short: 'P',
554
- description: `Save installed packages into dependencies specifically.
555
- This is useful if a package already exists in
556
- devDependencies or optionalDependencies, but you want to
557
- move it to be a non-optional production dependency.`,
558
- },
559
- })
560
- .opt({
561
- 'expect-results': {
562
- hint: 'value',
563
- validate: (v) => typeof v === 'string' && /^([<>]=?)?[0-9]+$/.test(v),
564
- description: `When running \`vlt query\`, this option allows you to
565
- set a expected number of resulting items.
566
-
567
- Accepted values are numbers and strings.
568
-
569
- Strings starting with \`>\`, \`<\`, \`>=\` or \`<=\`
570
- followed by a number can be used to check if the result
571
- is greater than or less than a specific number.`,
572
- },
573
- })
574
- .flag({
575
- 'dry-run': {
576
- description: 'Run command without making any changes',
577
- },
578
- 'expect-lockfile': {
579
- description: 'Fail if lockfile is missing or out of date. Used by ci command to enforce lockfile integrity.',
580
- },
581
- 'frozen-lockfile': {
582
- description: 'Fail if lockfile is missing or out of sync with package.json. Prevents any lockfile modifications.',
583
- },
584
- 'lockfile-only': {
585
- description: 'Only update the lockfile (vlt-lock.json) and package.json files, skip all node_modules operations including package extraction and filesystem changes.',
586
- },
587
- })
588
- .opt({
589
- 'allow-scripts': {
590
- hint: 'query',
591
- description: `Filter which packages are allowed to run lifecycle scripts using DSS query syntax.
592
- When provided, only packages matching the query will execute their
593
- install, preinstall, postinstall, prepare, preprepare, and postprepare scripts.
594
- Defaults to ':not(*)' which means no scripts will be run.
595
-
596
- Example: --allow-scripts=":root > *, #my-package"
597
- Runs scripts only for direct dependencies of the current project and any occurrences
598
- of a specific dependency with the name "my-package" anywhere in the dependency graph.`,
599
- },
600
- })
601
- .opt({
602
- access: {
603
- description: 'Set the access level of the package',
604
- validOptions: ['public', 'restricted'],
605
- default: 'public',
606
- },
607
- })
608
- .opt({
609
- otp: {
610
- description: `Provide an OTP to use when publishing a package.`,
611
- },
612
- 'publish-directory': {
613
- hint: 'path',
614
- description: `Directory to use for pack and publish operations instead of the current directory.
615
- The directory must exist and nothing will be copied to it.`,
616
- },
617
- port: {
618
- hint: 'number',
619
- description: `Port for the browser-based UI server when using vlt serve command (default: 8000).`,
620
- },
621
- 'registry-port': {
622
- hint: 'number',
623
- description: `Port for the VSR registry when using vlt serve command (default: 1337).`,
624
- },
625
- })
626
- .flag({
627
- yes: {
628
- short: 'y',
629
- description: `Automatically accept any confirmation prompts`,
630
- },
631
- version: {
632
- short: 'v',
633
- description: 'Print the version',
634
- },
635
- help: {
636
- short: 'h',
637
- description: 'Print helpful information',
638
- },
639
- all: {
640
- short: 'a',
641
- description: 'Show all commands, bins, and flags',
642
- },
643
- });
644
- export const getSortedCliOptions = () => {
645
- const defs = definition.toJSON();
646
- return getSortedKeys().map((k) => {
647
- const def = defs[k];
648
- /* c8 ignore next */
649
- if (!def)
650
- throw error('invalid key found', { found: k });
651
- if (def.type === 'boolean')
652
- return `--${k}`;
653
- return `--${k}=<${def.hint ?? k}>`;
654
- });
655
- };
656
- export const getSortedKeys = () => Object.keys(definition.toJSON()).sort((a, b) => a.localeCompare(b));
657
- //# sourceMappingURL=definition.js.map