@vltpkg/cli-sdk 1.0.0-rc.32 → 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/access.d.ts +1 -0
- package/dist/commands/access.js +11 -6
- package/dist/commands/build.d.ts +1 -0
- package/dist/commands/build.js +1 -0
- package/dist/commands/cache.d.ts +1 -0
- package/dist/commands/cache.js +1 -0
- package/dist/commands/ci.d.ts +1 -0
- package/dist/commands/ci.js +1 -0
- package/dist/commands/create.d.ts +1 -0
- package/dist/commands/create.js +1 -0
- package/dist/commands/deprecate.d.ts +1 -0
- package/dist/commands/deprecate.js +4 -1
- package/dist/commands/dist-tag.d.ts +1 -0
- package/dist/commands/dist-tag.js +3 -1
- package/dist/commands/exec-cache.d.ts +1 -0
- package/dist/commands/exec-cache.js +1 -0
- package/dist/commands/exec.d.ts +1 -0
- package/dist/commands/exec.js +1 -0
- package/dist/commands/install.d.ts +1 -0
- package/dist/commands/install.js +12 -0
- package/dist/commands/list.d.ts +1 -0
- package/dist/commands/list.js +1 -0
- package/dist/commands/login.js +16 -3
- package/dist/commands/logout.d.ts +1 -0
- package/dist/commands/logout.js +7 -2
- package/dist/commands/pack.d.ts +1 -0
- package/dist/commands/pack.js +1 -0
- package/dist/commands/ping.d.ts +1 -0
- package/dist/commands/ping.js +5 -2
- package/dist/commands/profile.d.ts +1 -0
- package/dist/commands/profile.js +4 -2
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +9 -6
- package/dist/commands/query.d.ts +1 -0
- package/dist/commands/query.js +42 -1
- package/dist/commands/registry.d.ts +26 -0
- package/dist/commands/registry.js +99 -0
- package/dist/commands/run-exec.d.ts +1 -0
- package/dist/commands/run-exec.js +1 -0
- package/dist/commands/setup.d.ts +25 -0
- package/dist/commands/setup.js +142 -0
- package/dist/commands/token.d.ts +1 -0
- package/dist/commands/token.js +8 -3
- package/dist/commands/uninstall.d.ts +1 -0
- package/dist/commands/uninstall.js +1 -0
- package/dist/commands/unpublish.d.ts +1 -0
- package/dist/commands/unpublish.js +4 -1
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.js +1 -0
- package/dist/commands/view.d.ts +1 -0
- package/dist/commands/view.js +2 -1
- package/dist/commands/whoami.d.ts +1 -0
- package/dist/commands/whoami.js +7 -2
- package/dist/config/definition.d.ts +34 -0
- package/dist/config/definition.js +84 -11
- package/dist/config/index.js +6 -0
- package/dist/custom-help.js +81 -132
- package/dist/index.js +4 -0
- package/dist/load-command.d.ts +6 -0
- package/dist/output.js +15 -1
- package/dist/print-err.js +10 -1
- package/dist/registry-error-message.d.ts +2 -0
- package/dist/registry-error-message.js +29 -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/verbose-log.d.ts +31 -0
- package/dist/verbose-log.js +62 -0
- package/package.json +33 -26
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { error } from '@vltpkg/error-cause';
|
|
2
|
+
import { getCommand } from "../config/definition.js";
|
|
3
|
+
import { commandUsage } from "../config/usage.js";
|
|
4
|
+
import { resolveRegistry } from "../require-registry.js";
|
|
5
|
+
/**
|
|
6
|
+
* The account/auth commands that can be scoped to a named registry
|
|
7
|
+
* alias via `vlt registry <alias> <command>`.
|
|
8
|
+
*/
|
|
9
|
+
export const registrySubcommands = [
|
|
10
|
+
'whoami',
|
|
11
|
+
'logout',
|
|
12
|
+
'login',
|
|
13
|
+
'token',
|
|
14
|
+
'access',
|
|
15
|
+
'publish',
|
|
16
|
+
'unpublish',
|
|
17
|
+
'deprecate',
|
|
18
|
+
'dist-tag',
|
|
19
|
+
'profile',
|
|
20
|
+
'ping',
|
|
21
|
+
];
|
|
22
|
+
const isRegistrySubcommand = (s) => {
|
|
23
|
+
const canonical = getCommand(s);
|
|
24
|
+
return (canonical !== undefined &&
|
|
25
|
+
registrySubcommands.includes(canonical));
|
|
26
|
+
};
|
|
27
|
+
export const usage = () => commandUsage({
|
|
28
|
+
command: 'registry',
|
|
29
|
+
usage: '<alias> <command> [<args>]',
|
|
30
|
+
description: `Run an account command against a specific configured
|
|
31
|
+
registry, selected by its \`registries\` alias instead
|
|
32
|
+
of a full URL.
|
|
33
|
+
|
|
34
|
+
For example, \`vlt registry main whoami\` runs \`whoami\`
|
|
35
|
+
against the registry configured as \`main\`. Omit the
|
|
36
|
+
alias (e.g. \`vlt registry whoami\`) to be prompted to
|
|
37
|
+
choose from the configured registries, or to fall back
|
|
38
|
+
to \`--default-registry-alias\` when non-interactive.
|
|
39
|
+
|
|
40
|
+
\`<command>\` is one of:
|
|
41
|
+
${registrySubcommands.join(', ')}.`,
|
|
42
|
+
});
|
|
43
|
+
export const views = {
|
|
44
|
+
human: () => { },
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Resolve `vlt registry <alias> <command>` in place: determine the
|
|
48
|
+
* target subcommand and registry, then rewrite `conf` so the outer
|
|
49
|
+
* runner dispatches the real command with the resolved registry
|
|
50
|
+
* injected. When invoked with `--help` or without a subcommand, `conf`
|
|
51
|
+
* is left untouched so the `registry` usage/error is shown instead.
|
|
52
|
+
*
|
|
53
|
+
* Streams / interactivity are injectable for tests.
|
|
54
|
+
*/
|
|
55
|
+
export const dispatchRegistry = async (conf, { interactive, input, output, } = {}) => {
|
|
56
|
+
if (conf.get('help'))
|
|
57
|
+
return;
|
|
58
|
+
const [first, ...restArgs] = conf.positionals;
|
|
59
|
+
if (first === undefined)
|
|
60
|
+
return;
|
|
61
|
+
let alias;
|
|
62
|
+
let subRaw;
|
|
63
|
+
let args;
|
|
64
|
+
if (isRegistrySubcommand(first)) {
|
|
65
|
+
subRaw = first;
|
|
66
|
+
args = restArgs;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
alias = first;
|
|
70
|
+
subRaw = restArgs[0];
|
|
71
|
+
args = restArgs.slice(1);
|
|
72
|
+
}
|
|
73
|
+
if (!isRegistrySubcommand(subRaw)) {
|
|
74
|
+
throw error('Unknown registry subcommand', {
|
|
75
|
+
found: subRaw,
|
|
76
|
+
validOptions: [...registrySubcommands],
|
|
77
|
+
code: 'EUSAGE',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const registry = await resolveRegistry(conf, {
|
|
81
|
+
alias,
|
|
82
|
+
interactive,
|
|
83
|
+
input,
|
|
84
|
+
output,
|
|
85
|
+
});
|
|
86
|
+
conf.options.registry = registry;
|
|
87
|
+
conf.values.registry = registry;
|
|
88
|
+
conf.command = subRaw;
|
|
89
|
+
conf.positionals = args;
|
|
90
|
+
};
|
|
91
|
+
export const command = async (conf) => {
|
|
92
|
+
// Reached only when dispatchRegistry did not rewrite conf, i.e. no
|
|
93
|
+
// subcommand was provided (help is handled by the runner earlier).
|
|
94
|
+
throw error('Missing registry subcommand', {
|
|
95
|
+
found: conf.positionals[0],
|
|
96
|
+
validOptions: [...registrySubcommands],
|
|
97
|
+
code: 'EUSAGE',
|
|
98
|
+
});
|
|
99
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExecResult } from '../exec-command.ts';
|
|
2
2
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
3
3
|
export { views } from '../exec-command.ts';
|
|
4
|
+
export declare const needsRegistry = true;
|
|
4
5
|
export declare const usage: CommandUsage;
|
|
5
6
|
export declare const command: CommandFn<ExecResult>;
|
|
@@ -2,6 +2,7 @@ import { runExec, runExecFG } from '@vltpkg/run';
|
|
|
2
2
|
import { commandUsage } from "../config/usage.js";
|
|
3
3
|
import { ExecCommand } from "../exec-command.js";
|
|
4
4
|
export { views } from "../exec-command.js";
|
|
5
|
+
export const needsRegistry = true;
|
|
5
6
|
export const usage = () => commandUsage({
|
|
6
7
|
command: 'run-exec',
|
|
7
8
|
usage: '[command ...]',
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
2
|
+
/** Where users sign up for / log into a vlt.io account. */
|
|
3
|
+
export declare const VLT_SIGNUP_URL = "https://www.vlt.io";
|
|
4
|
+
/** Base URL that per-account registries live under. */
|
|
5
|
+
export declare const VLT_REGISTRY_BASE = "https://registry.vlt.io";
|
|
6
|
+
/**
|
|
7
|
+
* The registry aliases that every vlt.io account is provisioned with.
|
|
8
|
+
* `npm` is the {@link https://docs.vlt.sh | default bare-spec alias}.
|
|
9
|
+
*/
|
|
10
|
+
export declare const accountRegistries: readonly ["npm", "main"];
|
|
11
|
+
/** Build the per-account registry URL for a given registry name. */
|
|
12
|
+
export declare const accountRegistryURL: (account: string, name: string) => string;
|
|
13
|
+
export type SetupResult = {
|
|
14
|
+
/** the account slug the registries were built for */
|
|
15
|
+
account: string;
|
|
16
|
+
/** which config file the registries were written to */
|
|
17
|
+
which: 'user' | 'project';
|
|
18
|
+
/** the alias -> url map that was staged into config */
|
|
19
|
+
registries: Record<string, string>;
|
|
20
|
+
};
|
|
21
|
+
export declare const views: {
|
|
22
|
+
readonly human: (result: SetupResult) => string;
|
|
23
|
+
};
|
|
24
|
+
export declare const usage: CommandUsage;
|
|
25
|
+
export declare const command: CommandFn<SetupResult>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { error } from '@vltpkg/error-cause';
|
|
2
|
+
import { RegistryClient } from '@vltpkg/registry-client';
|
|
3
|
+
import { defaultRegistries } from '@vltpkg/spec';
|
|
4
|
+
import { createInterface } from 'node:readline/promises';
|
|
5
|
+
import { commandUsage } from "../config/usage.js";
|
|
6
|
+
import { stdout } from "../output.js";
|
|
7
|
+
/** Where users sign up for / log into a vlt.io account. */
|
|
8
|
+
export const VLT_SIGNUP_URL = 'https://www.vlt.io';
|
|
9
|
+
/** Base URL that per-account registries live under. */
|
|
10
|
+
export const VLT_REGISTRY_BASE = 'https://registry.vlt.io';
|
|
11
|
+
/**
|
|
12
|
+
* The registry aliases that every vlt.io account is provisioned with.
|
|
13
|
+
* `npm` is the {@link https://docs.vlt.sh | default bare-spec alias}.
|
|
14
|
+
*/
|
|
15
|
+
export const accountRegistries = ['npm', 'main'];
|
|
16
|
+
/** Build the per-account registry URL for a given registry name. */
|
|
17
|
+
export const accountRegistryURL = (account, name) => `${VLT_REGISTRY_BASE}/${encodeURIComponent(account)}/${name}/`;
|
|
18
|
+
/** Ensure a registry URL ends with a single trailing slash. */
|
|
19
|
+
const normalizeRegistryURL = (url) => url.endsWith('/') ? url : `${url}/`;
|
|
20
|
+
export const views = {
|
|
21
|
+
human: (result) => {
|
|
22
|
+
const lines = [
|
|
23
|
+
`Configured ${Object.keys(result.registries).length} registry ${Object.keys(result.registries).length === 1 ?
|
|
24
|
+
'alias'
|
|
25
|
+
: 'aliases'} for "${result.account}" in ${result.which} config:`,
|
|
26
|
+
];
|
|
27
|
+
for (const [name, url] of Object.entries(result.registries)) {
|
|
28
|
+
lines.push(` ${name} -> ${url}`);
|
|
29
|
+
}
|
|
30
|
+
lines.push('', 'You can now install packages, e.g.:', ' vlt install <pkg>');
|
|
31
|
+
return lines.join('\n');
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export const usage = () => commandUsage({
|
|
35
|
+
command: 'setup',
|
|
36
|
+
usage: '[<account>]',
|
|
37
|
+
description: `Configure the registry aliases for your vlt.io account so
|
|
38
|
+
that \`vlt install\` and \`vlx\` work out of the box.
|
|
39
|
+
|
|
40
|
+
Sign up or log in at ${VLT_SIGNUP_URL} first. The wizard
|
|
41
|
+
authenticates against your account and writes the
|
|
42
|
+
\`npm\` and \`main\` registry aliases (and any additional
|
|
43
|
+
aliases you add) to your user \`vlt.json\`.`,
|
|
44
|
+
options: {
|
|
45
|
+
config: {
|
|
46
|
+
value: '<user | project>',
|
|
47
|
+
description: 'Which config file to write to. Defaults to `user`; pass ' +
|
|
48
|
+
'`--config=project` to write to the project `vlt.json`.',
|
|
49
|
+
},
|
|
50
|
+
registries: {
|
|
51
|
+
value: '<name=url>',
|
|
52
|
+
description: 'Additional registry aliases to stage non-interactively. ' +
|
|
53
|
+
'Combine with `--yes` to run setup unattended.',
|
|
54
|
+
},
|
|
55
|
+
yes: {
|
|
56
|
+
description: 'Skip interactive prompts (requires <account> and does not ' +
|
|
57
|
+
'open a browser for authentication).',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
export const command = async (conf) => {
|
|
62
|
+
const yes = !!conf.get('yes');
|
|
63
|
+
const which = conf.get('config') === 'project' ? 'project' : 'user';
|
|
64
|
+
let rl;
|
|
65
|
+
const ask = async (question) => {
|
|
66
|
+
rl ??= createInterface(process.stdin, process.stdout);
|
|
67
|
+
return (await rl.question(question)).trim();
|
|
68
|
+
};
|
|
69
|
+
try {
|
|
70
|
+
stdout(`Sign up or log in at ${VLT_SIGNUP_URL} before continuing.`);
|
|
71
|
+
// 1. resolve the account slug
|
|
72
|
+
let account = conf.positionals[0]?.trim();
|
|
73
|
+
if (!account) {
|
|
74
|
+
if (yes) {
|
|
75
|
+
throw error('An account slug is required in non-interactive mode. ' +
|
|
76
|
+
'Pass it as an argument: `vlt setup <account> --yes`.', { code: 'ECONFIG' });
|
|
77
|
+
}
|
|
78
|
+
account = await ask('vlt.io account or organization slug: ');
|
|
79
|
+
if (!account) {
|
|
80
|
+
throw error('No account slug provided.', { code: 'ECONFIG' });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// 2. stage the two known account registries
|
|
84
|
+
const registries = {};
|
|
85
|
+
for (const name of accountRegistries) {
|
|
86
|
+
registries[name] = accountRegistryURL(account, name);
|
|
87
|
+
}
|
|
88
|
+
// 3. merge any user-supplied registry aliases (skip built-in defaults)
|
|
89
|
+
const builtinRegistries = defaultRegistries;
|
|
90
|
+
for (const [name, url] of Object.entries(conf.options.registries)) {
|
|
91
|
+
if (builtinRegistries[name] === url)
|
|
92
|
+
continue;
|
|
93
|
+
registries[name] = normalizeRegistryURL(url);
|
|
94
|
+
}
|
|
95
|
+
const rc = new RegistryClient(conf.options);
|
|
96
|
+
// 4. authenticate against the account registries (interactive only)
|
|
97
|
+
if (!yes) {
|
|
98
|
+
const doAuth = await ask('Authenticate with your vlt.io account now? (Y/n) ');
|
|
99
|
+
if (!/^n/i.test(doAuth)) {
|
|
100
|
+
for (const name of accountRegistries) {
|
|
101
|
+
stdout(`Authenticating against the "${name}" registry...`);
|
|
102
|
+
await rc.login(accountRegistryURL(account, name));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// 5. offer to add further custom aliases
|
|
106
|
+
for (;;) {
|
|
107
|
+
const more = await ask('Add another registry alias? (y/N) ');
|
|
108
|
+
if (!/^y/i.test(more))
|
|
109
|
+
break;
|
|
110
|
+
const name = await ask(' alias name: ');
|
|
111
|
+
if (!name) {
|
|
112
|
+
stdout(' alias name is required, skipping.');
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (name in registries) {
|
|
116
|
+
stdout(` alias "${name}" is already staged, skipping.`);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const url = await ask(' registry url: ');
|
|
120
|
+
if (!url) {
|
|
121
|
+
stdout(' registry url is required, skipping.');
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
const normalized = normalizeRegistryURL(url);
|
|
125
|
+
registries[name] = normalized;
|
|
126
|
+
const auth = await ask(` authenticate against "${name}" now? (y/N) `);
|
|
127
|
+
if (/^y/i.test(auth)) {
|
|
128
|
+
await rc.login(normalized);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// 6. persist the staged registries (merged, not clobbered)
|
|
133
|
+
await conf.addConfigToFile(which, { registries });
|
|
134
|
+
return { account, which, registries };
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
if (rl) {
|
|
138
|
+
rl.close();
|
|
139
|
+
process.stdin.pause();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
package/dist/commands/token.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type TokenListResult = {
|
|
|
23
23
|
identity: string;
|
|
24
24
|
registries: RegistryTokens[];
|
|
25
25
|
};
|
|
26
|
+
export declare const needsRegistry = true;
|
|
26
27
|
export declare const usage: CommandUsage;
|
|
27
28
|
export declare const views: {
|
|
28
29
|
readonly human: (r: TokenListResult | void) => string | undefined;
|
package/dist/commands/token.js
CHANGED
|
@@ -2,10 +2,15 @@ import { error } from '@vltpkg/error-cause';
|
|
|
2
2
|
import { deleteToken, getKC, getToken, normalizeRegistryKey, registryBase, RegistryClient, setToken, } from '@vltpkg/registry-client';
|
|
3
3
|
import { commandUsage } from "../config/usage.js";
|
|
4
4
|
import { readPassword } from "../read-password.js";
|
|
5
|
+
import { requireRegistry } from "../require-registry.js";
|
|
6
|
+
export const needsRegistry = true;
|
|
5
7
|
export const usage = () => commandUsage({
|
|
6
8
|
command: 'token',
|
|
7
9
|
usage: ['list', 'add', 'rm'],
|
|
8
|
-
description: `Manage registry authentication tokens in the vlt keychain
|
|
10
|
+
description: `Manage registry authentication tokens in the vlt keychain.
|
|
11
|
+
|
|
12
|
+
Target a specific configured registry by alias with
|
|
13
|
+
\`vlt registry <alias> token <subcommand>\`.`,
|
|
9
14
|
subcommands: {
|
|
10
15
|
list: {
|
|
11
16
|
usage: '',
|
|
@@ -131,7 +136,7 @@ const listTokens = async (rc, registry, identity, alias) => {
|
|
|
131
136
|
}
|
|
132
137
|
};
|
|
133
138
|
export const command = async (conf) => {
|
|
134
|
-
const reg = normalizeRegistryKey(conf
|
|
139
|
+
const reg = normalizeRegistryKey(requireRegistry(conf));
|
|
135
140
|
switch (conf.positionals[0]) {
|
|
136
141
|
case 'ls':
|
|
137
142
|
case 'list': {
|
|
@@ -140,7 +145,7 @@ export const command = async (conf) => {
|
|
|
140
145
|
const registries = [];
|
|
141
146
|
const seen = new Set();
|
|
142
147
|
// Always query the default registry first
|
|
143
|
-
const defaultReg = conf
|
|
148
|
+
const defaultReg = requireRegistry(conf);
|
|
144
149
|
seen.add(normalizeRegistryKey(defaultReg));
|
|
145
150
|
registries.push(await listTokens(rc, defaultReg, identity, 'default'));
|
|
146
151
|
// Then query all configured registry aliases
|
|
@@ -2,6 +2,7 @@ import { uninstall } from '@vltpkg/graph';
|
|
|
2
2
|
import { commandUsage } from "../config/usage.js";
|
|
3
3
|
import { parseRemoveArgs } from "../parse-add-remove-args.js";
|
|
4
4
|
import { InstallReporter } from "./install/reporter.js";
|
|
5
|
+
export const needsRegistry = true;
|
|
5
6
|
export const usage = () => commandUsage({
|
|
6
7
|
command: 'uninstall',
|
|
7
8
|
usage: '[package ...]',
|
|
@@ -3,6 +3,8 @@ import { RegistryClient } from '@vltpkg/registry-client';
|
|
|
3
3
|
import { Spec } from '@vltpkg/spec';
|
|
4
4
|
import { asError } from '@vltpkg/types';
|
|
5
5
|
import { commandUsage } from "../config/usage.js";
|
|
6
|
+
import { resolveRegistry } from "../require-registry.js";
|
|
7
|
+
export const needsRegistry = true;
|
|
6
8
|
export const usage = () => commandUsage({
|
|
7
9
|
command: 'unpublish',
|
|
8
10
|
usage: ['<package>@<version>', '<package> --force'],
|
|
@@ -49,7 +51,8 @@ export const command = async (conf) => {
|
|
|
49
51
|
if (!specArg) {
|
|
50
52
|
throw error('unpublish requires a package spec argument (e.g. pkg@version)', { code: 'EUSAGE' });
|
|
51
53
|
}
|
|
52
|
-
const {
|
|
54
|
+
const { otp, force } = conf.options;
|
|
55
|
+
const registry = await resolveRegistry(conf);
|
|
53
56
|
const registryUrl = new URL(registry);
|
|
54
57
|
const spec = Spec.parseArgs(specArg, conf.options);
|
|
55
58
|
const name = spec.name;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
2
2
|
import { InstallReporter } from './install/reporter.ts';
|
|
3
3
|
import type { InstallResult } from './install.ts';
|
|
4
|
+
export declare const needsRegistry = true;
|
|
4
5
|
export declare const usage: CommandUsage;
|
|
5
6
|
export declare const views: {
|
|
6
7
|
readonly json: (i: InstallResult) => {
|
package/dist/commands/update.js
CHANGED
|
@@ -2,6 +2,7 @@ import { update } from '@vltpkg/graph';
|
|
|
2
2
|
import { error } from '@vltpkg/error-cause';
|
|
3
3
|
import { commandUsage } from "../config/usage.js";
|
|
4
4
|
import { InstallReporter } from "./install/reporter.js";
|
|
5
|
+
export const needsRegistry = true;
|
|
5
6
|
export const usage = () => commandUsage({
|
|
6
7
|
command: 'update',
|
|
7
8
|
usage: '',
|
package/dist/commands/view.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Manifest, Packument } from '@vltpkg/types';
|
|
|
2
2
|
import type { PackageReportData } from '@vltpkg/security-archive';
|
|
3
3
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
4
4
|
import type { ViewOptions } from '../view.ts';
|
|
5
|
+
export declare const needsRegistry = true;
|
|
5
6
|
export declare const usage: CommandUsage;
|
|
6
7
|
export type ViewResult = {
|
|
7
8
|
/** The full packument data from the registry */
|
package/dist/commands/view.js
CHANGED
|
@@ -5,6 +5,7 @@ import { SecurityArchive } from '@vltpkg/security-archive';
|
|
|
5
5
|
import { Spec } from '@vltpkg/spec';
|
|
6
6
|
import { joinDepIDTuple } from '@vltpkg/dep-id';
|
|
7
7
|
import { commandUsage } from "../config/usage.js";
|
|
8
|
+
export const needsRegistry = true;
|
|
8
9
|
export const usage = () => commandUsage({
|
|
9
10
|
command: 'view',
|
|
10
11
|
usage: [
|
|
@@ -298,7 +299,7 @@ export const command = async (conf) => {
|
|
|
298
299
|
const fieldPath = conf.positionals[1];
|
|
299
300
|
const spec = Spec.parseArgs(specArg, conf.options);
|
|
300
301
|
const pic = new PackageInfoClient(conf.options);
|
|
301
|
-
// Fetch the packument and resolved manifest
|
|
302
|
+
// Fetch the full packument (needs time, maintainers) and resolved manifest
|
|
302
303
|
const [packument, resolvedManifest] = await Promise.all([
|
|
303
304
|
pic.packument(spec),
|
|
304
305
|
pic.manifest(spec),
|
package/dist/commands/whoami.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { RegistryClient } from '@vltpkg/registry-client';
|
|
2
2
|
import { commandUsage } from "../config/usage.js";
|
|
3
|
+
import { resolveRegistry } from "../require-registry.js";
|
|
4
|
+
export const needsRegistry = true;
|
|
3
5
|
export const usage = () => commandUsage({
|
|
4
6
|
command: 'whoami',
|
|
5
7
|
usage: [''],
|
|
6
8
|
description: `Look up the username for the currently active token,
|
|
7
|
-
when logged into a registry
|
|
9
|
+
when logged into a registry.
|
|
10
|
+
|
|
11
|
+
Target a specific configured registry by alias with
|
|
12
|
+
\`vlt registry <alias> whoami\`.`,
|
|
8
13
|
options: {
|
|
9
14
|
registry: {
|
|
10
15
|
value: '<url>',
|
|
@@ -22,7 +27,7 @@ export const views = {
|
|
|
22
27
|
};
|
|
23
28
|
export const command = async (conf) => {
|
|
24
29
|
const rc = new RegistryClient(conf.options);
|
|
25
|
-
const response = await rc.request(new URL('-/whoami', conf
|
|
30
|
+
const response = await rc.request(new URL('-/whoami', await resolveRegistry(conf)), { useCache: false });
|
|
26
31
|
const { username } = response.json();
|
|
27
32
|
return { username };
|
|
28
33
|
};
|
|
@@ -47,9 +47,11 @@ export declare const commands: {
|
|
|
47
47
|
readonly profile: "profile";
|
|
48
48
|
readonly publish: "publish";
|
|
49
49
|
readonly query: "query";
|
|
50
|
+
readonly registry: "registry";
|
|
50
51
|
readonly repo: "repo";
|
|
51
52
|
readonly 'run-exec': "run-exec";
|
|
52
53
|
readonly run: "run";
|
|
54
|
+
readonly setup: "setup";
|
|
53
55
|
readonly token: "token";
|
|
54
56
|
readonly uninstall: "uninstall";
|
|
55
57
|
readonly unpublish: "unpublish";
|
|
@@ -85,12 +87,17 @@ export declare const definition: import("jackspeak").Jack<{
|
|
|
85
87
|
'no-color': import("jackspeak").ConfigOption<"boolean", false, undefined>;
|
|
86
88
|
} & {
|
|
87
89
|
registry: {
|
|
90
|
+
hint: string;
|
|
91
|
+
description: string;
|
|
92
|
+
};
|
|
93
|
+
'default-registry-alias': {
|
|
88
94
|
hint: string;
|
|
89
95
|
default: string;
|
|
90
96
|
description: string;
|
|
91
97
|
};
|
|
92
98
|
} & {
|
|
93
99
|
registry: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
100
|
+
'default-registry-alias': import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
94
101
|
} & {
|
|
95
102
|
registries: {
|
|
96
103
|
hint: string;
|
|
@@ -306,6 +313,21 @@ export declare const definition: import("jackspeak").Jack<{
|
|
|
306
313
|
};
|
|
307
314
|
} & {
|
|
308
315
|
view: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
316
|
+
} & {
|
|
317
|
+
loglevel: {
|
|
318
|
+
hint: string;
|
|
319
|
+
default: string;
|
|
320
|
+
description: string;
|
|
321
|
+
validOptions: readonly ["silent", "error", "warn", "info", "verbose", "debug"];
|
|
322
|
+
};
|
|
323
|
+
} & {
|
|
324
|
+
loglevel: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
325
|
+
} & {
|
|
326
|
+
verbose: {
|
|
327
|
+
description: string;
|
|
328
|
+
};
|
|
329
|
+
} & {
|
|
330
|
+
verbose: import("jackspeak").ConfigOption<"boolean", false, undefined>;
|
|
309
331
|
} & {
|
|
310
332
|
'dashboard-root': {
|
|
311
333
|
hint: string;
|
|
@@ -318,6 +340,10 @@ export declare const definition: import("jackspeak").Jack<{
|
|
|
318
340
|
short: string;
|
|
319
341
|
description: string;
|
|
320
342
|
};
|
|
343
|
+
'save-exact': {
|
|
344
|
+
short: string;
|
|
345
|
+
description: string;
|
|
346
|
+
};
|
|
321
347
|
'save-optional': {
|
|
322
348
|
short: string;
|
|
323
349
|
description: string;
|
|
@@ -331,9 +357,17 @@ export declare const definition: import("jackspeak").Jack<{
|
|
|
331
357
|
};
|
|
332
358
|
} & {
|
|
333
359
|
'save-dev': import("jackspeak").ConfigOption<"boolean", false, undefined>;
|
|
360
|
+
'save-exact': import("jackspeak").ConfigOption<"boolean", false, undefined>;
|
|
334
361
|
'save-optional': import("jackspeak").ConfigOption<"boolean", false, undefined>;
|
|
335
362
|
'save-peer': import("jackspeak").ConfigOption<"boolean", false, undefined>;
|
|
336
363
|
'save-prod': import("jackspeak").ConfigOption<"boolean", false, undefined>;
|
|
364
|
+
} & {
|
|
365
|
+
'save-prefix': {
|
|
366
|
+
description: string;
|
|
367
|
+
default: string;
|
|
368
|
+
};
|
|
369
|
+
} & {
|
|
370
|
+
'save-prefix': import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
337
371
|
} & {
|
|
338
372
|
'expect-results': {
|
|
339
373
|
hint: string;
|