@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
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,9 @@ 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
|
+
import { registryErrorMessage } from "../registry-error-message.js";
|
|
16
|
+
export const needsRegistry = true;
|
|
14
17
|
export const usage = () => commandUsage({
|
|
15
18
|
command: 'publish',
|
|
16
19
|
usage: '',
|
|
@@ -164,7 +167,7 @@ const commandSingle = async (location, conf) => {
|
|
|
164
167
|
const publishConfig = getPublishConfig(manifest);
|
|
165
168
|
const tag = publishConfig?.tag ?? conf.options.tag;
|
|
166
169
|
const access = publishConfig?.access ?? conf.options.access;
|
|
167
|
-
const registry = publishConfig?.registry ?? conf
|
|
170
|
+
const registry = publishConfig?.registry ?? (await resolveRegistry(conf));
|
|
168
171
|
const registryUrl = new URL(registryBase(registry));
|
|
169
172
|
const runOptions = {
|
|
170
173
|
cwd: manifestDir,
|
|
@@ -262,15 +265,15 @@ const commandSingle = async (location, conf) => {
|
|
|
262
265
|
});
|
|
263
266
|
}
|
|
264
267
|
if (response.statusCode !== 200 && response.statusCode !== 201) {
|
|
265
|
-
let
|
|
268
|
+
let advice = '';
|
|
266
269
|
if (response.statusCode === 409) {
|
|
267
|
-
|
|
270
|
+
advice = `\n⚠️ ${name}@${version} already exists in the registry. Bump the version and try again.`;
|
|
268
271
|
}
|
|
269
272
|
else if (response.statusCode === 404) {
|
|
270
|
-
|
|
271
|
-
"
|
|
273
|
+
advice =
|
|
274
|
+
"\n⚠️ Make sure you're logged in and have access to publish the package.";
|
|
272
275
|
}
|
|
273
|
-
throw error(`Failed to publish package${
|
|
276
|
+
throw error(`Failed to publish package: ${registryErrorMessage(response)}${advice}`, {
|
|
274
277
|
url: publishUrl,
|
|
275
278
|
response,
|
|
276
279
|
});
|
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
|
@@ -1,11 +1,13 @@
|
|
|
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";
|
|
7
8
|
import { createHostContextsMap } from "../query-host-contexts.js";
|
|
8
9
|
import { MermaidImageView } from "../mermaid-image-view.js";
|
|
10
|
+
export const needsRegistry = true;
|
|
9
11
|
export const usage = () => commandUsage({
|
|
10
12
|
command: 'query',
|
|
11
13
|
usage: [
|
|
@@ -153,6 +155,18 @@ export const command = async (conf) => {
|
|
|
153
155
|
signal: new AbortController().signal,
|
|
154
156
|
});
|
|
155
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
|
+
}
|
|
156
170
|
}
|
|
157
171
|
if (scopeQueryString && scopeNodes) {
|
|
158
172
|
// Add all scope nodes to importers Set (treat them as top-level items)
|
|
@@ -172,6 +186,18 @@ export const command = async (conf) => {
|
|
|
172
186
|
}
|
|
173
187
|
}
|
|
174
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
|
+
}
|
|
175
201
|
}
|
|
176
202
|
// retrieve the selected nodes and edges
|
|
177
203
|
const edges_ = graph?.edges ?? new Set();
|
|
@@ -201,6 +227,21 @@ export const command = async (conf) => {
|
|
|
201
227
|
wanted: conf.values['expect-results'],
|
|
202
228
|
});
|
|
203
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
|
+
}
|
|
204
245
|
return {
|
|
205
246
|
importers: importers.size === 0 ?
|
|
206
247
|
new Set(queryResultImporters)
|
|
@@ -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>;
|