@vltpkg/cli-sdk 1.0.0-rc.33 → 1.0.0-rc.34
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/publish.js +6 -5
- package/dist/commands/query.js +41 -1
- package/dist/commands/view.js +1 -1
- package/dist/config/definition.d.ts +0 -4
- package/dist/config/definition.js +0 -4
- package/dist/custom-help.js +72 -139
- package/dist/registry-error-message.d.ts +2 -0
- package/dist/registry-error-message.js +29 -0
- package/package.json +25 -25
package/dist/commands/publish.js
CHANGED
|
@@ -12,6 +12,7 @@ import { Query } from '@vltpkg/query';
|
|
|
12
12
|
import { createHostContextsMap } from "../query-host-contexts.js";
|
|
13
13
|
import { minimatch } from 'minimatch';
|
|
14
14
|
import { resolveRegistry } from "../require-registry.js";
|
|
15
|
+
import { registryErrorMessage } from "../registry-error-message.js";
|
|
15
16
|
export const needsRegistry = true;
|
|
16
17
|
export const usage = () => commandUsage({
|
|
17
18
|
command: 'publish',
|
|
@@ -264,15 +265,15 @@ const commandSingle = async (location, conf) => {
|
|
|
264
265
|
});
|
|
265
266
|
}
|
|
266
267
|
if (response.statusCode !== 200 && response.statusCode !== 201) {
|
|
267
|
-
let
|
|
268
|
+
let advice = '';
|
|
268
269
|
if (response.statusCode === 409) {
|
|
269
|
-
|
|
270
|
+
advice = `\n⚠️ ${name}@${version} already exists in the registry. Bump the version and try again.`;
|
|
270
271
|
}
|
|
271
272
|
else if (response.statusCode === 404) {
|
|
272
|
-
|
|
273
|
-
"
|
|
273
|
+
advice =
|
|
274
|
+
"\n⚠️ Make sure you're logged in and have access to publish the package.";
|
|
274
275
|
}
|
|
275
|
-
throw error(`Failed to publish package${
|
|
276
|
+
throw error(`Failed to publish package: ${registryErrorMessage(response)}${advice}`, {
|
|
276
277
|
url: publishUrl,
|
|
277
278
|
response,
|
|
278
279
|
});
|
package/dist/commands/query.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { actual, asNode, humanReadableOutput, jsonOutput, mermaidOutput, GraphModifier, } from '@vltpkg/graph';
|
|
2
|
-
import { error } from '@vltpkg/error-cause';
|
|
3
2
|
import { Query } from '@vltpkg/query';
|
|
3
|
+
import { stdout } from "../output.js";
|
|
4
|
+
import { error } from '@vltpkg/error-cause';
|
|
4
5
|
import { createDiffFilesProvider } from "../query-diff-files.js";
|
|
5
6
|
import { SecurityArchive } from '@vltpkg/security-archive';
|
|
6
7
|
import { commandUsage } from "../config/usage.js";
|
|
@@ -154,6 +155,18 @@ export const command = async (conf) => {
|
|
|
154
155
|
signal: new AbortController().signal,
|
|
155
156
|
});
|
|
156
157
|
scopeNodes = resultNodes;
|
|
158
|
+
if (scopeNodes.length === 0) {
|
|
159
|
+
if (conf.values.view === 'human') {
|
|
160
|
+
stdout('No packages found matching scope query:', scopeQueryString);
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
importers: new Set(),
|
|
164
|
+
edges: [],
|
|
165
|
+
nodes: [],
|
|
166
|
+
highlightSelection: false,
|
|
167
|
+
queryString: scopeQueryString,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
157
170
|
}
|
|
158
171
|
if (scopeQueryString && scopeNodes) {
|
|
159
172
|
// Add all scope nodes to importers Set (treat them as top-level items)
|
|
@@ -173,6 +186,18 @@ export const command = async (conf) => {
|
|
|
173
186
|
}
|
|
174
187
|
}
|
|
175
188
|
}
|
|
189
|
+
if (importers.size === 0) {
|
|
190
|
+
if (conf.values.view === 'human') {
|
|
191
|
+
stdout('No matching workspaces found:', conf.values.workspace);
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
importers: new Set(),
|
|
195
|
+
edges: [],
|
|
196
|
+
nodes: [],
|
|
197
|
+
highlightSelection: false,
|
|
198
|
+
queryString: queryString ?? '',
|
|
199
|
+
};
|
|
200
|
+
}
|
|
176
201
|
}
|
|
177
202
|
// retrieve the selected nodes and edges
|
|
178
203
|
const edges_ = graph?.edges ?? new Set();
|
|
@@ -202,6 +227,21 @@ export const command = async (conf) => {
|
|
|
202
227
|
wanted: conf.values['expect-results'],
|
|
203
228
|
});
|
|
204
229
|
}
|
|
230
|
+
if (graph &&
|
|
231
|
+
nodes.length === 0 &&
|
|
232
|
+
edges.length === 0 &&
|
|
233
|
+
!conf.values['expect-results']) {
|
|
234
|
+
if (conf.values.view === 'human') {
|
|
235
|
+
stdout('No packages found matching query:', query);
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
importers: new Set(),
|
|
239
|
+
edges: [],
|
|
240
|
+
nodes: [],
|
|
241
|
+
highlightSelection: false,
|
|
242
|
+
queryString: query,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
205
245
|
return {
|
|
206
246
|
importers: importers.size === 0 ?
|
|
207
247
|
new Set(queryResultImporters)
|
package/dist/commands/view.js
CHANGED
|
@@ -301,7 +301,7 @@ export const command = async (conf) => {
|
|
|
301
301
|
const pic = new PackageInfoClient(conf.options);
|
|
302
302
|
// Fetch the full packument (needs time, maintainers) and resolved manifest
|
|
303
303
|
const [packument, resolvedManifest] = await Promise.all([
|
|
304
|
-
pic.packument(spec
|
|
304
|
+
pic.packument(spec),
|
|
305
305
|
pic.manifest(spec),
|
|
306
306
|
]);
|
|
307
307
|
const manifest = resolvedManifest;
|
|
@@ -21,11 +21,9 @@ export declare const commands: {
|
|
|
21
21
|
readonly '?': "help";
|
|
22
22
|
readonly info: "view";
|
|
23
23
|
readonly ls: "list";
|
|
24
|
-
readonly out: "outdated";
|
|
25
24
|
readonly show: "view";
|
|
26
25
|
readonly xc: "exec-cache";
|
|
27
26
|
readonly access: "access";
|
|
28
|
-
readonly audit: "audit";
|
|
29
27
|
readonly bugs: "bugs";
|
|
30
28
|
readonly build: "build";
|
|
31
29
|
readonly cache: "cache";
|
|
@@ -37,14 +35,12 @@ export declare const commands: {
|
|
|
37
35
|
readonly docs: "docs";
|
|
38
36
|
readonly exec: "exec";
|
|
39
37
|
readonly 'exec-local': "exec-local";
|
|
40
|
-
readonly fund: "fund";
|
|
41
38
|
readonly help: "help";
|
|
42
39
|
readonly init: "init";
|
|
43
40
|
readonly install: "install";
|
|
44
41
|
readonly login: "login";
|
|
45
42
|
readonly logout: "logout";
|
|
46
43
|
readonly list: "list";
|
|
47
|
-
readonly outdated: "outdated";
|
|
48
44
|
readonly pack: "pack";
|
|
49
45
|
readonly ping: "ping";
|
|
50
46
|
readonly pkg: "pkg";
|
|
@@ -16,7 +16,6 @@ export const defaultEditor = () => process.env.EDITOR ||
|
|
|
16
16
|
: 'vi');
|
|
17
17
|
const canonicalCommands = {
|
|
18
18
|
access: 'access',
|
|
19
|
-
audit: 'audit',
|
|
20
19
|
bugs: 'bugs',
|
|
21
20
|
build: 'build',
|
|
22
21
|
cache: 'cache',
|
|
@@ -28,7 +27,6 @@ const canonicalCommands = {
|
|
|
28
27
|
docs: 'docs',
|
|
29
28
|
exec: 'exec',
|
|
30
29
|
'exec-local': 'exec-local',
|
|
31
|
-
fund: 'fund',
|
|
32
30
|
help: 'help',
|
|
33
31
|
init: 'init',
|
|
34
32
|
install: 'install',
|
|
@@ -36,7 +34,6 @@ const canonicalCommands = {
|
|
|
36
34
|
logout: 'logout',
|
|
37
35
|
list: 'list',
|
|
38
36
|
ls: 'ls',
|
|
39
|
-
outdated: 'outdated',
|
|
40
37
|
pack: 'pack',
|
|
41
38
|
ping: 'ping',
|
|
42
39
|
pkg: 'pkg',
|
|
@@ -75,7 +72,6 @@ const aliases = {
|
|
|
75
72
|
'?': 'help',
|
|
76
73
|
info: 'view',
|
|
77
74
|
ls: 'list',
|
|
78
|
-
out: 'outdated',
|
|
79
75
|
show: 'view',
|
|
80
76
|
xc: 'exec-cache',
|
|
81
77
|
};
|
package/dist/custom-help.js
CHANGED
|
@@ -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,243 +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: {
|
|
50
57
|
args: '[<spec>]',
|
|
51
58
|
desc: 'Open the bug tracker for a package',
|
|
52
|
-
showByDefault: false,
|
|
53
59
|
},
|
|
54
|
-
{
|
|
55
|
-
name: 'build',
|
|
56
|
-
aliases: ['b'],
|
|
60
|
+
build: {
|
|
57
61
|
args: '<selector>',
|
|
58
62
|
desc: 'Build packages with lifecycle scripts',
|
|
59
|
-
showByDefault: true,
|
|
60
63
|
defaultOrder: 4,
|
|
61
64
|
},
|
|
62
|
-
{
|
|
63
|
-
name: 'cache',
|
|
64
|
-
aliases: [],
|
|
65
|
+
cache: {
|
|
65
66
|
args: '[add|ls|info|clean|delete|delete-before|delete-all]',
|
|
66
67
|
desc: 'Manage the package cache',
|
|
67
|
-
showByDefault: false,
|
|
68
68
|
},
|
|
69
|
-
{
|
|
70
|
-
name: 'ci',
|
|
71
|
-
aliases: [],
|
|
69
|
+
ci: {
|
|
72
70
|
args: '',
|
|
73
71
|
desc: 'Clean install (frozen lockfile)',
|
|
74
|
-
showByDefault: false,
|
|
75
72
|
},
|
|
76
|
-
{
|
|
77
|
-
name: 'config',
|
|
78
|
-
aliases: [],
|
|
73
|
+
config: {
|
|
79
74
|
args: '[get|pick|list|set|delete|edit|location]',
|
|
80
75
|
desc: 'Get or set configuration',
|
|
81
|
-
showByDefault: false,
|
|
82
76
|
},
|
|
83
|
-
{
|
|
84
|
-
name: 'create',
|
|
85
|
-
aliases: [],
|
|
77
|
+
create: {
|
|
86
78
|
args: '<initializer> [args...]',
|
|
87
79
|
desc: 'Create a new project from a template',
|
|
88
|
-
showByDefault: false,
|
|
89
80
|
},
|
|
90
|
-
{
|
|
91
|
-
|
|
92
|
-
|
|
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: {
|
|
93
90
|
args: '',
|
|
94
91
|
desc: 'Open the docs of the current project',
|
|
95
|
-
showByDefault: false,
|
|
96
92
|
},
|
|
97
|
-
{
|
|
98
|
-
name: 'exec',
|
|
99
|
-
aliases: ['x'],
|
|
93
|
+
exec: {
|
|
100
94
|
args: '<executable>',
|
|
101
95
|
desc: 'Execute a package bin',
|
|
102
|
-
showByDefault: true,
|
|
103
96
|
defaultOrder: 6,
|
|
104
97
|
},
|
|
105
|
-
{
|
|
106
|
-
name: 'exec-cache',
|
|
107
|
-
aliases: ['xc'],
|
|
98
|
+
'exec-cache': {
|
|
108
99
|
args: '[ls|delete|info|install]',
|
|
109
100
|
desc: 'Manage the exec cache',
|
|
110
|
-
showByDefault: false,
|
|
111
101
|
},
|
|
112
|
-
{
|
|
113
|
-
name: 'exec-local',
|
|
114
|
-
aliases: ['xl'],
|
|
102
|
+
'exec-local': {
|
|
115
103
|
args: '<command>',
|
|
116
104
|
desc: 'Execute a local package bin',
|
|
117
|
-
showByDefault: false,
|
|
118
105
|
},
|
|
119
|
-
{
|
|
120
|
-
name: 'help',
|
|
121
|
-
aliases: ['h', '?'],
|
|
106
|
+
help: {
|
|
122
107
|
args: '[<command>]',
|
|
123
108
|
desc: 'Show help for a command',
|
|
124
|
-
showByDefault: false,
|
|
125
109
|
},
|
|
126
|
-
{
|
|
127
|
-
name: 'init',
|
|
128
|
-
aliases: [],
|
|
110
|
+
init: {
|
|
129
111
|
args: '',
|
|
130
112
|
desc: 'Initialize a new project',
|
|
131
|
-
showByDefault: true,
|
|
132
113
|
defaultOrder: 1,
|
|
133
114
|
},
|
|
134
|
-
{
|
|
135
|
-
name: 'install',
|
|
136
|
-
aliases: ['i', 'add'],
|
|
115
|
+
install: {
|
|
137
116
|
args: '[<package>...]',
|
|
138
117
|
desc: 'Install dependencies',
|
|
139
|
-
showByDefault: true,
|
|
140
118
|
defaultOrder: 2,
|
|
141
119
|
},
|
|
142
|
-
{
|
|
143
|
-
name: 'list',
|
|
144
|
-
aliases: ['ls'],
|
|
120
|
+
list: {
|
|
145
121
|
args: '',
|
|
146
122
|
desc: 'List installed packages',
|
|
147
|
-
showByDefault: false,
|
|
148
123
|
},
|
|
149
|
-
{
|
|
150
|
-
name: 'login',
|
|
151
|
-
aliases: [],
|
|
124
|
+
login: {
|
|
152
125
|
args: '',
|
|
153
126
|
desc: 'Authenticate with a registry',
|
|
154
|
-
showByDefault: false,
|
|
155
127
|
},
|
|
156
|
-
{
|
|
157
|
-
name: 'logout',
|
|
158
|
-
aliases: [],
|
|
128
|
+
logout: {
|
|
159
129
|
args: '',
|
|
160
130
|
desc: 'Log out from a registry',
|
|
161
|
-
showByDefault: false,
|
|
162
131
|
},
|
|
163
|
-
{
|
|
164
|
-
name: 'pack',
|
|
165
|
-
aliases: [],
|
|
132
|
+
pack: {
|
|
166
133
|
args: '',
|
|
167
134
|
desc: 'Create a tarball from a package',
|
|
168
|
-
showByDefault: false,
|
|
169
135
|
},
|
|
170
|
-
{
|
|
171
|
-
name: 'ping',
|
|
172
|
-
aliases: [],
|
|
136
|
+
ping: {
|
|
173
137
|
args: '[<registry-alias>]',
|
|
174
138
|
desc: 'Ping configured registries',
|
|
175
|
-
showByDefault: false,
|
|
176
139
|
},
|
|
177
|
-
{
|
|
178
|
-
name: 'pkg',
|
|
179
|
-
aliases: ['p'],
|
|
140
|
+
pkg: {
|
|
180
141
|
args: '<command>',
|
|
181
142
|
desc: 'Manage package metadata',
|
|
182
|
-
showByDefault: true,
|
|
183
143
|
defaultOrder: 7,
|
|
184
144
|
},
|
|
185
|
-
{
|
|
186
|
-
|
|
187
|
-
|
|
145
|
+
profile: {
|
|
146
|
+
args: '<command> [<args>]',
|
|
147
|
+
desc: 'Get or set registry profile properties',
|
|
148
|
+
},
|
|
149
|
+
publish: {
|
|
188
150
|
args: '',
|
|
189
151
|
desc: 'Publish package to registry',
|
|
190
|
-
showByDefault: true,
|
|
191
152
|
defaultOrder: 8,
|
|
192
153
|
},
|
|
193
|
-
{
|
|
194
|
-
name: 'query',
|
|
195
|
-
aliases: ['q'],
|
|
154
|
+
query: {
|
|
196
155
|
args: '<selector>',
|
|
197
156
|
desc: 'Query for packages in the project',
|
|
198
|
-
showByDefault: true,
|
|
199
157
|
defaultOrder: 3,
|
|
200
158
|
},
|
|
201
|
-
{
|
|
202
|
-
name: 'registry',
|
|
203
|
-
aliases: [],
|
|
159
|
+
registry: {
|
|
204
160
|
args: '<alias> <command>',
|
|
205
161
|
desc: 'Run an account command against a named registry',
|
|
206
|
-
showByDefault: true,
|
|
207
162
|
defaultOrder: 9,
|
|
208
163
|
},
|
|
209
|
-
{
|
|
210
|
-
name: 'repo',
|
|
211
|
-
aliases: [],
|
|
164
|
+
repo: {
|
|
212
165
|
args: '[<spec>]',
|
|
213
166
|
desc: 'Open the repository page for a package',
|
|
214
|
-
showByDefault: false,
|
|
215
167
|
},
|
|
216
|
-
{
|
|
217
|
-
name: 'run',
|
|
218
|
-
aliases: ['r'],
|
|
168
|
+
run: {
|
|
219
169
|
args: '<script>',
|
|
220
170
|
desc: 'Run a script defined in package.json',
|
|
221
|
-
showByDefault: true,
|
|
222
171
|
defaultOrder: 5,
|
|
223
172
|
},
|
|
224
|
-
{
|
|
225
|
-
name: 'run-exec',
|
|
226
|
-
aliases: ['rx'],
|
|
173
|
+
'run-exec': {
|
|
227
174
|
args: '<script>',
|
|
228
175
|
desc: 'Run a script &/or fallback to executing a binary',
|
|
229
|
-
showByDefault: false,
|
|
230
176
|
},
|
|
231
|
-
{
|
|
232
|
-
name: 'setup',
|
|
233
|
-
aliases: [],
|
|
177
|
+
setup: {
|
|
234
178
|
args: '[<account>]',
|
|
235
179
|
desc: 'Configure your vlt.io account registries',
|
|
236
|
-
showByDefault: true,
|
|
237
180
|
defaultOrder: 0,
|
|
238
181
|
},
|
|
239
|
-
{
|
|
240
|
-
name: 'token',
|
|
241
|
-
aliases: [],
|
|
182
|
+
token: {
|
|
242
183
|
args: '[add|rm]',
|
|
243
184
|
desc: 'Manage authentication tokens',
|
|
244
|
-
showByDefault: false,
|
|
245
185
|
},
|
|
246
|
-
{
|
|
247
|
-
name: 'uninstall',
|
|
248
|
-
aliases: ['rm'],
|
|
186
|
+
uninstall: {
|
|
249
187
|
args: '[<package>...]',
|
|
250
188
|
desc: 'Remove dependencies',
|
|
251
|
-
showByDefault: false,
|
|
252
189
|
},
|
|
253
|
-
{
|
|
254
|
-
name: 'unpublish',
|
|
255
|
-
aliases: [],
|
|
190
|
+
unpublish: {
|
|
256
191
|
args: '<pkg>[@<version>]',
|
|
257
192
|
desc: 'Remove a package from the registry',
|
|
258
|
-
showByDefault: false,
|
|
259
193
|
},
|
|
260
|
-
{
|
|
261
|
-
name: 'update',
|
|
262
|
-
aliases: ['u'],
|
|
194
|
+
update: {
|
|
263
195
|
args: '',
|
|
264
196
|
desc: 'Update package versions to latest in-range',
|
|
265
|
-
showByDefault: false,
|
|
266
197
|
},
|
|
267
|
-
{
|
|
268
|
-
name: 'version',
|
|
269
|
-
aliases: [],
|
|
198
|
+
version: {
|
|
270
199
|
args: '<increment>',
|
|
271
200
|
desc: 'Bump package version',
|
|
272
|
-
showByDefault: false,
|
|
273
201
|
},
|
|
274
|
-
{
|
|
275
|
-
|
|
276
|
-
|
|
202
|
+
view: {
|
|
203
|
+
args: '<pkg>[@<version>] [<field>]',
|
|
204
|
+
desc: 'View registry information about a package',
|
|
205
|
+
},
|
|
206
|
+
whoami: {
|
|
277
207
|
args: '',
|
|
278
208
|
desc: 'Display the current user',
|
|
279
|
-
showByDefault: false,
|
|
280
209
|
},
|
|
281
|
-
|
|
210
|
+
};
|
|
211
|
+
const allCommands = Object.entries(commandHelp).map(([name, metadata]) => ({
|
|
212
|
+
name,
|
|
213
|
+
aliases: commandAliases.get(name) ?? [],
|
|
214
|
+
...metadata,
|
|
215
|
+
}));
|
|
282
216
|
/**
|
|
283
217
|
* Generates the custom default help output for vlt
|
|
284
218
|
*/
|
|
@@ -286,8 +220,8 @@ export const generateDefaultHelp = (colors = false) => {
|
|
|
286
220
|
const s = makeStyler(colors);
|
|
287
221
|
// Get default commands and sort by defaultOrder
|
|
288
222
|
const defaultCommands = allCommands
|
|
289
|
-
.filter(cmd => cmd.
|
|
290
|
-
.sort((a, b) => (a.defaultOrder
|
|
223
|
+
.filter(cmd => cmd.defaultOrder !== undefined)
|
|
224
|
+
.sort((a, b) => (a.defaultOrder ?? 0) - (b.defaultOrder ?? 0));
|
|
291
225
|
// Generate commands with tighter alias spacing but proper table structure
|
|
292
226
|
const commandsSection = defaultCommands
|
|
293
227
|
.map(cmd => {
|
|
@@ -298,7 +232,7 @@ export const generateDefaultHelp = (colors = false) => {
|
|
|
298
232
|
const nameColumn = cmd.name.padEnd(10);
|
|
299
233
|
// Consistent args column (14 chars)
|
|
300
234
|
const argsColumn = cmd.args.padEnd(16);
|
|
301
|
-
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}`;
|
|
302
236
|
})
|
|
303
237
|
.join('\n');
|
|
304
238
|
return `${s(['bold'], '⚡️ vlt')} ${s('dim', '/vōlt/')} next-gen package management ${s('dim', `v${version}`)}
|
|
@@ -334,6 +268,8 @@ export const generateFullHelp = (colors = false) => {
|
|
|
334
268
|
const s = makeStyler(colors);
|
|
335
269
|
// Use all commands sorted alphabetically
|
|
336
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));
|
|
337
273
|
// Define only globally applicable flags (alphabetically sorted by long name)
|
|
338
274
|
const flags = [
|
|
339
275
|
{
|
|
@@ -388,17 +324,14 @@ export const generateFullHelp = (colors = false) => {
|
|
|
388
324
|
if (firstLetter !== lastFirstLetter && index > 0) {
|
|
389
325
|
commandsSection += '\n';
|
|
390
326
|
}
|
|
391
|
-
|
|
392
|
-
const aliasColumn = cmd.aliases.length > 0 ?
|
|
393
|
-
(cmd.aliases.join(', ') + ', ').padEnd(9)
|
|
394
|
-
: ' ';
|
|
327
|
+
const aliasColumn = aliasLabels[index]?.padEnd(aliasWidth) ?? '';
|
|
395
328
|
const nameColumn = cmd.name.padEnd(12);
|
|
396
329
|
// Truncate args if longer than 16 chars and add ellipsis
|
|
397
330
|
const truncatedArgs = cmd.args.length > 16 ?
|
|
398
331
|
cmd.args.substring(0, 13) + '...'
|
|
399
332
|
: cmd.args;
|
|
400
333
|
const argsColumn = truncatedArgs.padEnd(16);
|
|
401
|
-
commandsSection +=
|
|
334
|
+
commandsSection += ` ${s('dim', aliasColumn)} ${s(['yellow', 'bold'], nameColumn)} ${s('dim', argsColumn)} ${cmd.desc}`;
|
|
402
335
|
if (index < commands.length - 1) {
|
|
403
336
|
commandsSection += '\n';
|
|
404
337
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { STATUS_CODES } from 'node:http';
|
|
2
|
+
export const registryErrorMessage = (response) => {
|
|
3
|
+
const statusMessage = STATUS_CODES[response.statusCode];
|
|
4
|
+
const status = `${response.statusCode}${statusMessage ? ` ${statusMessage}` : ''}`;
|
|
5
|
+
let text;
|
|
6
|
+
try {
|
|
7
|
+
text = response.text().trim();
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return status;
|
|
11
|
+
}
|
|
12
|
+
if (!text)
|
|
13
|
+
return status;
|
|
14
|
+
let detail = text;
|
|
15
|
+
try {
|
|
16
|
+
const body = JSON.parse(text);
|
|
17
|
+
if (body &&
|
|
18
|
+
typeof body === 'object' &&
|
|
19
|
+
'error' in body &&
|
|
20
|
+
typeof body.error === 'string' &&
|
|
21
|
+
body.error) {
|
|
22
|
+
detail = body.error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// A non-JSON response body is itself the most useful error detail.
|
|
27
|
+
}
|
|
28
|
+
return `${status} — ${detail}`;
|
|
29
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/cli-sdk",
|
|
3
3
|
"description": "The source for the vlt CLI",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.34",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -14,30 +14,30 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
17
|
-
"@vltpkg/config": "1.0.0-rc.
|
|
18
|
-
"@vltpkg/dep-id": "1.0.0-rc.
|
|
19
|
-
"@vltpkg/dot-prop": "1.0.0-rc.
|
|
20
|
-
"@vltpkg/error-cause": "1.0.0-rc.
|
|
21
|
-
"@vltpkg/git": "1.0.0-rc.
|
|
22
|
-
"@vltpkg/graph": "1.0.0-rc.
|
|
23
|
-
"@vltpkg/graph-run": "1.0.0-rc.
|
|
24
|
-
"@vltpkg/init": "1.0.0-rc.
|
|
25
|
-
"@vltpkg/output": "1.0.0-rc.
|
|
26
|
-
"@vltpkg/package-info": "1.0.0-rc.
|
|
27
|
-
"@vltpkg/package-json": "1.0.0-rc.
|
|
28
|
-
"@vltpkg/promise-spawn": "1.0.0-rc.
|
|
29
|
-
"@vltpkg/query": "1.0.0-rc.
|
|
30
|
-
"@vltpkg/registry-client": "1.0.0-rc.
|
|
31
|
-
"@vltpkg/rollback-remove": "1.0.0-rc.
|
|
32
|
-
"@vltpkg/run": "1.0.0-rc.
|
|
33
|
-
"@vltpkg/security-archive": "1.0.0-rc.
|
|
34
|
-
"@vltpkg/spec": "1.0.0-rc.
|
|
35
|
-
"@vltpkg/types": "1.0.0-rc.
|
|
36
|
-
"@vltpkg/url-open": "1.0.0-rc.
|
|
37
|
-
"@vltpkg/vlt-json": "1.0.0-rc.
|
|
38
|
-
"@vltpkg/vlx": "1.0.0-rc.
|
|
39
|
-
"@vltpkg/workspaces": "1.0.0-rc.
|
|
40
|
-
"@vltpkg/xdg": "1.0.0-rc.
|
|
17
|
+
"@vltpkg/config": "1.0.0-rc.34",
|
|
18
|
+
"@vltpkg/dep-id": "1.0.0-rc.34",
|
|
19
|
+
"@vltpkg/dot-prop": "1.0.0-rc.34",
|
|
20
|
+
"@vltpkg/error-cause": "1.0.0-rc.34",
|
|
21
|
+
"@vltpkg/git": "1.0.0-rc.34",
|
|
22
|
+
"@vltpkg/graph": "1.0.0-rc.34",
|
|
23
|
+
"@vltpkg/graph-run": "1.0.0-rc.34",
|
|
24
|
+
"@vltpkg/init": "1.0.0-rc.34",
|
|
25
|
+
"@vltpkg/output": "1.0.0-rc.34",
|
|
26
|
+
"@vltpkg/package-info": "1.0.0-rc.34",
|
|
27
|
+
"@vltpkg/package-json": "1.0.0-rc.34",
|
|
28
|
+
"@vltpkg/promise-spawn": "1.0.0-rc.34",
|
|
29
|
+
"@vltpkg/query": "1.0.0-rc.34",
|
|
30
|
+
"@vltpkg/registry-client": "1.0.0-rc.34",
|
|
31
|
+
"@vltpkg/rollback-remove": "1.0.0-rc.34",
|
|
32
|
+
"@vltpkg/run": "1.0.0-rc.34",
|
|
33
|
+
"@vltpkg/security-archive": "1.0.0-rc.34",
|
|
34
|
+
"@vltpkg/spec": "1.0.0-rc.34",
|
|
35
|
+
"@vltpkg/types": "1.0.0-rc.34",
|
|
36
|
+
"@vltpkg/url-open": "1.0.0-rc.34",
|
|
37
|
+
"@vltpkg/vlt-json": "1.0.0-rc.34",
|
|
38
|
+
"@vltpkg/vlx": "1.0.0-rc.34",
|
|
39
|
+
"@vltpkg/workspaces": "1.0.0-rc.34",
|
|
40
|
+
"@vltpkg/xdg": "1.0.0-rc.34",
|
|
41
41
|
"ansi-to-pre": "^1.0.6",
|
|
42
42
|
"beautiful-mermaid": "^1.1.3",
|
|
43
43
|
"chalk": "^5.6.2",
|