@vltpkg/cli-sdk 1.0.0-rc.9 → 1.0.2
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/dist/commands/access.d.ts +23 -0
- package/dist/commands/access.js +251 -0
- package/dist/{esm/commands → commands}/bugs.d.ts +0 -1
- package/dist/{esm/commands → commands}/bugs.js +0 -1
- package/dist/{esm/commands → commands}/build.d.ts +1 -1
- package/dist/{esm/commands → commands}/build.js +1 -1
- package/dist/{esm/commands → commands}/cache.d.ts +1 -1
- package/dist/{esm/commands → commands}/cache.js +1 -1
- package/dist/{esm/commands → commands}/ci.d.ts +1 -1
- package/dist/{esm/commands → commands}/ci.js +12 -3
- package/dist/{esm/commands → commands}/config.d.ts +0 -1
- package/dist/{esm/commands → commands}/config.js +6 -1
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.js +103 -0
- package/dist/commands/deprecate.d.ts +14 -0
- package/dist/commands/deprecate.js +142 -0
- package/dist/commands/dist-tag.d.ts +22 -0
- package/dist/commands/dist-tag.js +179 -0
- package/dist/{esm/commands → commands}/docs.d.ts +0 -1
- package/dist/{esm/commands → commands}/docs.js +0 -1
- package/dist/{esm/commands → commands}/exec-cache.d.ts +1 -1
- package/dist/{esm/commands → commands}/exec-cache.js +1 -1
- package/dist/{esm/commands/run-exec.d.ts → commands/exec-local.d.ts} +0 -1
- package/dist/{esm/commands → commands}/exec-local.js +23 -1
- package/dist/{esm/commands → commands}/exec.d.ts +1 -1
- package/dist/{esm/commands → commands}/exec.js +85 -10
- package/dist/{esm/commands → commands}/help.d.ts +0 -1
- package/dist/{esm/commands → commands}/help.js +5 -1
- package/dist/{esm/commands → commands}/init.d.ts +0 -1
- package/dist/{esm/commands → commands}/init.js +31 -10
- package/dist/{esm/commands → commands}/install/reporter.d.ts +0 -1
- package/dist/{esm/commands → commands}/install/reporter.js +0 -1
- package/dist/{esm/commands → commands}/install.d.ts +22 -3
- package/dist/commands/install.js +152 -0
- package/dist/{esm/commands → commands}/list.d.ts +5 -2
- package/dist/{esm/commands → commands}/list.js +9 -10
- package/dist/{esm/commands → commands}/login.d.ts +0 -1
- package/dist/commands/login.js +35 -0
- package/dist/{esm/commands → commands}/logout.d.ts +1 -1
- package/dist/commands/logout.js +27 -0
- package/dist/{esm/commands → commands}/pack.d.ts +1 -1
- package/dist/{esm/commands → commands}/pack.js +91 -32
- package/dist/commands/ping.d.ts +18 -0
- package/dist/commands/ping.js +117 -0
- package/dist/{esm/commands → commands}/pkg.d.ts +0 -1
- package/dist/{esm/commands → commands}/pkg.js +27 -1
- package/dist/commands/profile.d.ts +14 -0
- package/dist/commands/profile.js +106 -0
- package/dist/{esm/commands → commands}/publish.d.ts +2 -2
- package/dist/{esm/commands → commands}/publish.js +70 -16
- package/dist/{esm/commands → commands}/query.d.ts +5 -2
- package/dist/{esm/commands → commands}/query.js +54 -11
- package/dist/commands/registry.d.ts +26 -0
- package/dist/commands/registry.js +99 -0
- package/dist/commands/repo.d.ts +17 -0
- package/dist/commands/repo.js +157 -0
- package/dist/{esm/commands/exec-local.d.ts → commands/run-exec.d.ts} +1 -1
- package/dist/commands/run-exec.js +41 -0
- package/dist/{esm/commands → commands}/run.d.ts +0 -1
- package/dist/{esm/commands → commands}/run.js +27 -1
- package/dist/commands/setup.d.ts +25 -0
- package/dist/commands/setup.js +155 -0
- package/dist/commands/token.d.ts +32 -0
- package/dist/commands/token.js +193 -0
- package/dist/{esm/commands → commands}/uninstall.d.ts +1 -1
- package/dist/{esm/commands → commands}/uninstall.js +15 -1
- package/dist/commands/unpublish.d.ts +16 -0
- package/dist/commands/unpublish.js +203 -0
- package/dist/{esm/commands → commands}/update.d.ts +1 -1
- package/dist/{esm/commands → commands}/update.js +7 -1
- package/dist/{esm/commands → commands}/version.d.ts +0 -1
- package/dist/{esm/commands → commands}/version.js +27 -1
- package/dist/commands/view.d.ts +23 -0
- package/dist/commands/view.js +335 -0
- package/dist/{esm/commands → commands}/whoami.d.ts +1 -1
- package/dist/commands/whoami.js +33 -0
- package/dist/{esm/config → config}/definition.d.ts +72 -19
- package/dist/{esm/config → config}/definition.js +157 -50
- package/dist/{esm/config → config}/index.d.ts +0 -1
- package/dist/{esm/config → config}/index.js +43 -2
- package/dist/{esm/config → config}/merge.d.ts +0 -1
- package/dist/{esm/config → config}/merge.js +0 -1
- package/dist/{esm/config → config}/usage.d.ts +0 -1
- package/dist/{esm/config → config}/usage.js +0 -1
- package/dist/{esm/custom-help.d.ts → custom-help.d.ts} +0 -1
- package/dist/{esm/custom-help.js → custom-help.js} +95 -120
- package/dist/{esm/exec-command.d.ts → exec-command.d.ts} +0 -1
- package/dist/{esm/exec-command.js → exec-command.js} +14 -8
- package/dist/{esm/index.d.ts → index.d.ts} +0 -1
- package/dist/{esm/index.js → index.js} +5 -2
- package/dist/{esm/load-command.d.ts → load-command.d.ts} +6 -1
- package/dist/{esm/load-command.js → load-command.js} +0 -1
- package/dist/mermaid-image-view.d.ts +18 -0
- package/dist/mermaid-image-view.js +36 -0
- package/dist/{esm/output.d.ts → output.d.ts} +2 -2
- package/dist/{esm/output.js → output.js} +70 -3
- package/dist/{esm/pack-tarball.d.ts → pack-tarball.d.ts} +15 -1
- package/dist/{esm/pack-tarball.js → pack-tarball.js} +133 -91
- package/dist/{esm/parse-add-remove-args.d.ts → parse-add-remove-args.d.ts} +0 -1
- package/dist/{esm/parse-add-remove-args.js → parse-add-remove-args.js} +65 -12
- package/dist/{esm/print-err.d.ts → print-err.d.ts} +0 -1
- package/dist/{esm/print-err.js → print-err.js} +28 -4
- package/dist/query-diff-files.d.ts +17 -0
- package/dist/query-diff-files.js +63 -0
- package/dist/{esm/query-host-contexts.d.ts → query-host-contexts.d.ts} +0 -1
- package/dist/{esm/query-host-contexts.js → query-host-contexts.js} +8 -7
- package/dist/{esm/read-password.d.ts → read-password.d.ts} +0 -1
- package/dist/{esm/read-password.js → read-password.js} +0 -1
- package/dist/read-project-folders.d.ts +17 -0
- package/dist/read-project-folders.js +100 -0
- package/dist/registry-error-message.d.ts +2 -0
- package/dist/registry-error-message.js +29 -0
- package/dist/reload-config.d.ts +2 -0
- package/dist/reload-config.js +11 -0
- package/dist/render-mermaid.d.ts +22 -0
- package/dist/render-mermaid.js +68 -0
- package/dist/require-registry.d.ts +48 -0
- package/dist/require-registry.js +122 -0
- package/dist/select-registry.d.ts +23 -0
- package/dist/select-registry.js +40 -0
- package/dist/telemetry.d.ts +58 -0
- package/dist/telemetry.js +170 -0
- package/dist/verbose-log.d.ts +31 -0
- package/dist/verbose-log.js +62 -0
- package/dist/{esm/view.d.ts → view.d.ts} +0 -1
- package/dist/{esm/view.js → view.js} +1 -2
- package/package.json +75 -82
- package/dist/esm/commands/bugs.d.ts.map +0 -1
- package/dist/esm/commands/bugs.js.map +0 -1
- package/dist/esm/commands/build.d.ts.map +0 -1
- package/dist/esm/commands/build.js.map +0 -1
- package/dist/esm/commands/cache.d.ts.map +0 -1
- package/dist/esm/commands/cache.js.map +0 -1
- package/dist/esm/commands/ci.d.ts.map +0 -1
- package/dist/esm/commands/ci.js.map +0 -1
- package/dist/esm/commands/config.d.ts.map +0 -1
- package/dist/esm/commands/config.js.map +0 -1
- package/dist/esm/commands/docs.d.ts.map +0 -1
- package/dist/esm/commands/docs.js.map +0 -1
- package/dist/esm/commands/exec-cache.d.ts.map +0 -1
- package/dist/esm/commands/exec-cache.js.map +0 -1
- package/dist/esm/commands/exec-local.d.ts.map +0 -1
- package/dist/esm/commands/exec-local.js.map +0 -1
- package/dist/esm/commands/exec.d.ts.map +0 -1
- package/dist/esm/commands/exec.js.map +0 -1
- package/dist/esm/commands/help.d.ts.map +0 -1
- package/dist/esm/commands/help.js.map +0 -1
- package/dist/esm/commands/init.d.ts.map +0 -1
- package/dist/esm/commands/init.js.map +0 -1
- package/dist/esm/commands/install/reporter.d.ts.map +0 -1
- package/dist/esm/commands/install/reporter.js.map +0 -1
- package/dist/esm/commands/install.d.ts.map +0 -1
- package/dist/esm/commands/install.js +0 -46
- package/dist/esm/commands/install.js.map +0 -1
- package/dist/esm/commands/list.d.ts.map +0 -1
- package/dist/esm/commands/list.js.map +0 -1
- package/dist/esm/commands/login.d.ts.map +0 -1
- package/dist/esm/commands/login.js +0 -13
- package/dist/esm/commands/login.js.map +0 -1
- package/dist/esm/commands/logout.d.ts.map +0 -1
- package/dist/esm/commands/logout.js +0 -13
- package/dist/esm/commands/logout.js.map +0 -1
- package/dist/esm/commands/pack.d.ts.map +0 -1
- package/dist/esm/commands/pack.js.map +0 -1
- package/dist/esm/commands/pkg.d.ts.map +0 -1
- package/dist/esm/commands/pkg.js.map +0 -1
- package/dist/esm/commands/publish.d.ts.map +0 -1
- package/dist/esm/commands/publish.js.map +0 -1
- package/dist/esm/commands/query.d.ts.map +0 -1
- package/dist/esm/commands/query.js.map +0 -1
- package/dist/esm/commands/run-exec.d.ts.map +0 -1
- package/dist/esm/commands/run-exec.js +0 -14
- package/dist/esm/commands/run-exec.js.map +0 -1
- package/dist/esm/commands/run.d.ts.map +0 -1
- package/dist/esm/commands/run.js.map +0 -1
- package/dist/esm/commands/serve.d.ts +0 -14
- package/dist/esm/commands/serve.d.ts.map +0 -1
- package/dist/esm/commands/serve.js +0 -103
- package/dist/esm/commands/serve.js.map +0 -1
- package/dist/esm/commands/token.d.ts +0 -4
- package/dist/esm/commands/token.d.ts.map +0 -1
- package/dist/esm/commands/token.js +0 -30
- package/dist/esm/commands/token.js.map +0 -1
- package/dist/esm/commands/uninstall.d.ts.map +0 -1
- package/dist/esm/commands/uninstall.js.map +0 -1
- package/dist/esm/commands/update.d.ts.map +0 -1
- package/dist/esm/commands/update.js.map +0 -1
- package/dist/esm/commands/version.d.ts.map +0 -1
- package/dist/esm/commands/version.js.map +0 -1
- package/dist/esm/commands/whoami.d.ts.map +0 -1
- package/dist/esm/commands/whoami.js +0 -19
- package/dist/esm/commands/whoami.js.map +0 -1
- package/dist/esm/config/definition.d.ts.map +0 -1
- package/dist/esm/config/definition.js.map +0 -1
- package/dist/esm/config/index.d.ts.map +0 -1
- package/dist/esm/config/index.js.map +0 -1
- package/dist/esm/config/merge.d.ts.map +0 -1
- package/dist/esm/config/merge.js.map +0 -1
- package/dist/esm/config/usage.d.ts.map +0 -1
- package/dist/esm/config/usage.js.map +0 -1
- package/dist/esm/custom-help.d.ts.map +0 -1
- package/dist/esm/custom-help.js.map +0 -1
- package/dist/esm/exec-command.d.ts.map +0 -1
- package/dist/esm/exec-command.js.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/load-command.d.ts.map +0 -1
- package/dist/esm/load-command.js.map +0 -1
- package/dist/esm/output.d.ts.map +0 -1
- package/dist/esm/output.js.map +0 -1
- package/dist/esm/pack-tarball.d.ts.map +0 -1
- package/dist/esm/pack-tarball.js.map +0 -1
- package/dist/esm/package.json +0 -3
- package/dist/esm/parse-add-remove-args.d.ts.map +0 -1
- package/dist/esm/parse-add-remove-args.js.map +0 -1
- package/dist/esm/print-err.d.ts.map +0 -1
- package/dist/esm/print-err.js.map +0 -1
- package/dist/esm/query-host-contexts.d.ts.map +0 -1
- package/dist/esm/query-host-contexts.js.map +0 -1
- package/dist/esm/read-password.d.ts.map +0 -1
- package/dist/esm/read-password.js.map +0 -1
- package/dist/esm/start-gui.d.ts +0 -10
- package/dist/esm/start-gui.d.ts.map +0 -1
- package/dist/esm/start-gui.js +0 -60
- package/dist/esm/start-gui.js.map +0 -1
- package/dist/esm/view.d.ts.map +0 -1
- package/dist/esm/view.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { loadPackageJson } from 'package-json-from-dist';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
+
import { commandAliases } from "./config/definition.js";
|
|
3
4
|
const { version } = loadPackageJson(import.meta.filename, process.env.__VLT_INTERNAL_CLI_PACKAGE_JSON);
|
|
4
5
|
// Custom yellow color: #FFE15D
|
|
5
6
|
const customYellow = chalk.hex('#FFE15D');
|
|
@@ -42,200 +43,176 @@ const makeStyler = (colors) => {
|
|
|
42
43
|
return styledText;
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Help metadata for every command target in the command registry. Using a
|
|
48
|
+
* record keyed by CommandName makes missing or stale entries a type error;
|
|
49
|
+
* aliases are derived separately from the registry below.
|
|
50
|
+
*/
|
|
51
|
+
const commandHelp = {
|
|
52
|
+
access: {
|
|
53
|
+
args: '<command> [<args>]',
|
|
54
|
+
desc: 'Manage package access and team permissions',
|
|
55
|
+
},
|
|
56
|
+
bugs: {
|
|
57
|
+
args: '[<spec>]',
|
|
58
|
+
desc: 'Open the bug tracker for a package',
|
|
59
|
+
},
|
|
60
|
+
build: {
|
|
50
61
|
args: '<selector>',
|
|
51
62
|
desc: 'Build packages with lifecycle scripts',
|
|
52
|
-
showByDefault: true,
|
|
53
63
|
defaultOrder: 4,
|
|
54
64
|
},
|
|
55
|
-
{
|
|
56
|
-
name: 'cache',
|
|
57
|
-
aliases: [],
|
|
65
|
+
cache: {
|
|
58
66
|
args: '[add|ls|info|clean|delete|delete-before|delete-all]',
|
|
59
67
|
desc: 'Manage the package cache',
|
|
60
|
-
showByDefault: false,
|
|
61
68
|
},
|
|
62
|
-
{
|
|
63
|
-
name: 'ci',
|
|
64
|
-
aliases: [],
|
|
69
|
+
ci: {
|
|
65
70
|
args: '',
|
|
66
71
|
desc: 'Clean install (frozen lockfile)',
|
|
67
|
-
showByDefault: false,
|
|
68
72
|
},
|
|
69
|
-
{
|
|
70
|
-
name: 'config',
|
|
71
|
-
aliases: [],
|
|
73
|
+
config: {
|
|
72
74
|
args: '[get|pick|list|set|delete|edit|location]',
|
|
73
75
|
desc: 'Get or set configuration',
|
|
74
|
-
showByDefault: false,
|
|
75
76
|
},
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
create: {
|
|
78
|
+
args: '<initializer> [args...]',
|
|
79
|
+
desc: 'Create a new project from a template',
|
|
80
|
+
},
|
|
81
|
+
deprecate: {
|
|
82
|
+
args: '<pkg>[@<version>] <message>',
|
|
83
|
+
desc: 'Deprecate a package or version range',
|
|
84
|
+
},
|
|
85
|
+
'dist-tag': {
|
|
86
|
+
args: '[add|rm|ls] [<args>]',
|
|
87
|
+
desc: 'Manage package distribution tags',
|
|
88
|
+
},
|
|
89
|
+
docs: {
|
|
79
90
|
args: '',
|
|
80
91
|
desc: 'Open the docs of the current project',
|
|
81
|
-
showByDefault: false,
|
|
82
92
|
},
|
|
83
|
-
{
|
|
84
|
-
name: 'exec',
|
|
85
|
-
aliases: ['x'],
|
|
93
|
+
exec: {
|
|
86
94
|
args: '<executable>',
|
|
87
95
|
desc: 'Execute a package bin',
|
|
88
|
-
showByDefault: true,
|
|
89
96
|
defaultOrder: 6,
|
|
90
97
|
},
|
|
91
|
-
{
|
|
92
|
-
name: 'exec-cache',
|
|
93
|
-
aliases: ['xc'],
|
|
98
|
+
'exec-cache': {
|
|
94
99
|
args: '[ls|delete|info|install]',
|
|
95
100
|
desc: 'Manage the exec cache',
|
|
96
|
-
showByDefault: false,
|
|
97
101
|
},
|
|
98
|
-
{
|
|
99
|
-
name: 'exec-local',
|
|
100
|
-
aliases: ['xl'],
|
|
102
|
+
'exec-local': {
|
|
101
103
|
args: '<command>',
|
|
102
104
|
desc: 'Execute a local package bin',
|
|
103
|
-
showByDefault: false,
|
|
104
105
|
},
|
|
105
|
-
{
|
|
106
|
-
name: 'help',
|
|
107
|
-
aliases: ['h', '?'],
|
|
106
|
+
help: {
|
|
108
107
|
args: '[<command>]',
|
|
109
108
|
desc: 'Show help for a command',
|
|
110
|
-
showByDefault: false,
|
|
111
109
|
},
|
|
112
|
-
{
|
|
113
|
-
name: 'init',
|
|
114
|
-
aliases: [],
|
|
110
|
+
init: {
|
|
115
111
|
args: '',
|
|
116
112
|
desc: 'Initialize a new project',
|
|
117
|
-
showByDefault: true,
|
|
118
113
|
defaultOrder: 1,
|
|
119
114
|
},
|
|
120
|
-
{
|
|
121
|
-
name: 'install',
|
|
122
|
-
aliases: ['i', 'add'],
|
|
115
|
+
install: {
|
|
123
116
|
args: '[<package>...]',
|
|
124
117
|
desc: 'Install dependencies',
|
|
125
|
-
showByDefault: true,
|
|
126
118
|
defaultOrder: 2,
|
|
127
119
|
},
|
|
128
|
-
{
|
|
129
|
-
name: 'list',
|
|
130
|
-
aliases: ['ls'],
|
|
120
|
+
list: {
|
|
131
121
|
args: '',
|
|
132
122
|
desc: 'List installed packages',
|
|
133
|
-
showByDefault: false,
|
|
134
123
|
},
|
|
135
|
-
{
|
|
136
|
-
name: 'login',
|
|
137
|
-
aliases: [],
|
|
124
|
+
login: {
|
|
138
125
|
args: '',
|
|
139
126
|
desc: 'Authenticate with a registry',
|
|
140
|
-
showByDefault: false,
|
|
141
127
|
},
|
|
142
|
-
{
|
|
143
|
-
name: 'logout',
|
|
144
|
-
aliases: [],
|
|
128
|
+
logout: {
|
|
145
129
|
args: '',
|
|
146
130
|
desc: 'Log out from a registry',
|
|
147
|
-
showByDefault: false,
|
|
148
131
|
},
|
|
149
|
-
{
|
|
150
|
-
name: 'pack',
|
|
151
|
-
aliases: [],
|
|
132
|
+
pack: {
|
|
152
133
|
args: '',
|
|
153
134
|
desc: 'Create a tarball from a package',
|
|
154
|
-
showByDefault: false,
|
|
155
135
|
},
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
136
|
+
ping: {
|
|
137
|
+
args: '[<registry-alias>]',
|
|
138
|
+
desc: 'Ping configured registries',
|
|
139
|
+
},
|
|
140
|
+
pkg: {
|
|
159
141
|
args: '<command>',
|
|
160
142
|
desc: 'Manage package metadata',
|
|
161
|
-
showByDefault: true,
|
|
162
143
|
defaultOrder: 7,
|
|
163
144
|
},
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
145
|
+
profile: {
|
|
146
|
+
args: '<command> [<args>]',
|
|
147
|
+
desc: 'Get or set registry profile properties',
|
|
148
|
+
},
|
|
149
|
+
publish: {
|
|
167
150
|
args: '',
|
|
168
151
|
desc: 'Publish package to registry',
|
|
169
|
-
showByDefault: true,
|
|
170
152
|
defaultOrder: 8,
|
|
171
153
|
},
|
|
172
|
-
{
|
|
173
|
-
name: 'query',
|
|
174
|
-
aliases: ['q'],
|
|
154
|
+
query: {
|
|
175
155
|
args: '<selector>',
|
|
176
156
|
desc: 'Query for packages in the project',
|
|
177
|
-
showByDefault: true,
|
|
178
157
|
defaultOrder: 3,
|
|
179
158
|
},
|
|
180
|
-
{
|
|
181
|
-
|
|
182
|
-
|
|
159
|
+
registry: {
|
|
160
|
+
args: '<alias> <command>',
|
|
161
|
+
desc: 'Run an account command against a named registry',
|
|
162
|
+
defaultOrder: 9,
|
|
163
|
+
},
|
|
164
|
+
repo: {
|
|
165
|
+
args: '[<spec>]',
|
|
166
|
+
desc: 'Open the repository page for a package',
|
|
167
|
+
},
|
|
168
|
+
run: {
|
|
183
169
|
args: '<script>',
|
|
184
170
|
desc: 'Run a script defined in package.json',
|
|
185
|
-
showByDefault: true,
|
|
186
171
|
defaultOrder: 5,
|
|
187
172
|
},
|
|
188
|
-
{
|
|
189
|
-
name: 'run-exec',
|
|
190
|
-
aliases: ['rx'],
|
|
173
|
+
'run-exec': {
|
|
191
174
|
args: '<script>',
|
|
192
175
|
desc: 'Run a script &/or fallback to executing a binary',
|
|
193
|
-
showByDefault: false,
|
|
194
176
|
},
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
desc: 'Start a local package registry server',
|
|
200
|
-
showByDefault: true,
|
|
201
|
-
defaultOrder: 9,
|
|
177
|
+
setup: {
|
|
178
|
+
args: '[<account>]',
|
|
179
|
+
desc: 'Configure your vlt.io account registries',
|
|
180
|
+
defaultOrder: 0,
|
|
202
181
|
},
|
|
203
|
-
{
|
|
204
|
-
name: 'token',
|
|
205
|
-
aliases: [],
|
|
182
|
+
token: {
|
|
206
183
|
args: '[add|rm]',
|
|
207
184
|
desc: 'Manage authentication tokens',
|
|
208
|
-
showByDefault: false,
|
|
209
185
|
},
|
|
210
|
-
{
|
|
211
|
-
name: 'uninstall',
|
|
212
|
-
aliases: ['rm'],
|
|
186
|
+
uninstall: {
|
|
213
187
|
args: '[<package>...]',
|
|
214
188
|
desc: 'Remove dependencies',
|
|
215
|
-
showByDefault: false,
|
|
216
189
|
},
|
|
217
|
-
{
|
|
218
|
-
|
|
219
|
-
|
|
190
|
+
unpublish: {
|
|
191
|
+
args: '<pkg>[@<version>]',
|
|
192
|
+
desc: 'Remove a package from the registry',
|
|
193
|
+
},
|
|
194
|
+
update: {
|
|
220
195
|
args: '',
|
|
221
196
|
desc: 'Update package versions to latest in-range',
|
|
222
|
-
showByDefault: false,
|
|
223
197
|
},
|
|
224
|
-
{
|
|
225
|
-
name: 'version',
|
|
226
|
-
aliases: [],
|
|
198
|
+
version: {
|
|
227
199
|
args: '<increment>',
|
|
228
200
|
desc: 'Bump package version',
|
|
229
|
-
showByDefault: false,
|
|
230
201
|
},
|
|
231
|
-
{
|
|
232
|
-
|
|
233
|
-
|
|
202
|
+
view: {
|
|
203
|
+
args: '<pkg>[@<version>] [<field>]',
|
|
204
|
+
desc: 'View registry information about a package',
|
|
205
|
+
},
|
|
206
|
+
whoami: {
|
|
234
207
|
args: '',
|
|
235
208
|
desc: 'Display the current user',
|
|
236
|
-
showByDefault: false,
|
|
237
209
|
},
|
|
238
|
-
|
|
210
|
+
};
|
|
211
|
+
const allCommands = Object.entries(commandHelp).map(([name, metadata]) => ({
|
|
212
|
+
name,
|
|
213
|
+
aliases: commandAliases.get(name) ?? [],
|
|
214
|
+
...metadata,
|
|
215
|
+
}));
|
|
239
216
|
/**
|
|
240
217
|
* Generates the custom default help output for vlt
|
|
241
218
|
*/
|
|
@@ -243,8 +220,8 @@ export const generateDefaultHelp = (colors = false) => {
|
|
|
243
220
|
const s = makeStyler(colors);
|
|
244
221
|
// Get default commands and sort by defaultOrder
|
|
245
222
|
const defaultCommands = allCommands
|
|
246
|
-
.filter(cmd => cmd.
|
|
247
|
-
.sort((a, b) => (a.defaultOrder
|
|
223
|
+
.filter(cmd => cmd.defaultOrder !== undefined)
|
|
224
|
+
.sort((a, b) => (a.defaultOrder ?? 0) - (b.defaultOrder ?? 0));
|
|
248
225
|
// Generate commands with tighter alias spacing but proper table structure
|
|
249
226
|
const commandsSection = defaultCommands
|
|
250
227
|
.map(cmd => {
|
|
@@ -255,7 +232,7 @@ export const generateDefaultHelp = (colors = false) => {
|
|
|
255
232
|
const nameColumn = cmd.name.padEnd(10);
|
|
256
233
|
// Consistent args column (14 chars)
|
|
257
234
|
const argsColumn = cmd.args.padEnd(16);
|
|
258
|
-
return ` ${s('dim', aliasColumn)}${s(['yellow', 'bold'], nameColumn)}${s('dim', argsColumn)}${cmd.desc}`;
|
|
235
|
+
return ` ${s('dim', aliasColumn)}${s(['yellow', 'bold'], nameColumn)}${s('dim', argsColumn)} ${cmd.desc}`;
|
|
259
236
|
})
|
|
260
237
|
.join('\n');
|
|
261
238
|
return `${s(['bold'], '⚡️ vlt')} ${s('dim', '/vōlt/')} next-gen package management ${s('dim', `v${version}`)}
|
|
@@ -291,6 +268,8 @@ export const generateFullHelp = (colors = false) => {
|
|
|
291
268
|
const s = makeStyler(colors);
|
|
292
269
|
// Use all commands sorted alphabetically
|
|
293
270
|
const commands = [...allCommands].sort((a, b) => a.name.localeCompare(b.name));
|
|
271
|
+
const aliasLabels = commands.map(cmd => cmd.aliases.length ? `${cmd.aliases.join(', ')},` : '');
|
|
272
|
+
const aliasWidth = Math.max(...aliasLabels.map(label => label.length));
|
|
294
273
|
// Define only globally applicable flags (alphabetically sorted by long name)
|
|
295
274
|
const flags = [
|
|
296
275
|
{
|
|
@@ -321,7 +300,7 @@ export const generateFullHelp = (colors = false) => {
|
|
|
321
300
|
shorts: [],
|
|
322
301
|
long: 'registry',
|
|
323
302
|
args: '<url>',
|
|
324
|
-
desc: '
|
|
303
|
+
desc: 'Set the registry to resolve packages against',
|
|
325
304
|
},
|
|
326
305
|
{
|
|
327
306
|
shorts: ['v'],
|
|
@@ -345,17 +324,14 @@ export const generateFullHelp = (colors = false) => {
|
|
|
345
324
|
if (firstLetter !== lastFirstLetter && index > 0) {
|
|
346
325
|
commandsSection += '\n';
|
|
347
326
|
}
|
|
348
|
-
|
|
349
|
-
const aliasColumn = cmd.aliases.length > 0 ?
|
|
350
|
-
(cmd.aliases.join(', ') + ', ').padEnd(9)
|
|
351
|
-
: ' ';
|
|
327
|
+
const aliasColumn = aliasLabels[index]?.padEnd(aliasWidth) ?? '';
|
|
352
328
|
const nameColumn = cmd.name.padEnd(12);
|
|
353
329
|
// Truncate args if longer than 16 chars and add ellipsis
|
|
354
330
|
const truncatedArgs = cmd.args.length > 16 ?
|
|
355
331
|
cmd.args.substring(0, 13) + '...'
|
|
356
332
|
: cmd.args;
|
|
357
333
|
const argsColumn = truncatedArgs.padEnd(16);
|
|
358
|
-
commandsSection +=
|
|
334
|
+
commandsSection += ` ${s('dim', aliasColumn)} ${s(['yellow', 'bold'], nameColumn)} ${s('dim', argsColumn)} ${cmd.desc}`;
|
|
359
335
|
if (index < commands.length - 1) {
|
|
360
336
|
commandsSection += '\n';
|
|
361
337
|
}
|
|
@@ -397,4 +373,3 @@ Get support: https://${s('bold', 'vlt.community')}
|
|
|
397
373
|
|
|
398
374
|
${s('dim', `Run \`vlt help <command>\` for detailed information about a specific command.`)}`;
|
|
399
375
|
};
|
|
400
|
-
//# sourceMappingURL=custom-help.js.map
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { error } from '@vltpkg/error-cause';
|
|
6
6
|
import { isErrorWithCause } from '@vltpkg/types';
|
|
7
7
|
import { Query } from '@vltpkg/query';
|
|
8
|
+
import { createDiffFilesProvider } from "./query-diff-files.js";
|
|
8
9
|
import { actual } from '@vltpkg/graph';
|
|
9
10
|
import { isRunResult } from '@vltpkg/run';
|
|
10
11
|
import { Monorepo } from '@vltpkg/workspaces';
|
|
@@ -72,11 +73,11 @@ export class ExecCommand {
|
|
|
72
73
|
this.conf = conf;
|
|
73
74
|
this.bg = bg;
|
|
74
75
|
this.fg = fg;
|
|
75
|
-
this.view = this.validViewValues.get(conf.values.view) ?? 'human';
|
|
76
76
|
const { projectRoot, positionals: [arg0, ...args], } = conf;
|
|
77
77
|
this.arg0 = arg0;
|
|
78
78
|
this.args = args;
|
|
79
79
|
this.projectRoot = projectRoot;
|
|
80
|
+
this.view = this.validViewValues.get(conf.values.view) ?? 'human';
|
|
80
81
|
}
|
|
81
82
|
#targetCount() {
|
|
82
83
|
if (this.#nodes)
|
|
@@ -114,6 +115,7 @@ export class ExecCommand {
|
|
|
114
115
|
/* c8 ignore stop */
|
|
115
116
|
securityArchive: undefined,
|
|
116
117
|
hostContexts,
|
|
118
|
+
diffFiles: createDiffFilesProvider(this.projectRoot),
|
|
117
119
|
});
|
|
118
120
|
const { nodes } = await query.search(queryString, {
|
|
119
121
|
signal: new AbortController().signal,
|
|
@@ -195,10 +197,6 @@ export class ExecCommand {
|
|
|
195
197
|
}
|
|
196
198
|
const results = {};
|
|
197
199
|
for (const [path, result] of resultMap) {
|
|
198
|
-
if (result.status === 0 && result.signal === null) {
|
|
199
|
-
result.stdout = '';
|
|
200
|
-
result.stderr = '';
|
|
201
|
-
}
|
|
202
200
|
results[path] = result;
|
|
203
201
|
}
|
|
204
202
|
return results;
|
|
@@ -208,6 +206,12 @@ export class ExecCommand {
|
|
|
208
206
|
if (this.view !== 'human')
|
|
209
207
|
return;
|
|
210
208
|
if (result.status === 0 && result.signal === null) {
|
|
209
|
+
/* c8 ignore start */
|
|
210
|
+
if (result.stderr)
|
|
211
|
+
stderr(ansiToAnsi(result.stderr));
|
|
212
|
+
if (result.stdout)
|
|
213
|
+
stdout(ansiToAnsi(result.stdout));
|
|
214
|
+
/* c8 ignore stop */
|
|
211
215
|
stdout(path, 'ok');
|
|
212
216
|
}
|
|
213
217
|
else {
|
|
@@ -241,8 +245,10 @@ export class ExecCommand {
|
|
|
241
245
|
assert(first, error('no nodes found'));
|
|
242
246
|
return resolve(this.projectRoot, first);
|
|
243
247
|
}
|
|
244
|
-
|
|
245
|
-
|
|
248
|
+
// When no workspace/monorepo targeting is specified, use the current
|
|
249
|
+
// working directory. This matches npx behavior and is required for
|
|
250
|
+
// tools like node-gyp that must run in the correct directory.
|
|
251
|
+
return (this.#monorepo?.values().next().value?.fullpath ?? process.cwd());
|
|
246
252
|
}
|
|
247
253
|
fgArg() {
|
|
248
254
|
const cwd = this.getCwd();
|
|
@@ -255,6 +261,7 @@ export class ExecCommand {
|
|
|
255
261
|
arg0,
|
|
256
262
|
args: this.args,
|
|
257
263
|
env: this.env,
|
|
264
|
+
ignoreMissing: this.conf.get('if-present') ?? this.#defaultIgnoreMissing,
|
|
258
265
|
projectRoot: this.projectRoot,
|
|
259
266
|
packageJson: this.conf.options.packageJson,
|
|
260
267
|
'script-shell': this.arg0 ? this.conf.get('script-shell') : false,
|
|
@@ -305,4 +312,3 @@ export class ExecCommand {
|
|
|
305
312
|
return targets;
|
|
306
313
|
}
|
|
307
314
|
}
|
|
308
|
-
//# sourceMappingURL=exec-command.js.map
|
|
@@ -66,8 +66,11 @@ const run = async () => {
|
|
|
66
66
|
}
|
|
67
67
|
return process.exit(process.exitCode || 1);
|
|
68
68
|
}
|
|
69
|
+
if (vlt.command === 'registry') {
|
|
70
|
+
const { dispatchRegistry } = await import("./commands/registry.js");
|
|
71
|
+
await dispatchRegistry(vlt);
|
|
72
|
+
}
|
|
69
73
|
const command = await loadCommand(vlt.command);
|
|
70
|
-
await outputCommand(command, vlt, { start });
|
|
74
|
+
await outputCommand(command, vlt, { start, vltVersion: version });
|
|
71
75
|
};
|
|
72
76
|
export default run;
|
|
73
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -11,6 +11,11 @@ export type Command<T> = {
|
|
|
11
11
|
command: CommandFn<T>;
|
|
12
12
|
usage: CommandUsage;
|
|
13
13
|
views: Views<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Set to `true` by commands that hit a registry or resolve registry
|
|
16
|
+
* specs. There is no default registry, so `outputCommand()` fails
|
|
17
|
+
* early with an `ECONFIG` error when one of these runs unconfigured.
|
|
18
|
+
*/
|
|
19
|
+
needsRegistry?: boolean;
|
|
14
20
|
};
|
|
15
21
|
export declare const loadCommand: <T>(command: Commands[keyof Commands] | undefined) => Promise<Command<T>>;
|
|
16
|
-
//# sourceMappingURL=load-command.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ViewClass } from './view.ts';
|
|
2
|
+
import type { OutputFormat } from './render-mermaid.ts';
|
|
3
|
+
import type { MermaidOutputGraph } from '@vltpkg/graph';
|
|
4
|
+
/**
|
|
5
|
+
* A ViewClass that renders mermaid output as SVG or PNG
|
|
6
|
+
* (saved to a temp file and opened).
|
|
7
|
+
*
|
|
8
|
+
* Uses `beautiful-mermaid` for SVG rendering and
|
|
9
|
+
* `@resvg/resvg-wasm` for PNG conversion — no external
|
|
10
|
+
* process spawning.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MermaidImageView extends ViewClass<MermaidOutputGraph> {
|
|
13
|
+
format: OutputFormat;
|
|
14
|
+
constructor(...args: ConstructorParameters<typeof ViewClass<MermaidOutputGraph>>);
|
|
15
|
+
done(result: MermaidOutputGraph, _opts: {
|
|
16
|
+
time: number;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { mermaidOutput } from '@vltpkg/graph';
|
|
2
|
+
import { urlOpen } from '@vltpkg/url-open';
|
|
3
|
+
import { stderr } from "./output.js";
|
|
4
|
+
import { ViewClass } from "./view.js";
|
|
5
|
+
/**
|
|
6
|
+
* A ViewClass that renders mermaid output as SVG or PNG
|
|
7
|
+
* (saved to a temp file and opened).
|
|
8
|
+
*
|
|
9
|
+
* Uses `beautiful-mermaid` for SVG rendering and
|
|
10
|
+
* `@resvg/resvg-wasm` for PNG conversion — no external
|
|
11
|
+
* process spawning.
|
|
12
|
+
*/
|
|
13
|
+
export class MermaidImageView extends ViewClass {
|
|
14
|
+
format;
|
|
15
|
+
constructor(...args) {
|
|
16
|
+
super(...args);
|
|
17
|
+
this.format = this.config.values.view;
|
|
18
|
+
}
|
|
19
|
+
async done(result, _opts) {
|
|
20
|
+
const mermaidText = mermaidOutput(result);
|
|
21
|
+
// Dynamic import to avoid loading render-mermaid eagerly
|
|
22
|
+
const { renderMermaidToFile, renderMermaidToPng } = await import("./render-mermaid.js");
|
|
23
|
+
if (this.format === 'png') {
|
|
24
|
+
stderr(`Generating PNG image...`);
|
|
25
|
+
const filePath = await renderMermaidToPng(mermaidText);
|
|
26
|
+
stderr(`Image saved to: ${filePath}`);
|
|
27
|
+
await urlOpen(filePath);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
stderr(`Generating SVG image...`);
|
|
31
|
+
const filePath = await renderMermaidToFile(mermaidText);
|
|
32
|
+
stderr(`Image saved to: ${filePath}`);
|
|
33
|
+
await urlOpen(filePath);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -14,8 +14,8 @@ export type OnDone<T> = (result: T) => Promise<unknown>;
|
|
|
14
14
|
* the user-requested view, or the default if the user requested a view
|
|
15
15
|
* that is not defined for this command.
|
|
16
16
|
*/
|
|
17
|
-
export declare const outputCommand: <T>(cliCommand: Command<T>, conf: LoadedConfig, { start }?: {
|
|
17
|
+
export declare const outputCommand: <T>(cliCommand: Command<T>, conf: LoadedConfig, { start, vltVersion }?: {
|
|
18
18
|
start: number;
|
|
19
|
+
vltVersion?: string;
|
|
19
20
|
}) => Promise<void>;
|
|
20
21
|
export {};
|
|
21
|
-
//# sourceMappingURL=output.d.ts.map
|
|
@@ -2,8 +2,20 @@ import { formatWithOptions, styleText as utilStyleText, } from 'node:util';
|
|
|
2
2
|
import { createSupportsColor } from 'supports-color';
|
|
3
3
|
import { defaultView } from "./config/definition.js";
|
|
4
4
|
import { printErr, formatOptions } from "./print-err.js";
|
|
5
|
+
import { hasConfiguredRegistry, missingRegistryError, } from "./require-registry.js";
|
|
5
6
|
import { isViewClass } from "./view.js";
|
|
6
7
|
import { generateDefaultHelp, generateFullHelp, } from "./custom-help.js";
|
|
8
|
+
import { flush as flushTelemetry, trackCommand, trackError, } from "./telemetry.js";
|
|
9
|
+
import { startRequestLog } from "./verbose-log.js";
|
|
10
|
+
/* c8 ignore start - CI env detection is a best-effort heuristic */
|
|
11
|
+
const isCI = () => !!(process.env.CI ||
|
|
12
|
+
process.env.GITHUB_ACTIONS ||
|
|
13
|
+
process.env.GITLAB_CI ||
|
|
14
|
+
process.env.CIRCLECI ||
|
|
15
|
+
process.env.JENKINS_URL ||
|
|
16
|
+
process.env.BUILDKITE ||
|
|
17
|
+
process.env.TRAVIS);
|
|
18
|
+
/* c8 ignore stop */
|
|
7
19
|
const supportsColor = (stream) => {
|
|
8
20
|
const res = createSupportsColor(stream, { sniffFlags: false });
|
|
9
21
|
if (res === false)
|
|
@@ -77,8 +89,10 @@ const startView = (conf, opts, views, { start } = { start: Date.now() }) => {
|
|
|
77
89
|
* the user-requested view, or the default if the user requested a view
|
|
78
90
|
* that is not defined for this command.
|
|
79
91
|
*/
|
|
80
|
-
export const outputCommand = async (cliCommand, conf, { start } = {
|
|
81
|
-
|
|
92
|
+
export const outputCommand = async (cliCommand, conf, { start, vltVersion } = {
|
|
93
|
+
start: Date.now(),
|
|
94
|
+
}) => {
|
|
95
|
+
const { usage, views, command, needsRegistry } = cliCommand;
|
|
82
96
|
const stdoutColor = conf.values.color ?? supportsColor(process.stdout);
|
|
83
97
|
const stderrColor = conf.values.color ?? supportsColor(process.stderr);
|
|
84
98
|
if (conf.values.help) {
|
|
@@ -99,11 +113,35 @@ export const outputCommand = async (cliCommand, conf, { start } = { start: Date.
|
|
|
99
113
|
if (stderrColor)
|
|
100
114
|
styleTextStderr = styleText;
|
|
101
115
|
/* c8 ignore stop */
|
|
116
|
+
// Stream per-request diagnostics to stderr when `--loglevel` is verbose
|
|
117
|
+
// or higher (e.g. via `--verbose`). No-op otherwise.
|
|
118
|
+
const stopRequestLog = startRequestLog(conf.values.loglevel, line => stderr(line), styleTextStderr);
|
|
102
119
|
const { onDone, onError } = startView(conf,
|
|
103
120
|
// assume views will always output to stdout so use color support from there
|
|
104
121
|
{ colors: stdoutColor }, views, { start });
|
|
122
|
+
const telemetryEnabled = conf.values.telemetry;
|
|
123
|
+
const commandName = conf.command;
|
|
105
124
|
try {
|
|
125
|
+
// checked here rather than in run() so that the missing-registry
|
|
126
|
+
// error is rendered, tracked and exited like any other command
|
|
127
|
+
// error, and so that the `--help` return above still works when
|
|
128
|
+
// nothing is configured.
|
|
129
|
+
if (needsRegistry && !hasConfiguredRegistry(conf)) {
|
|
130
|
+
throw missingRegistryError();
|
|
131
|
+
}
|
|
106
132
|
const output = await onDone(await command(conf));
|
|
133
|
+
stopRequestLog();
|
|
134
|
+
const duration_ms = Date.now() - start;
|
|
135
|
+
trackCommand({
|
|
136
|
+
command: commandName,
|
|
137
|
+
duration_ms,
|
|
138
|
+
success: true,
|
|
139
|
+
node_version: process.version,
|
|
140
|
+
vlt_version: vltVersion ?? 'unknown',
|
|
141
|
+
os: process.platform,
|
|
142
|
+
arch: process.arch,
|
|
143
|
+
ci: isCI(),
|
|
144
|
+
}, telemetryEnabled);
|
|
107
145
|
if (output !== undefined && conf.values.view !== 'silent') {
|
|
108
146
|
stdout(conf.values.view === 'json' ?
|
|
109
147
|
JSON.stringify(output, null, 2)
|
|
@@ -112,10 +150,40 @@ export const outputCommand = async (cliCommand, conf, { start } = { start: Date.
|
|
|
112
150
|
colors: stdoutColor,
|
|
113
151
|
}, output));
|
|
114
152
|
}
|
|
153
|
+
// Await the flush so pending telemetry events are sent before
|
|
154
|
+
// the process exits. The flush has a built-in timeout cap
|
|
155
|
+
// (SHUTDOWN_TIMEOUT_MS) so it will never block for long, and the
|
|
156
|
+
// timer is unreffed so even if this is not awaited the process
|
|
157
|
+
// can still exit promptly.
|
|
158
|
+
await flushTelemetry();
|
|
115
159
|
}
|
|
116
160
|
catch (err) {
|
|
161
|
+
stopRequestLog();
|
|
117
162
|
onError?.(err);
|
|
118
163
|
process.exitCode ||= 1;
|
|
164
|
+
const duration_ms = Date.now() - start;
|
|
165
|
+
trackCommand({
|
|
166
|
+
command: commandName,
|
|
167
|
+
duration_ms,
|
|
168
|
+
success: false,
|
|
169
|
+
node_version: process.version,
|
|
170
|
+
vlt_version: vltVersion ?? 'unknown',
|
|
171
|
+
os: process.platform,
|
|
172
|
+
arch: process.arch,
|
|
173
|
+
ci: isCI(),
|
|
174
|
+
}, telemetryEnabled);
|
|
175
|
+
const errorCode = (err instanceof Error &&
|
|
176
|
+
err.cause &&
|
|
177
|
+
typeof err.cause === 'object' &&
|
|
178
|
+
'code' in err.cause &&
|
|
179
|
+
typeof err.cause.code === 'string') ?
|
|
180
|
+
err.cause.code
|
|
181
|
+
: undefined;
|
|
182
|
+
trackError({
|
|
183
|
+
command: commandName,
|
|
184
|
+
error_code: errorCode,
|
|
185
|
+
}, telemetryEnabled);
|
|
186
|
+
await flushTelemetry();
|
|
119
187
|
printErr(err, usage, stderr, {
|
|
120
188
|
...formatOptions,
|
|
121
189
|
colors: stderrColor,
|
|
@@ -123,4 +191,3 @@ export const outputCommand = async (cliCommand, conf, { start } = { start: Date.
|
|
|
123
191
|
process.exit(process.exitCode);
|
|
124
192
|
}
|
|
125
193
|
};
|
|
126
|
-
//# sourceMappingURL=output.js.map
|