@vltpkg/cli-sdk 0.0.0-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +23 -0
- package/dist/esm/commands/cache.d.ts +65 -0
- package/dist/esm/commands/cache.d.ts.map +1 -0
- package/dist/esm/commands/cache.js +256 -0
- package/dist/esm/commands/cache.js.map +1 -0
- package/dist/esm/commands/config.d.ts +5 -0
- package/dist/esm/commands/config.d.ts.map +1 -0
- package/dist/esm/commands/config.js +153 -0
- package/dist/esm/commands/config.js.map +1 -0
- package/dist/esm/commands/exec-cache.d.ts +49 -0
- package/dist/esm/commands/exec-cache.d.ts.map +1 -0
- package/dist/esm/commands/exec-cache.js +125 -0
- package/dist/esm/commands/exec-cache.js.map +1 -0
- package/dist/esm/commands/exec-local.d.ts +6 -0
- package/dist/esm/commands/exec-local.d.ts.map +1 -0
- package/dist/esm/commands/exec-local.js +24 -0
- package/dist/esm/commands/exec-local.js.map +1 -0
- package/dist/esm/commands/exec.d.ts +9 -0
- package/dist/esm/commands/exec.d.ts.map +1 -0
- package/dist/esm/commands/exec.js +78 -0
- package/dist/esm/commands/exec.js.map +1 -0
- package/dist/esm/commands/gui.d.ts +6 -0
- package/dist/esm/commands/gui.d.ts.map +1 -0
- package/dist/esm/commands/gui.js +13 -0
- package/dist/esm/commands/gui.js.map +1 -0
- package/dist/esm/commands/help.d.ts +4 -0
- package/dist/esm/commands/help.d.ts.map +1 -0
- package/dist/esm/commands/help.js +10 -0
- package/dist/esm/commands/help.js.map +1 -0
- package/dist/esm/commands/init.d.ts +8 -0
- package/dist/esm/commands/init.d.ts.map +1 -0
- package/dist/esm/commands/init.js +25 -0
- package/dist/esm/commands/init.js.map +1 -0
- package/dist/esm/commands/install/reporter.d.ts +10 -0
- package/dist/esm/commands/install/reporter.d.ts.map +1 -0
- package/dist/esm/commands/install/reporter.js +67 -0
- package/dist/esm/commands/install/reporter.js.map +1 -0
- package/dist/esm/commands/install.d.ts +10 -0
- package/dist/esm/commands/install.d.ts.map +1 -0
- package/dist/esm/commands/install.js +21 -0
- package/dist/esm/commands/install.js.map +1 -0
- package/dist/esm/commands/list.d.ts +15 -0
- package/dist/esm/commands/list.d.ts.map +1 -0
- package/dist/esm/commands/list.js +109 -0
- package/dist/esm/commands/list.js.map +1 -0
- package/dist/esm/commands/login.d.ts +4 -0
- package/dist/esm/commands/login.d.ts.map +1 -0
- package/dist/esm/commands/login.js +13 -0
- package/dist/esm/commands/login.js.map +1 -0
- package/dist/esm/commands/logout.d.ts +4 -0
- package/dist/esm/commands/logout.d.ts.map +1 -0
- package/dist/esm/commands/logout.js +13 -0
- package/dist/esm/commands/logout.js.map +1 -0
- package/dist/esm/commands/pkg.d.ts +7 -0
- package/dist/esm/commands/pkg.d.ts.map +1 -0
- package/dist/esm/commands/pkg.js +123 -0
- package/dist/esm/commands/pkg.js.map +1 -0
- package/dist/esm/commands/query.d.ts +16 -0
- package/dist/esm/commands/query.d.ts.map +1 -0
- package/dist/esm/commands/query.js +124 -0
- package/dist/esm/commands/query.js.map +1 -0
- package/dist/esm/commands/run-exec.d.ts +6 -0
- package/dist/esm/commands/run-exec.d.ts.map +1 -0
- package/dist/esm/commands/run-exec.js +14 -0
- package/dist/esm/commands/run-exec.js.map +1 -0
- package/dist/esm/commands/run.d.ts +6 -0
- package/dist/esm/commands/run.d.ts.map +1 -0
- package/dist/esm/commands/run.js +37 -0
- package/dist/esm/commands/run.js.map +1 -0
- package/dist/esm/commands/token.d.ts +4 -0
- package/dist/esm/commands/token.d.ts.map +1 -0
- package/dist/esm/commands/token.js +30 -0
- package/dist/esm/commands/token.js.map +1 -0
- package/dist/esm/commands/uninstall.d.ts +10 -0
- package/dist/esm/commands/uninstall.d.ts.map +1 -0
- package/dist/esm/commands/uninstall.js +21 -0
- package/dist/esm/commands/uninstall.js.map +1 -0
- package/dist/esm/commands/whoami.d.ts +13 -0
- package/dist/esm/commands/whoami.d.ts.map +1 -0
- package/dist/esm/commands/whoami.js +19 -0
- package/dist/esm/commands/whoami.js.map +1 -0
- package/dist/esm/config/definition.d.ts +306 -0
- package/dist/esm/config/definition.d.ts.map +1 -0
- package/dist/esm/config/definition.js +517 -0
- package/dist/esm/config/definition.js.map +1 -0
- package/dist/esm/config/index.d.ts +206 -0
- package/dist/esm/config/index.d.ts.map +1 -0
- package/dist/esm/config/index.js +489 -0
- package/dist/esm/config/index.js.map +1 -0
- package/dist/esm/config/merge.d.ts +2 -0
- package/dist/esm/config/merge.d.ts.map +1 -0
- package/dist/esm/config/merge.js +23 -0
- package/dist/esm/config/merge.js.map +1 -0
- package/dist/esm/config/usage.d.ts +19 -0
- package/dist/esm/config/usage.d.ts.map +1 -0
- package/dist/esm/config/usage.js +40 -0
- package/dist/esm/config/usage.js.map +1 -0
- package/dist/esm/exec-command.d.ts +51 -0
- package/dist/esm/exec-command.d.ts.map +1 -0
- package/dist/esm/exec-command.js +199 -0
- package/dist/esm/exec-command.js.map +1 -0
- package/dist/esm/index.d.ts +17 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/output.d.ts +21 -0
- package/dist/esm/output.d.ts.map +1 -0
- package/dist/esm/output.js +121 -0
- package/dist/esm/output.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/parse-add-remove-args.d.ts +22 -0
- package/dist/esm/parse-add-remove-args.d.ts.map +1 -0
- package/dist/esm/parse-add-remove-args.js +71 -0
- package/dist/esm/parse-add-remove-args.js.map +1 -0
- package/dist/esm/print-err.d.ts +7 -0
- package/dist/esm/print-err.d.ts.map +1 -0
- package/dist/esm/print-err.js +115 -0
- package/dist/esm/print-err.js.map +1 -0
- package/dist/esm/read-password.d.ts +8 -0
- package/dist/esm/read-password.d.ts.map +1 -0
- package/dist/esm/read-password.js +33 -0
- package/dist/esm/read-password.js.map +1 -0
- package/dist/esm/start-gui.d.ts +9 -0
- package/dist/esm/start-gui.d.ts.map +1 -0
- package/dist/esm/start-gui.js +40 -0
- package/dist/esm/start-gui.js.map +1 -0
- package/dist/esm/view.d.ts +30 -0
- package/dist/esm/view.d.ts.map +1 -0
- package/dist/esm/view.js +31 -0
- package/dist/esm/view.js.map +1 -0
- package/package.json +125 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { error } from '@vltpkg/error-cause';
|
|
2
|
+
import { RollbackRemove } from '@vltpkg/rollback-remove';
|
|
3
|
+
import * as vlx from '@vltpkg/vlx';
|
|
4
|
+
import { basename } from 'node:path';
|
|
5
|
+
import { commandUsage } from "../config/usage.js";
|
|
6
|
+
import { stdout } from "../output.js";
|
|
7
|
+
import { ViewClass } from "../view.js";
|
|
8
|
+
let view;
|
|
9
|
+
export class ExecCacheView extends ViewClass {
|
|
10
|
+
constructor(options, conf) {
|
|
11
|
+
super(options, conf);
|
|
12
|
+
view = this;
|
|
13
|
+
}
|
|
14
|
+
stdout(...args) {
|
|
15
|
+
stdout(...args);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export const views = {
|
|
19
|
+
human: ExecCacheView,
|
|
20
|
+
};
|
|
21
|
+
const usageDef = {
|
|
22
|
+
command: 'exec-cache',
|
|
23
|
+
usage: '<command> [flags]',
|
|
24
|
+
description: 'Work with vlt exec-cache folders',
|
|
25
|
+
subcommands: {
|
|
26
|
+
ls: {
|
|
27
|
+
usage: '',
|
|
28
|
+
description: `Show previously installed packages used for \`vlt exec\`.
|
|
29
|
+
Key provided can be either the package name, or the full
|
|
30
|
+
key.`,
|
|
31
|
+
},
|
|
32
|
+
delete: {
|
|
33
|
+
usage: '[<key>...]',
|
|
34
|
+
description: `Delete previously installed packages used for
|
|
35
|
+
\`vlt exec\`. If no keys are provided, then all entries
|
|
36
|
+
will be deleted.`,
|
|
37
|
+
},
|
|
38
|
+
info: {
|
|
39
|
+
usage: '<key>',
|
|
40
|
+
description: `Show extended information about a given \`vlt exec\`
|
|
41
|
+
installation.`,
|
|
42
|
+
},
|
|
43
|
+
install: {
|
|
44
|
+
usage: '<spec>...',
|
|
45
|
+
description: `Install the specified package(s) in the \`vlt exec\`
|
|
46
|
+
central cache location. Metadata info about each
|
|
47
|
+
installation will be printed.`,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
examples: {
|
|
51
|
+
ls: {
|
|
52
|
+
description: `Show all the keys for the installations in the \`vlt exec\`
|
|
53
|
+
cache.`,
|
|
54
|
+
},
|
|
55
|
+
'delete typescript': {
|
|
56
|
+
description: `Delete all versions of typescript installed for vlt exec`,
|
|
57
|
+
},
|
|
58
|
+
'info typescript-695bf962': {
|
|
59
|
+
description: `Show extended info about a specific version of typescript`,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export const usage = () => commandUsage(usageDef);
|
|
64
|
+
export const command = async (conf) => {
|
|
65
|
+
const [sub, ...args] = conf.positionals;
|
|
66
|
+
switch (sub) {
|
|
67
|
+
case 'ls':
|
|
68
|
+
return ls(conf, args, view);
|
|
69
|
+
case 'info':
|
|
70
|
+
return info(conf, args, view);
|
|
71
|
+
case 'install':
|
|
72
|
+
return install(conf, args, view);
|
|
73
|
+
case 'delete':
|
|
74
|
+
return deleteEntries(conf, args, view);
|
|
75
|
+
default: {
|
|
76
|
+
throw error('Unrecognized exec-cache command', {
|
|
77
|
+
code: 'EUSAGE',
|
|
78
|
+
found: sub,
|
|
79
|
+
validOptions: Object.keys(usageDef.subcommands),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const install = async (conf, keys, view) => {
|
|
85
|
+
if (!keys.length) {
|
|
86
|
+
throw error('Must supply a package spec to install', {
|
|
87
|
+
code: 'EUSAGE',
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return Promise.all(keys.map(async (key) => {
|
|
91
|
+
const info = await vlx.install(key, conf.options);
|
|
92
|
+
view?.stdout(info);
|
|
93
|
+
return info.path;
|
|
94
|
+
}));
|
|
95
|
+
};
|
|
96
|
+
const ls = async (_conf, args, view) => {
|
|
97
|
+
const results = [];
|
|
98
|
+
for await (const path of vlx.list()) {
|
|
99
|
+
const key = basename(path);
|
|
100
|
+
if (args.length && !args.some(a => key.includes(a)))
|
|
101
|
+
continue;
|
|
102
|
+
results.push(key);
|
|
103
|
+
view?.stdout(key);
|
|
104
|
+
}
|
|
105
|
+
return results;
|
|
106
|
+
};
|
|
107
|
+
const info = async (conf, keys, view) => {
|
|
108
|
+
const results = [];
|
|
109
|
+
for await (const key of keys.length ? keys : vlx.list()) {
|
|
110
|
+
const info = vlx.info(key, conf.options);
|
|
111
|
+
results.push(info);
|
|
112
|
+
view?.stdout(info);
|
|
113
|
+
}
|
|
114
|
+
return results;
|
|
115
|
+
};
|
|
116
|
+
const deleteEntries = async (conf, keys, view) => {
|
|
117
|
+
const remover = new RollbackRemove();
|
|
118
|
+
const removed = (await vlx.delete(keys, remover, conf.options)).map(path => {
|
|
119
|
+
view?.stdout(`- ${basename(path)}`);
|
|
120
|
+
return path;
|
|
121
|
+
});
|
|
122
|
+
remover.confirm();
|
|
123
|
+
return removed;
|
|
124
|
+
};
|
|
125
|
+
//# sourceMappingURL=exec-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-cache.js","sourceRoot":"","sources":["../../../src/commands/exec-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAKtC,IAAI,IAAm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AA;QACnC,OAAO,IAAI,CAAA;IACb,CAAC,CACF,CAAA;IACD,OAAO,CAAC,OAAO,EAAE,CAAA;IACjB,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { VlxInfo } from '@vltpkg/vlx'\nimport * as vlx from '@vltpkg/vlx'\nimport { basename } from 'node:path'\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 { stdout } from '../output.ts'\nimport type { ViewOptions, Views } from '../view.ts'\nimport { ViewClass } from '../view.ts'\n\nexport type ExecCacheSubcommands =\n keyof (typeof usageDef)['subcommands']\n\nlet view: ExecCacheView\nexport class ExecCacheView 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 | string[] | VlxInfo[]> = {\n human: ExecCacheView,\n}\n\nconst usageDef = {\n command: 'exec-cache',\n usage: '<command> [flags]',\n description: 'Work with vlt exec-cache folders',\n\n subcommands: {\n ls: {\n usage: '',\n description: `Show previously installed packages used for \\`vlt exec\\`.\n Key provided can be either the package name, or the full\n key.`,\n },\n\n delete: {\n usage: '[<key>...]',\n description: `Delete previously installed packages used for\n \\`vlt exec\\`. If no keys are provided, then all entries\n will be deleted.`,\n },\n\n info: {\n usage: '<key>',\n description: `Show extended information about a given \\`vlt exec\\`\n installation.`,\n },\n\n install: {\n usage: '<spec>...',\n description: `Install the specified package(s) in the \\`vlt exec\\`\n central cache location. Metadata info about each\n installation will be printed.`,\n },\n },\n\n examples: {\n ls: {\n description: `Show all the keys for the installations in the \\`vlt exec\\`\n cache.`,\n },\n 'delete typescript': {\n description: `Delete all versions of typescript installed for vlt exec`,\n },\n 'info typescript-695bf962': {\n description: `Show extended info about a specific version of typescript`,\n },\n },\n} as const satisfies CommandUsageDefinition\n\nexport const usage: CommandUsage = () => commandUsage(usageDef)\n\nexport const command: CommandFn<\n string[] | VlxInfo[]\n> = 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 'install':\n return install(conf, args, view)\n\n case 'delete':\n return deleteEntries(conf, args, view)\n\n default: {\n throw error('Unrecognized exec-cache command', {\n code: 'EUSAGE',\n found: sub,\n validOptions: Object.keys(usageDef.subcommands),\n })\n }\n }\n}\n\nconst install = async (\n conf: LoadedConfig,\n keys: string[],\n view?: ExecCacheView,\n): Promise<string[]> => {\n if (!keys.length) {\n throw error('Must supply a package spec to install', {\n code: 'EUSAGE',\n })\n }\n return Promise.all(\n keys.map(async key => {\n const info = await vlx.install(key, conf.options)\n view?.stdout(info)\n return info.path\n }),\n )\n}\n\nconst ls = async (\n _conf: LoadedConfig,\n args: string[],\n view?: ExecCacheView,\n): Promise<string[]> => {\n const results: string[] = []\n for await (const path of vlx.list()) {\n const key = basename(path)\n if (args.length && !args.some(a => key.includes(a))) continue\n results.push(key)\n view?.stdout(key)\n }\n return results\n}\n\nconst info = async (\n conf: LoadedConfig,\n keys: string[],\n view?: ExecCacheView,\n): Promise<VlxInfo[]> => {\n const results: VlxInfo[] = []\n for await (const key of keys.length ? keys : vlx.list()) {\n const info = vlx.info(key, conf.options)\n results.push(info)\n view?.stdout(info)\n }\n return results\n}\n\nconst deleteEntries = async (\n conf: LoadedConfig,\n keys: string[],\n view?: ExecCacheView,\n): Promise<string[]> => {\n const remover = new RollbackRemove()\n const removed = (await vlx.delete(keys, remover, conf.options)).map(\n path => {\n view?.stdout(`- ${basename(path)}`)\n return path\n },\n )\n remover.confirm()\n return removed\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExecResult } from '../exec-command.ts';
|
|
2
|
+
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
3
|
+
export { views } from '../exec-command.ts';
|
|
4
|
+
export declare const usage: CommandUsage;
|
|
5
|
+
export declare const command: CommandFn<ExecResult>;
|
|
6
|
+
//# sourceMappingURL=exec-local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-local.d.ts","sourceRoot":"","sources":["../../../src/commands/exec-local.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,eAAO,MAAM,KAAK,EAAE,YAehB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,UAAU,CAGzC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { exec, execFG } from '@vltpkg/run';
|
|
2
|
+
import { commandUsage } from "../config/usage.js";
|
|
3
|
+
import { ExecCommand } from "../exec-command.js";
|
|
4
|
+
export { views } from "../exec-command.js";
|
|
5
|
+
export const usage = () => commandUsage({
|
|
6
|
+
command: 'exec-local',
|
|
7
|
+
usage: '[command]',
|
|
8
|
+
description: `Run an arbitrary command, with the local installed packages
|
|
9
|
+
first in the PATH. Ie, this will run your locally installed
|
|
10
|
+
package bins.
|
|
11
|
+
|
|
12
|
+
If no command is provided, then a shell is spawned in the
|
|
13
|
+
current working directory, with the locally installed package
|
|
14
|
+
bins first in the PATH.
|
|
15
|
+
|
|
16
|
+
Note that any vlt configs must be specified *before* the
|
|
17
|
+
command, as the remainder of the command line options are
|
|
18
|
+
provided to the exec process.`,
|
|
19
|
+
});
|
|
20
|
+
export const command = async (conf) => {
|
|
21
|
+
delete conf.options['script-shell'];
|
|
22
|
+
return await new ExecCommand(conf, exec, execFG).run();
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=exec-local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-local.js","sourceRoot":"","sources":["../../../src/commands/exec-local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE;;;;;;;;;;gDAU+B;CAC7C,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAA0B,KAAK,EAAC,IAAI,EAAC,EAAE;IACzD,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IACnC,OAAO,MAAM,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAA;AACxD,CAAC,CAAA","sourcesContent":["import { exec, execFG } from '@vltpkg/run'\nimport { commandUsage } from '../config/usage.ts'\nimport type { ExecResult } from '../exec-command.ts'\nimport { ExecCommand } from '../exec-command.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nexport { views } from '../exec-command.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'exec-local',\n usage: '[command]',\n description: `Run an arbitrary command, with the local installed packages\n first in the PATH. Ie, this will run your locally installed\n package bins.\n\n If no command is provided, then a shell is spawned in the\n current working directory, with the locally installed package\n bins first in the PATH.\n\n Note that any vlt configs must be specified *before* the\n command, as the remainder of the command line options are\n provided to the exec process.`,\n })\n\nexport const command: CommandFn<ExecResult> = async conf => {\n delete conf.options['script-shell']\n return await new ExecCommand(conf, exec, execFG).run()\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PromptFn } from '@vltpkg/vlx';
|
|
2
|
+
import type { ExecResult } from '../exec-command.ts';
|
|
3
|
+
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
4
|
+
export { views } from '../exec-command.ts';
|
|
5
|
+
export declare const usage: CommandUsage;
|
|
6
|
+
export declare const prettyPath: (path: string) => string;
|
|
7
|
+
export declare const promptFn: PromptFn;
|
|
8
|
+
export declare const command: CommandFn<ExecResult>;
|
|
9
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../../src/commands/exec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAK3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,eAAO,MAAM,KAAK,EAAE,YAoDhB,CAAA;AAGJ,eAAO,MAAM,UAAU,SAAU,MAAM,WAC2B,CAAA;AAElE,eAAO,MAAM,QAAQ,EAAE,QAyBtB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,UAAU,CAUzC,CAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { exec, execFG } from '@vltpkg/run';
|
|
2
|
+
import * as vlx from '@vltpkg/vlx';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { createInterface } from 'node:readline/promises';
|
|
5
|
+
import { commandUsage } from "../config/usage.js";
|
|
6
|
+
import { ExecCommand } from "../exec-command.js";
|
|
7
|
+
import { styleTextStdout } from "../output.js";
|
|
8
|
+
export { views } from "../exec-command.js";
|
|
9
|
+
export const usage = () => commandUsage({
|
|
10
|
+
command: 'exec',
|
|
11
|
+
usage: '[--package=<pkg>] [command...]',
|
|
12
|
+
description: `Run a command defined by a package, installing it
|
|
13
|
+
if necessary.
|
|
14
|
+
|
|
15
|
+
If the package specifier is provided explicitly via the
|
|
16
|
+
\`--package\` config, then that is what will be used. If
|
|
17
|
+
a satisfying instance of the named package exists in the
|
|
18
|
+
local \`node_mnodules\` folder, then that will be used.
|
|
19
|
+
|
|
20
|
+
If \`--package\` is not set, then vlt will attempt to infer
|
|
21
|
+
the package to be installed if necessary, in the following
|
|
22
|
+
manner:
|
|
23
|
+
|
|
24
|
+
- If the first argument is an executable found in the
|
|
25
|
+
\`node_modules/.bin\` folder (ie, provided by an
|
|
26
|
+
installed direct dependency), then that will be used.
|
|
27
|
+
The search stops, and nothing will be installed.
|
|
28
|
+
- Otherwise, vlt attempts to resolve the first argument
|
|
29
|
+
as if it was a \`--package\` option, and then swap it
|
|
30
|
+
out with the "default" executable provided by that
|
|
31
|
+
package.
|
|
32
|
+
|
|
33
|
+
The "default" executable provided by a package is:
|
|
34
|
+
|
|
35
|
+
- If the package provides a single executable string in the
|
|
36
|
+
\`bin\` field, then that is the executable to use.
|
|
37
|
+
- Otherwise, if there is a \`bin\` with the same name
|
|
38
|
+
as the package (or just the portion after the \`/\` in
|
|
39
|
+
the case of scoped packages), then that will be used.
|
|
40
|
+
|
|
41
|
+
If the appropriate excutable cannot be determined, then
|
|
42
|
+
an error will be raised.
|
|
43
|
+
|
|
44
|
+
At no point will \`vlt exec\` change the locally installed
|
|
45
|
+
dependencies. Any installs it performs is done in vlt's XDG
|
|
46
|
+
data directory.
|
|
47
|
+
`,
|
|
48
|
+
examples: {
|
|
49
|
+
'--package typescript@5 tsc': {
|
|
50
|
+
description: 'Run tsc provided by typescript version 5',
|
|
51
|
+
},
|
|
52
|
+
'eslint src/file.js': {
|
|
53
|
+
description: 'Run the default bin provided by eslint',
|
|
54
|
+
},
|
|
55
|
+
'eslint@9.24 src/file.js': {
|
|
56
|
+
description: 'Run the default bin provided by eslint version 9.24',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
const HOME = homedir();
|
|
61
|
+
export const prettyPath = (path) => path.startsWith(HOME) ? `~${path.substring(HOME.length)}` : path;
|
|
62
|
+
export const promptFn = async (pkgSpec, path, resolution) => {
|
|
63
|
+
const response = await createInterface(process.stdin, process.stdout).question(`About to install: ${styleTextStdout(['bgWhiteBright', 'black', 'bold'], String(pkgSpec))}
|
|
64
|
+
from: ${styleTextStdout(['bgWhiteBright', 'black', 'bold'], resolution)}
|
|
65
|
+
into: ${styleTextStdout(['bgWhiteBright', 'black', 'bold'], prettyPath(path))}
|
|
66
|
+
Is this ok? (y) `);
|
|
67
|
+
process.stdin.pause();
|
|
68
|
+
return response;
|
|
69
|
+
};
|
|
70
|
+
export const command = async (conf) => {
|
|
71
|
+
const arg0 = await vlx.resolve(conf.positionals, conf.options, promptFn);
|
|
72
|
+
if (arg0)
|
|
73
|
+
conf.positionals[0] = arg0;
|
|
74
|
+
// now we have arg0! let's gooooo!!
|
|
75
|
+
delete conf.options['script-shell'];
|
|
76
|
+
return await new ExecCommand(conf, exec, execFG).run();
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../../src/commands/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,KAAK,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AED,MAAM,CAAC,MAAM,OAAO,GAA0B,KAAK,EAAC,IAAI,EAAC,EAAE;IACzD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,OAAO,CAC5B,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,OAAO,EACZ,QAAQ,CACT,CAAA;IACD,IAAI,IAAI;QAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IACpC,mCAAmC;IACnC,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IACnC,OAAO,MAAM,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAA;AACxD,CAAC,CAAA","sourcesContent":["import { exec, execFG } from '@vltpkg/run'\nimport type { PromptFn } from '@vltpkg/vlx'\nimport * as vlx from '@vltpkg/vlx'\nimport { homedir } from 'node:os'\nimport { createInterface } from 'node:readline/promises'\nimport { commandUsage } from '../config/usage.ts'\nimport type { ExecResult } from '../exec-command.ts'\nimport { ExecCommand } from '../exec-command.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { styleTextStdout } from '../output.ts'\nexport { views } from '../exec-command.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'exec',\n usage: '[--package=<pkg>] [command...]',\n description: `Run a command defined by a package, installing it\n if necessary.\n\n If the package specifier is provided explicitly via the\n \\`--package\\` config, then that is what will be used. If\n a satisfying instance of the named package exists in the\n local \\`node_mnodules\\` folder, then that will be used.\n\n If \\`--package\\` is not set, then vlt will attempt to infer\n the package to be installed if necessary, in the following\n manner:\n\n - If the first argument is an executable found in the\n \\`node_modules/.bin\\` folder (ie, provided by an\n installed direct dependency), then that will be used.\n The search stops, and nothing will be installed.\n - Otherwise, vlt attempts to resolve the first argument\n as if it was a \\`--package\\` option, and then swap it\n out with the \"default\" executable provided by that\n package.\n\n The \"default\" executable provided by a package is:\n\n - If the package provides a single executable string in the\n \\`bin\\` field, then that is the executable to use.\n - Otherwise, if there is a \\`bin\\` with the same name\n as the package (or just the portion after the \\`/\\` in\n the case of scoped packages), then that will be used.\n\n If the appropriate excutable cannot be determined, then\n an error will be raised.\n\n At no point will \\`vlt exec\\` change the locally installed\n dependencies. Any installs it performs is done in vlt's XDG\n data directory.\n `,\n examples: {\n '--package typescript@5 tsc': {\n description: 'Run tsc provided by typescript version 5',\n },\n 'eslint src/file.js': {\n description: 'Run the default bin provided by eslint',\n },\n 'eslint@9.24 src/file.js': {\n description:\n 'Run the default bin provided by eslint version 9.24',\n },\n },\n })\n\nconst HOME = homedir()\nexport const prettyPath = (path: string) =>\n path.startsWith(HOME) ? `~${path.substring(HOME.length)}` : path\n\nexport const promptFn: PromptFn = async (\n pkgSpec,\n path,\n resolution,\n) => {\n const response = await createInterface(\n process.stdin,\n process.stdout,\n ).question(\n `About to install: ${styleTextStdout(\n ['bgWhiteBright', 'black', 'bold'],\n String(pkgSpec),\n )}\nfrom: ${styleTextStdout(\n ['bgWhiteBright', 'black', 'bold'],\n resolution,\n )}\ninto: ${styleTextStdout(\n ['bgWhiteBright', 'black', 'bold'],\n prettyPath(path),\n )}\nIs this ok? (y) `,\n )\n process.stdin.pause()\n return response\n}\n\nexport const command: CommandFn<ExecResult> = async conf => {\n const arg0 = await vlx.resolve(\n conf.positionals,\n conf.options,\n promptFn,\n )\n if (arg0) conf.positionals[0] = arg0\n // now we have arg0! let's gooooo!!\n delete conf.options['script-shell']\n return await new ExecCommand(conf, exec, execFG).run()\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
2
|
+
import type { ViewFn } from '../view.ts';
|
|
3
|
+
export declare const views: ViewFn<null>;
|
|
4
|
+
export declare const usage: CommandUsage;
|
|
5
|
+
export declare const command: CommandFn;
|
|
6
|
+
//# sourceMappingURL=gui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui.d.ts","sourceRoot":"","sources":["../../../src/commands/gui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGxC,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,IAAI,CAE9B,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,YAKhB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAA4B,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { commandUsage } from "../config/usage.js";
|
|
2
|
+
import { startGUI } from "../start-gui.js";
|
|
3
|
+
// this command is only a view, it doesn't actually do anything at this time
|
|
4
|
+
export const views = async (_, __, conf) => {
|
|
5
|
+
await startGUI(conf);
|
|
6
|
+
};
|
|
7
|
+
export const usage = () => commandUsage({
|
|
8
|
+
command: 'gui',
|
|
9
|
+
usage: '',
|
|
10
|
+
description: 'Launch a graphical user interface in a browser',
|
|
11
|
+
});
|
|
12
|
+
export const command = async () => null;
|
|
13
|
+
//# sourceMappingURL=gui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui.js","sourceRoot":"","sources":["../../../src/commands/gui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAG1C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,KAAK,GAAiB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;IACvD,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;AACtB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,EAAE;IACT,WAAW,EAAE,gDAAgD;CAC9D,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAc,KAAK,IAAI,EAAE,CAAC,IAAI,CAAA","sourcesContent":["import { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { startGUI } from '../start-gui.ts'\nimport type { ViewFn } from '../view.ts'\n\n// this command is only a view, it doesn't actually do anything at this time\nexport const views: ViewFn<null> = async (_, __, conf) => {\n await startGUI(conf)\n}\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'gui',\n usage: '',\n description: 'Launch a graphical user interface in a browser',\n })\n\nexport const command: CommandFn = async () => null\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/help.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1D,eAAO,MAAM,KAAK,EAAE,YAKhB,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,MAAM,CAErC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { commandUsage } from "../config/usage.js";
|
|
2
|
+
export const usage = () => commandUsage({
|
|
3
|
+
command: 'help',
|
|
4
|
+
usage: '',
|
|
5
|
+
description: 'Print the full help output for the CLI',
|
|
6
|
+
});
|
|
7
|
+
export const command = async (conf) => {
|
|
8
|
+
return conf.jack.usage();
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
2
|
+
import type { InitFileResults } from '@vltpkg/init';
|
|
3
|
+
export declare const usage: CommandUsage;
|
|
4
|
+
export declare const views: {
|
|
5
|
+
readonly human: (results: InitFileResults, _options: import("../view.ts").ViewOptions, _config: import("../config/index.ts").ParsedConfig) => string;
|
|
6
|
+
};
|
|
7
|
+
export declare const command: CommandFn<InitFileResults>;
|
|
8
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +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;AAGnD,eAAO,MAAM,KAAK,EAAE,YAKhB,CAAA;AAEJ,eAAO,MAAM,KAAK;;CAeyB,CAAA;AAE3C,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,eAAe,CACX,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { commandUsage } from "../config/usage.js";
|
|
2
|
+
import { init } from '@vltpkg/init';
|
|
3
|
+
export const usage = () => commandUsage({
|
|
4
|
+
command: 'init',
|
|
5
|
+
usage: '',
|
|
6
|
+
description: `Create a new package.json file in the current directory.`,
|
|
7
|
+
});
|
|
8
|
+
export const views = {
|
|
9
|
+
human: (results, _options, _config) => {
|
|
10
|
+
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}:
|
|
14
|
+
|
|
15
|
+
${JSON.stringify(data, null, 2)}
|
|
16
|
+
`);
|
|
17
|
+
}
|
|
18
|
+
output.push(`Modify/add properties using \`vlt pkg\`. For example:
|
|
19
|
+
|
|
20
|
+
vlt pkg set "description=My new project"`);
|
|
21
|
+
return output.join('\n');
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const command = async () => await init({ cwd: process.cwd() });
|
|
25
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +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,GAAG;IACnB,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;CACwC,CAAA;AAE3C,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 { 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 = {\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} as const satisfies Views<InitFileResults>\n\nexport const command: CommandFn<InitFileResults> = async () =>\n await init({ cwd: process.cwd() })\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ViewClass } from '../../view.ts';
|
|
2
|
+
export declare class InstallReporter extends ViewClass {
|
|
3
|
+
#private;
|
|
4
|
+
start(): void;
|
|
5
|
+
done(_result: unknown, { time }: {
|
|
6
|
+
time: number;
|
|
7
|
+
}): undefined;
|
|
8
|
+
error(err: unknown): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=reporter.d.ts.map
|
|
@@ -0,0 +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;AAiFzC,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"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { emitter } from '@vltpkg/output';
|
|
2
|
+
import { Box, render, Text } from 'ink';
|
|
3
|
+
import Spinner from 'ink-spinner';
|
|
4
|
+
import { createElement as $, Fragment, useLayoutEffect, useState, } from 'react';
|
|
5
|
+
import { stdout } from "../../output.js";
|
|
6
|
+
import { ViewClass } from "../../view.js";
|
|
7
|
+
import { asError } from '@vltpkg/error-cause';
|
|
8
|
+
const GraphStep = ({ text, step }) => {
|
|
9
|
+
if (step.state === 'waiting') {
|
|
10
|
+
return $(Text, { color: 'gray' }, text);
|
|
11
|
+
}
|
|
12
|
+
if (step.state === 'in_progress') {
|
|
13
|
+
return $(Text, { color: 'yellow' }, text, $(Spinner, { type: 'dots' }));
|
|
14
|
+
}
|
|
15
|
+
return $(Text, { color: 'green' }, text, ' ✓');
|
|
16
|
+
};
|
|
17
|
+
const App = () => {
|
|
18
|
+
const [requests, setRequests] = useState(0);
|
|
19
|
+
const [steps, setSteps] = useState({
|
|
20
|
+
build: {
|
|
21
|
+
state: 'waiting',
|
|
22
|
+
},
|
|
23
|
+
actual: {
|
|
24
|
+
state: 'waiting',
|
|
25
|
+
},
|
|
26
|
+
reify: {
|
|
27
|
+
state: 'waiting',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
useLayoutEffect(() => {
|
|
31
|
+
const update = () => setRequests(p => p + 1);
|
|
32
|
+
emitter.on('request', update);
|
|
33
|
+
return () => emitter.off('request', update);
|
|
34
|
+
}, []);
|
|
35
|
+
useLayoutEffect(() => {
|
|
36
|
+
const update = ({ step, state }) => {
|
|
37
|
+
setSteps(p => ({
|
|
38
|
+
...p,
|
|
39
|
+
[step]: {
|
|
40
|
+
...p[step],
|
|
41
|
+
state: state === 'start' ? 'in_progress' : 'completed',
|
|
42
|
+
},
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
emitter.on('graphStep', update);
|
|
46
|
+
return () => emitter.off('graphStep', update);
|
|
47
|
+
}, []);
|
|
48
|
+
return $(Fragment, null, $(Box, null, ...['build', 'actual', 'reify'].map((step, idx, list) => {
|
|
49
|
+
const separator = idx === list.length - 1 ? '' : ' > ';
|
|
50
|
+
return $(Text, { key: step }, $(GraphStep, { text: step, step: steps[step] }), $(Text, { color: 'gray' }, separator));
|
|
51
|
+
})), requests > 0 ? $(Text, null, `${requests} requests`) : null);
|
|
52
|
+
};
|
|
53
|
+
export class InstallReporter extends ViewClass {
|
|
54
|
+
#instance = null;
|
|
55
|
+
start() {
|
|
56
|
+
this.#instance = render($(App));
|
|
57
|
+
}
|
|
58
|
+
done(_result, { time }) {
|
|
59
|
+
this.#instance?.unmount();
|
|
60
|
+
stdout(`Done in ${time}ms`);
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
error(err) {
|
|
64
|
+
this.#instance?.unmount(asError(err));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=reporter.js.map
|
|
@@ -0,0 +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,EA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,CAAC,CACtC,CAAA;IACH,CAAC,CACF,CACF,EACD,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,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,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 useLayoutEffect,\n useState,\n} from 'react'\nimport { stdout } from '../../output.ts'\nimport { ViewClass } from '../../view.ts'\nimport { asError } from '@vltpkg/error-cause'\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(asError(err))\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Graph } from '@vltpkg/graph';
|
|
2
|
+
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
3
|
+
import { InstallReporter } from './install/reporter.ts';
|
|
4
|
+
export declare const usage: CommandUsage;
|
|
5
|
+
export declare const views: {
|
|
6
|
+
readonly json: (g: Graph) => import("@vltpkg/graph").LockfileData;
|
|
7
|
+
readonly human: typeof InstallReporter;
|
|
8
|
+
};
|
|
9
|
+
export declare const command: CommandFn<Graph>;
|
|
10
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +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;AAI1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,eAAO,MAAM,KAAK,EAAE,YAMhB,CAAA;AAEJ,eAAO,MAAM,KAAK;;;CAGe,CAAA;AAEjC,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,KAAK,CAKpC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { commandUsage } from "../config/usage.js";
|
|
2
|
+
import { install } from '@vltpkg/graph';
|
|
3
|
+
import { parseAddArgs } from "../parse-add-remove-args.js";
|
|
4
|
+
import { InstallReporter } from "./install/reporter.js";
|
|
5
|
+
export const usage = () => commandUsage({
|
|
6
|
+
command: 'install',
|
|
7
|
+
usage: '[packages ...]',
|
|
8
|
+
description: `Install the specified packages, updating package.json and
|
|
9
|
+
vlt-lock.json appropriately.`,
|
|
10
|
+
});
|
|
11
|
+
export const views = {
|
|
12
|
+
json: g => g.toJSON(),
|
|
13
|
+
human: InstallReporter,
|
|
14
|
+
};
|
|
15
|
+
export const command = async (conf) => {
|
|
16
|
+
const monorepo = conf.options.monorepo;
|
|
17
|
+
const { add } = parseAddArgs(conf, monorepo);
|
|
18
|
+
const { graph } = await install(conf.options, add);
|
|
19
|
+
return graph;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +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,GAAG;IACnB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,eAAe;CACS,CAAA;AAEjC,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 = {\n json: g => g.toJSON(),\n human: InstallReporter,\n} as const satisfies Views<Graph>\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"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HumanReadableOutputGraph, JSONOutputGraph, MermaidOutputGraph } from '@vltpkg/graph';
|
|
2
|
+
import { humanReadableOutput, jsonOutput, mermaidOutput } from '@vltpkg/graph';
|
|
3
|
+
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
4
|
+
export declare const usage: CommandUsage;
|
|
5
|
+
export type ListResult = JSONOutputGraph & MermaidOutputGraph & HumanReadableOutputGraph & {
|
|
6
|
+
queryString: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const views: {
|
|
9
|
+
readonly json: typeof jsonOutput;
|
|
10
|
+
readonly mermaid: typeof mermaidOutput;
|
|
11
|
+
readonly human: typeof humanReadableOutput;
|
|
12
|
+
readonly gui: ({ queryString }: ListResult, _: import("../view.ts").ViewOptions, conf: import("../config/index.ts").ParsedConfig) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export declare const command: CommandFn<ListResult>;
|
|
15
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +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,YA4ChB,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"}
|