@vltpkg/cli-sdk 1.0.0-rc.31 → 1.0.0-rc.33
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 +3 -1
- package/dist/commands/query.d.ts +1 -0
- package/dist/commands/query.js +1 -0
- 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 +11 -4
- 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 +3 -2
- package/dist/commands/whoami.d.ts +1 -0
- package/dist/commands/whoami.js +7 -2
- package/dist/config/definition.d.ts +38 -0
- package/dist/config/definition.js +88 -11
- package/dist/config/index.js +6 -0
- package/dist/custom-help.js +17 -1
- package/dist/index.js +4 -0
- package/dist/load-command.d.ts +6 -0
- package/dist/output.js +15 -1
- package/dist/parse-add-remove-args.js +65 -11
- package/dist/print-err.js +10 -1
- 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
package/dist/commands/access.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { error } from '@vltpkg/error-cause';
|
|
2
2
|
import { RegistryClient } from '@vltpkg/registry-client';
|
|
3
3
|
import { commandUsage } from "../config/usage.js";
|
|
4
|
+
import { resolveRegistry } from "../require-registry.js";
|
|
5
|
+
export const needsRegistry = true;
|
|
4
6
|
export const usage = () => commandUsage({
|
|
5
7
|
command: 'access',
|
|
6
8
|
usage: '<command> [<args>]',
|
|
7
9
|
description: `Set or get access levels for published packages
|
|
8
|
-
and manage team-based package permissions
|
|
10
|
+
and manage team-based package permissions.
|
|
11
|
+
|
|
12
|
+
Target a specific configured registry by alias with
|
|
13
|
+
\`vlt registry <alias> access <subcommand>\`.`,
|
|
9
14
|
subcommands: {
|
|
10
15
|
'list packages': {
|
|
11
16
|
usage: '[<scope|user|org>]',
|
|
@@ -93,7 +98,7 @@ const listPackages = async (conf, args) => {
|
|
|
93
98
|
});
|
|
94
99
|
}
|
|
95
100
|
const rc = new RegistryClient(conf.options);
|
|
96
|
-
const registryUrl = new URL(conf
|
|
101
|
+
const registryUrl = new URL(await resolveRegistry(conf));
|
|
97
102
|
// Determine who to list for — use entity arg or fall back to scope from package.json
|
|
98
103
|
const scope = entity ?? getDefaultScope(conf);
|
|
99
104
|
const url = new URL(`-/org/${encodeURIComponent(scope)}/package`, registryUrl);
|
|
@@ -115,7 +120,7 @@ const getStatus = async (conf, args) => {
|
|
|
115
120
|
});
|
|
116
121
|
}
|
|
117
122
|
const rc = new RegistryClient(conf.options);
|
|
118
|
-
const registryUrl = new URL(conf
|
|
123
|
+
const registryUrl = new URL(await resolveRegistry(conf));
|
|
119
124
|
const url = new URL(`-/package/${encodePkgName(pkg)}/access`, registryUrl);
|
|
120
125
|
const response = await rc.request(url, { useCache: false });
|
|
121
126
|
const data = response.json();
|
|
@@ -141,7 +146,7 @@ const setStatus = async (conf, args) => {
|
|
|
141
146
|
});
|
|
142
147
|
}
|
|
143
148
|
const rc = new RegistryClient(conf.options);
|
|
144
|
-
const registryUrl = new URL(conf
|
|
149
|
+
const registryUrl = new URL(await resolveRegistry(conf));
|
|
145
150
|
const url = new URL(`-/package/${encodePkgName(pkg)}/access`, registryUrl);
|
|
146
151
|
await rc.request(url, {
|
|
147
152
|
method: 'PUT',
|
|
@@ -177,7 +182,7 @@ const grant = async (conf, args) => {
|
|
|
177
182
|
}
|
|
178
183
|
const pkgName = pkg ?? getDefaultPkgName(conf);
|
|
179
184
|
const rc = new RegistryClient(conf.options);
|
|
180
|
-
const registryUrl = new URL(conf
|
|
185
|
+
const registryUrl = new URL(await resolveRegistry(conf));
|
|
181
186
|
const url = new URL(`-/team/${encodeURIComponent(scope)}/${encodeURIComponent(team)}/package`, registryUrl);
|
|
182
187
|
await rc.request(url, {
|
|
183
188
|
method: 'PUT',
|
|
@@ -214,7 +219,7 @@ const revoke = async (conf, args) => {
|
|
|
214
219
|
}
|
|
215
220
|
const pkgName = pkg ?? getDefaultPkgName(conf);
|
|
216
221
|
const rc = new RegistryClient(conf.options);
|
|
217
|
-
const registryUrl = new URL(conf
|
|
222
|
+
const registryUrl = new URL(await resolveRegistry(conf));
|
|
218
223
|
const url = new URL(`-/team/${encodeURIComponent(scope)}/${encodeURIComponent(team)}/package`, registryUrl);
|
|
219
224
|
await rc.request(url, {
|
|
220
225
|
method: 'DELETE',
|
package/dist/commands/build.d.ts
CHANGED
package/dist/commands/build.js
CHANGED
package/dist/commands/cache.d.ts
CHANGED
package/dist/commands/cache.js
CHANGED
package/dist/commands/ci.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { InstallReporter } from './install/reporter.ts';
|
|
|
2
2
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
3
3
|
import type { InstallResult } from './install.ts';
|
|
4
4
|
export type CIResult = Omit<InstallResult, 'buildQueue'>;
|
|
5
|
+
export declare const needsRegistry = true;
|
|
5
6
|
export declare const usage: CommandUsage;
|
|
6
7
|
export declare const views: {
|
|
7
8
|
readonly json: (i: CIResult) => import("@vltpkg/graph").LockfileData;
|
package/dist/commands/ci.js
CHANGED
|
@@ -2,6 +2,7 @@ import type { PromptFn } from '@vltpkg/vlx';
|
|
|
2
2
|
import type { ExecResult } from '../exec-command.ts';
|
|
3
3
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
4
4
|
export { views } from '../exec-command.ts';
|
|
5
|
+
export declare const needsRegistry = true;
|
|
5
6
|
export declare const usage: CommandUsage;
|
|
6
7
|
export declare const prettyPath: (path: string) => string;
|
|
7
8
|
export declare const promptFn: PromptFn;
|
package/dist/commands/create.js
CHANGED
|
@@ -6,6 +6,7 @@ import { commandUsage } from "../config/usage.js";
|
|
|
6
6
|
import { ExecCommand } from "../exec-command.js";
|
|
7
7
|
import { styleTextStdout } from "../output.js";
|
|
8
8
|
export { views } from "../exec-command.js";
|
|
9
|
+
export const needsRegistry = true;
|
|
9
10
|
export const usage = () => commandUsage({
|
|
10
11
|
command: 'create',
|
|
11
12
|
usage: '<initializer> [args...]',
|
|
@@ -5,6 +5,8 @@ import { Spec } from '@vltpkg/spec';
|
|
|
5
5
|
import { satisfies } from '@vltpkg/semver';
|
|
6
6
|
import { asError } from '@vltpkg/types';
|
|
7
7
|
import { commandUsage } from "../config/usage.js";
|
|
8
|
+
import { resolveRegistry } from "../require-registry.js";
|
|
9
|
+
export const needsRegistry = true;
|
|
8
10
|
export const usage = () => commandUsage({
|
|
9
11
|
command: 'deprecate',
|
|
10
12
|
usage: '<pkg>[@<version>] <message>',
|
|
@@ -66,7 +68,8 @@ export const command = async (conf) => {
|
|
|
66
68
|
found: specArg,
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
|
-
const {
|
|
71
|
+
const { otp } = conf.options;
|
|
72
|
+
const registry = await resolveRegistry(conf);
|
|
70
73
|
const registryUrl = new URL(registry);
|
|
71
74
|
// Fetch the current packument
|
|
72
75
|
const pic = new PackageInfoClient(conf.options);
|
|
@@ -2,6 +2,8 @@ import { error } from '@vltpkg/error-cause';
|
|
|
2
2
|
import { RegistryClient } from '@vltpkg/registry-client';
|
|
3
3
|
import { Spec } from '@vltpkg/spec';
|
|
4
4
|
import { commandUsage } from "../config/usage.js";
|
|
5
|
+
import { resolveRegistry } from "../require-registry.js";
|
|
6
|
+
export const needsRegistry = true;
|
|
5
7
|
export const usage = () => commandUsage({
|
|
6
8
|
command: 'dist-tag',
|
|
7
9
|
usage: [
|
|
@@ -91,7 +93,7 @@ export const command = async (conf) => {
|
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
const rc = new RegistryClient(conf.options);
|
|
94
|
-
const registry = conf
|
|
96
|
+
const registry = await resolveRegistry(conf);
|
|
95
97
|
switch (sub) {
|
|
96
98
|
case 'add': {
|
|
97
99
|
const specArg = args[0];
|
package/dist/commands/exec.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { PromptFn } from '@vltpkg/vlx';
|
|
|
2
2
|
import type { ExecResult } from '../exec-command.ts';
|
|
3
3
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
4
4
|
export { views } from '../exec-command.ts';
|
|
5
|
+
export declare const needsRegistry = true;
|
|
5
6
|
export declare const usage: CommandUsage;
|
|
6
7
|
export declare const prettyPath: (path: string) => string;
|
|
7
8
|
export declare const promptFn: PromptFn;
|
package/dist/commands/exec.js
CHANGED
|
@@ -7,6 +7,7 @@ import { commandUsage } from "../config/usage.js";
|
|
|
7
7
|
import { ExecCommand } from "../exec-command.js";
|
|
8
8
|
import { styleTextStdout } from "../output.js";
|
|
9
9
|
export { views } from "../exec-command.js";
|
|
10
|
+
export const needsRegistry = true;
|
|
10
11
|
export const usage = () => commandUsage({
|
|
11
12
|
command: 'exec',
|
|
12
13
|
usage: '[--package=<pkg>] [--call=<cmd>] [command...]',
|
package/dist/commands/install.js
CHANGED
|
@@ -3,6 +3,7 @@ import { install } from '@vltpkg/graph';
|
|
|
3
3
|
import { parseAddArgs } from "../parse-add-remove-args.js";
|
|
4
4
|
import { InstallReporter } from "./install/reporter.js";
|
|
5
5
|
import { trackInstall } from "../telemetry.js";
|
|
6
|
+
export const needsRegistry = true;
|
|
6
7
|
export const usage = () => commandUsage({
|
|
7
8
|
command: 'install',
|
|
8
9
|
usage: '[packages ...]',
|
|
@@ -12,6 +13,13 @@ export const usage = () => commandUsage({
|
|
|
12
13
|
'save-dev': {
|
|
13
14
|
description: 'Save installed packages to package.json as devDependencies.',
|
|
14
15
|
},
|
|
16
|
+
'save-exact': {
|
|
17
|
+
description: 'Save installed packages with exact versions instead of a semver range.',
|
|
18
|
+
},
|
|
19
|
+
'save-prefix': {
|
|
20
|
+
value: '<prefix>',
|
|
21
|
+
description: 'The version prefix to use when saving dependencies (e.g. ^, ~, >=, or empty string).',
|
|
22
|
+
},
|
|
15
23
|
'save-optional': {
|
|
16
24
|
description: 'Save installed packages to package.json as optionalDependencies.',
|
|
17
25
|
},
|
|
@@ -115,6 +123,8 @@ export const command = async (conf) => {
|
|
|
115
123
|
const frozenLockfile = conf.options['frozen-lockfile'];
|
|
116
124
|
const expectLockfile = conf.options['expect-lockfile'];
|
|
117
125
|
const lockfileOnly = conf.options['lockfile-only'];
|
|
126
|
+
const saveExact = conf.values['save-exact'];
|
|
127
|
+
const savePrefix = conf.values['save-prefix'];
|
|
118
128
|
/* c8 ignore start */
|
|
119
129
|
const allowScripts = conf.get('allow-scripts') ?
|
|
120
130
|
String(conf.get('allow-scripts'))
|
|
@@ -127,6 +137,8 @@ export const command = async (conf) => {
|
|
|
127
137
|
expectLockfile,
|
|
128
138
|
allowScripts,
|
|
129
139
|
lockfileOnly,
|
|
140
|
+
saveExact,
|
|
141
|
+
savePrefix,
|
|
130
142
|
}, add);
|
|
131
143
|
/* c8 ignore next 9 - telemetry is best-effort */
|
|
132
144
|
try {
|
package/dist/commands/list.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { humanReadableOutput, jsonOutput, mermaidOutput } from '@vltpkg/graph';
|
|
|
2
2
|
import type { HumanReadableOutputGraph, JSONOutputGraph, MermaidOutputGraph } from '@vltpkg/graph';
|
|
3
3
|
import { MermaidImageView } from '../mermaid-image-view.ts';
|
|
4
4
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
5
|
+
export declare const needsRegistry = true;
|
|
5
6
|
export declare const usage: CommandUsage;
|
|
6
7
|
export type ListResult = JSONOutputGraph & MermaidOutputGraph & HumanReadableOutputGraph & {
|
|
7
8
|
queryString: string;
|
package/dist/commands/list.js
CHANGED
|
@@ -5,6 +5,7 @@ import { error } from '@vltpkg/error-cause';
|
|
|
5
5
|
import { commandUsage } from "../config/usage.js";
|
|
6
6
|
import { createHostContextsMap } from "../query-host-contexts.js";
|
|
7
7
|
import { MermaidImageView } from "../mermaid-image-view.js";
|
|
8
|
+
export const needsRegistry = true;
|
|
8
9
|
export const usage = () => commandUsage({
|
|
9
10
|
command: 'ls',
|
|
10
11
|
usage: [
|
package/dist/commands/login.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { RegistryClient } from '@vltpkg/registry-client';
|
|
2
2
|
import { commandUsage } from "../config/usage.js";
|
|
3
|
+
import { missingRegistryError } from "../require-registry.js";
|
|
3
4
|
export const usage = () => commandUsage({
|
|
4
5
|
command: 'login',
|
|
5
6
|
usage: [''],
|
|
6
7
|
description: `Authenticate against a registry, and store the token in
|
|
7
|
-
the appropriate config file for later use
|
|
8
|
+
the appropriate config file for later use.
|
|
9
|
+
|
|
10
|
+
There is no default registry, so a registry must either
|
|
11
|
+
already be configured or be provided with
|
|
12
|
+
\`--registry=<url>\`. On success the registry is written to
|
|
13
|
+
the project's \`vlt.json\`.`,
|
|
8
14
|
options: {
|
|
9
15
|
registry: {
|
|
10
16
|
value: '<url>',
|
|
11
|
-
description: 'Registry URL to authenticate against.',
|
|
17
|
+
description: 'Registry URL to authenticate against. Saved to vlt.json.',
|
|
12
18
|
},
|
|
13
19
|
identity: {
|
|
14
20
|
value: '<name>',
|
|
@@ -17,6 +23,13 @@ export const usage = () => commandUsage({
|
|
|
17
23
|
},
|
|
18
24
|
});
|
|
19
25
|
export const command = async (conf) => {
|
|
26
|
+
const { registry } = conf.options;
|
|
27
|
+
// login is exempt from the needsRegistry pre-check, since it is the
|
|
28
|
+
// guided way out of it -- but it still needs a target.
|
|
29
|
+
if (!registry)
|
|
30
|
+
throw missingRegistryError();
|
|
20
31
|
const rc = new RegistryClient(conf.options);
|
|
21
|
-
await rc.login(
|
|
32
|
+
await rc.login(registry);
|
|
33
|
+
// persist the registry so subsequent commands are configured
|
|
34
|
+
await conf.addConfigToFile('project', { registry });
|
|
22
35
|
};
|
package/dist/commands/logout.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: 'logout',
|
|
5
7
|
usage: [''],
|
|
6
8
|
description: `Log out of the default registry, deleting the token from
|
|
7
|
-
the local keychain, as well as destroying it on the server
|
|
9
|
+
the local keychain, as well as destroying it on the server.
|
|
10
|
+
|
|
11
|
+
Target a specific configured registry by alias with
|
|
12
|
+
\`vlt registry <alias> logout\`.`,
|
|
8
13
|
options: {
|
|
9
14
|
registry: {
|
|
10
15
|
value: '<url>',
|
|
@@ -18,5 +23,5 @@ export const usage = () => commandUsage({
|
|
|
18
23
|
});
|
|
19
24
|
export const command = async (conf) => {
|
|
20
25
|
const rc = new RegistryClient(conf.options);
|
|
21
|
-
await rc.logout(conf
|
|
26
|
+
await rc.logout(await resolveRegistry(conf));
|
|
22
27
|
};
|
package/dist/commands/pack.d.ts
CHANGED
package/dist/commands/pack.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Query } from '@vltpkg/query';
|
|
|
10
10
|
import { error } from '@vltpkg/error-cause';
|
|
11
11
|
import { createHostContextsMap } from "../query-host-contexts.js";
|
|
12
12
|
import { minimatch } from 'minimatch';
|
|
13
|
+
export const needsRegistry = true;
|
|
13
14
|
export const usage = () => commandUsage({
|
|
14
15
|
command: 'pack',
|
|
15
16
|
usage: '',
|
package/dist/commands/ping.d.ts
CHANGED
package/dist/commands/ping.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { RegistryClient } from '@vltpkg/registry-client';
|
|
2
2
|
import { error } from '@vltpkg/error-cause';
|
|
3
3
|
import { commandUsage } from "../config/usage.js";
|
|
4
|
+
import { requireRegistry } from "../require-registry.js";
|
|
5
|
+
export const needsRegistry = true;
|
|
4
6
|
export const usage = () => commandUsage({
|
|
5
7
|
command: 'ping',
|
|
6
8
|
usage: ['', '[<registry-alias>]'],
|
|
@@ -99,13 +101,14 @@ export const command = async (conf) => {
|
|
|
99
101
|
else {
|
|
100
102
|
// Ping all configured registries
|
|
101
103
|
const registries = conf.options.registries;
|
|
104
|
+
const defaultRegistry = requireRegistry(conf);
|
|
102
105
|
const results = [];
|
|
103
106
|
// Always ping the default registry first
|
|
104
|
-
results.push(await pingRegistry(rc,
|
|
107
|
+
results.push(await pingRegistry(rc, defaultRegistry, 'default'));
|
|
105
108
|
// Then ping all configured registry aliases
|
|
106
109
|
for (const [alias, registry] of Object.entries(registries)) {
|
|
107
110
|
// Skip if it's the same as the default registry
|
|
108
|
-
if (registry !==
|
|
111
|
+
if (registry !== defaultRegistry) {
|
|
109
112
|
results.push(await pingRegistry(rc, registry, alias));
|
|
110
113
|
}
|
|
111
114
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { JSONField } from '@vltpkg/types';
|
|
2
2
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
3
|
+
export declare const needsRegistry = true;
|
|
3
4
|
export declare const usage: CommandUsage;
|
|
4
5
|
export type ProfileData = Record<string, JSONField>;
|
|
5
6
|
export type ProfileResult = ProfileData | {
|
package/dist/commands/profile.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { error } from '@vltpkg/error-cause';
|
|
2
2
|
import { RegistryClient } from '@vltpkg/registry-client';
|
|
3
3
|
import { commandUsage } from "../config/usage.js";
|
|
4
|
+
import { resolveRegistry } from "../require-registry.js";
|
|
5
|
+
export const needsRegistry = true;
|
|
4
6
|
export const usage = () => commandUsage({
|
|
5
7
|
command: 'profile',
|
|
6
8
|
usage: '<command> [<args>]',
|
|
@@ -64,7 +66,7 @@ export const command = async (conf) => {
|
|
|
64
66
|
};
|
|
65
67
|
const getProfile = async (conf, args) => {
|
|
66
68
|
const rc = new RegistryClient(conf.options);
|
|
67
|
-
const registryUrl = new URL(conf
|
|
69
|
+
const registryUrl = new URL(await resolveRegistry(conf));
|
|
68
70
|
const url = new URL('-/npm/v1/user', registryUrl);
|
|
69
71
|
const response = await rc.request(url, { useCache: false });
|
|
70
72
|
const data = response.json();
|
|
@@ -90,7 +92,7 @@ const setProfile = async (conf, args) => {
|
|
|
90
92
|
});
|
|
91
93
|
}
|
|
92
94
|
const rc = new RegistryClient(conf.options);
|
|
93
|
-
const registryUrl = new URL(conf
|
|
95
|
+
const registryUrl = new URL(await resolveRegistry(conf));
|
|
94
96
|
const url = new URL('-/npm/v1/user', registryUrl);
|
|
95
97
|
const response = await rc.request(url, {
|
|
96
98
|
method: 'POST',
|
package/dist/commands/publish.js
CHANGED
|
@@ -11,6 +11,8 @@ import { actual } from '@vltpkg/graph';
|
|
|
11
11
|
import { Query } from '@vltpkg/query';
|
|
12
12
|
import { createHostContextsMap } from "../query-host-contexts.js";
|
|
13
13
|
import { minimatch } from 'minimatch';
|
|
14
|
+
import { resolveRegistry } from "../require-registry.js";
|
|
15
|
+
export const needsRegistry = true;
|
|
14
16
|
export const usage = () => commandUsage({
|
|
15
17
|
command: 'publish',
|
|
16
18
|
usage: '',
|
|
@@ -164,7 +166,7 @@ const commandSingle = async (location, conf) => {
|
|
|
164
166
|
const publishConfig = getPublishConfig(manifest);
|
|
165
167
|
const tag = publishConfig?.tag ?? conf.options.tag;
|
|
166
168
|
const access = publishConfig?.access ?? conf.options.access;
|
|
167
|
-
const registry = publishConfig?.registry ?? conf
|
|
169
|
+
const registry = publishConfig?.registry ?? (await resolveRegistry(conf));
|
|
168
170
|
const registryUrl = new URL(registryBase(registry));
|
|
169
171
|
const runOptions = {
|
|
170
172
|
cwd: manifestDir,
|
package/dist/commands/query.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { humanReadableOutput, jsonOutput, mermaidOutput } from '@vltpkg/graph';
|
|
|
2
2
|
import type { HumanReadableOutputGraph, JSONOutputGraph, MermaidOutputGraph } from '@vltpkg/graph';
|
|
3
3
|
import { MermaidImageView } from '../mermaid-image-view.ts';
|
|
4
4
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
5
|
+
export declare const needsRegistry = true;
|
|
5
6
|
export declare const usage: CommandUsage;
|
|
6
7
|
type QueryResult = JSONOutputGraph & MermaidOutputGraph & HumanReadableOutputGraph & {
|
|
7
8
|
queryString: string;
|
package/dist/commands/query.js
CHANGED
|
@@ -6,6 +6,7 @@ import { SecurityArchive } from '@vltpkg/security-archive';
|
|
|
6
6
|
import { commandUsage } from "../config/usage.js";
|
|
7
7
|
import { createHostContextsMap } from "../query-host-contexts.js";
|
|
8
8
|
import { MermaidImageView } from "../mermaid-image-view.js";
|
|
9
|
+
export const needsRegistry = true;
|
|
9
10
|
export const usage = () => commandUsage({
|
|
10
11
|
command: 'query',
|
|
11
12
|
usage: [
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LoadedConfig } from '../config/index.ts';
|
|
2
|
+
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The account/auth commands that can be scoped to a named registry
|
|
5
|
+
* alias via `vlt registry <alias> <command>`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const registrySubcommands: ["whoami", "logout", "login", "token", "access", "publish", "unpublish", "deprecate", "dist-tag", "profile", "ping"];
|
|
8
|
+
export declare const usage: CommandUsage;
|
|
9
|
+
export declare const views: {
|
|
10
|
+
readonly human: () => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Resolve `vlt registry <alias> <command>` in place: determine the
|
|
14
|
+
* target subcommand and registry, then rewrite `conf` so the outer
|
|
15
|
+
* runner dispatches the real command with the resolved registry
|
|
16
|
+
* injected. When invoked with `--help` or without a subcommand, `conf`
|
|
17
|
+
* is left untouched so the `registry` usage/error is shown instead.
|
|
18
|
+
*
|
|
19
|
+
* Streams / interactivity are injectable for tests.
|
|
20
|
+
*/
|
|
21
|
+
export declare const dispatchRegistry: (conf: LoadedConfig, { interactive, input, output, }?: {
|
|
22
|
+
interactive?: boolean;
|
|
23
|
+
input?: NodeJS.ReadableStream;
|
|
24
|
+
output?: NodeJS.WritableStream;
|
|
25
|
+
}) => Promise<void>;
|
|
26
|
+
export declare const command: CommandFn<void>;
|
|
@@ -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 ...]',
|