@vltpkg/cli-sdk 1.0.4 → 1.0.5
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/ci.d.ts +1 -0
- package/dist/commands/ci.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 +1 -0
- package/dist/commands/uninstall.d.ts +1 -0
- package/dist/commands/uninstall.js +1 -0
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.js +1 -0
- package/dist/load-command.d.ts +8 -0
- package/dist/output.js +5 -2
- package/dist/require-registry.d.ts +16 -0
- package/dist/require-registry.js +24 -1
- package/package.json +25 -25
package/dist/commands/ci.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { CommandFn, CommandUsage } from '../index.ts';
|
|
|
2
2
|
import type { InstallResult } from './install.ts';
|
|
3
3
|
export type CIResult = Omit<InstallResult, 'buildQueue'>;
|
|
4
4
|
export declare const needsRegistry = true;
|
|
5
|
+
export declare const needsNpmRegistry = 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 { install } from '@vltpkg/graph';
|
|
|
2
2
|
import { commandUsage } from "../config/usage.js";
|
|
3
3
|
import { lazyView } from "../view.js";
|
|
4
4
|
export const needsRegistry = true;
|
|
5
|
+
export const needsNpmRegistry = true;
|
|
5
6
|
export const usage = () => commandUsage({
|
|
6
7
|
command: 'ci',
|
|
7
8
|
usage: '',
|
package/dist/commands/exec.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ 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
5
|
export declare const needsRegistry = true;
|
|
6
|
+
export declare const needsNpmRegistry = true;
|
|
6
7
|
export declare const usage: CommandUsage;
|
|
7
8
|
export declare const prettyPath: (path: string) => string;
|
|
8
9
|
export declare const promptFn: PromptFn;
|
package/dist/commands/exec.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ExecCommand } from "../exec-command.js";
|
|
|
8
8
|
import { styleTextStdout } from "../output.js";
|
|
9
9
|
export { views } from "../exec-command.js";
|
|
10
10
|
export const needsRegistry = true;
|
|
11
|
+
export const needsNpmRegistry = true;
|
|
11
12
|
export const usage = () => commandUsage({
|
|
12
13
|
command: 'exec',
|
|
13
14
|
usage: '[--package=<pkg>] [--call=<cmd>] [command...]',
|
|
@@ -19,6 +19,7 @@ export type InstallResult = {
|
|
|
19
19
|
diff?: Diff;
|
|
20
20
|
};
|
|
21
21
|
export declare const needsRegistry = true;
|
|
22
|
+
export declare const needsNpmRegistry = true;
|
|
22
23
|
export declare const usage: CommandUsage;
|
|
23
24
|
export declare const views: {
|
|
24
25
|
readonly json: (i: InstallResult) => {
|
package/dist/commands/install.js
CHANGED
|
@@ -4,6 +4,7 @@ import { parseAddArgs } from "../parse-add-remove-args.js";
|
|
|
4
4
|
import { trackInstall } from "../telemetry.js";
|
|
5
5
|
import { lazyView } from "../view.js";
|
|
6
6
|
export const needsRegistry = true;
|
|
7
|
+
export const needsNpmRegistry = true;
|
|
7
8
|
export const usage = () => commandUsage({
|
|
8
9
|
command: 'install',
|
|
9
10
|
usage: '[packages ...]',
|
|
@@ -7,6 +7,7 @@ export type UninstallResult = {
|
|
|
7
7
|
graph: Graph;
|
|
8
8
|
};
|
|
9
9
|
export declare const needsRegistry = true;
|
|
10
|
+
export declare const needsNpmRegistry = true;
|
|
10
11
|
export declare const usage: CommandUsage;
|
|
11
12
|
export declare const views: {
|
|
12
13
|
readonly json: (i: UninstallResult) => import("@vltpkg/graph").LockfileData;
|
|
@@ -3,6 +3,7 @@ import { commandUsage } from "../config/usage.js";
|
|
|
3
3
|
import { parseRemoveArgs } from "../parse-add-remove-args.js";
|
|
4
4
|
import { lazyView } from "../view.js";
|
|
5
5
|
export const needsRegistry = true;
|
|
6
|
+
export const needsNpmRegistry = true;
|
|
6
7
|
export const usage = () => commandUsage({
|
|
7
8
|
command: 'uninstall',
|
|
8
9
|
usage: '[package ...]',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
2
2
|
import type { InstallResult } from './install.ts';
|
|
3
3
|
export declare const needsRegistry = true;
|
|
4
|
+
export declare const needsNpmRegistry = 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
|
@@ -3,6 +3,7 @@ import { error } from '@vltpkg/error-cause';
|
|
|
3
3
|
import { commandUsage } from "../config/usage.js";
|
|
4
4
|
import { lazyView } from "../view.js";
|
|
5
5
|
export const needsRegistry = true;
|
|
6
|
+
export const needsNpmRegistry = true;
|
|
6
7
|
export const usage = () => commandUsage({
|
|
7
8
|
command: 'update',
|
|
8
9
|
usage: '',
|
package/dist/load-command.d.ts
CHANGED
|
@@ -17,5 +17,13 @@ export type Command<T> = {
|
|
|
17
17
|
* early with an `ECONFIG` error when one of these runs unconfigured.
|
|
18
18
|
*/
|
|
19
19
|
needsRegistry?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Set to `true` by commands that install packages (`install`,
|
|
22
|
+
* `update`, `uninstall`, `ci`, `exec`/`vlx`). `outputCommand()`
|
|
23
|
+
* fails early with an `ECONFIG` error when the alias bare specs
|
|
24
|
+
* resolve through (`registries.npm`, or the alias named by
|
|
25
|
+
* `default-registry-alias`) is not configured.
|
|
26
|
+
*/
|
|
27
|
+
needsNpmRegistry?: boolean;
|
|
20
28
|
};
|
|
21
29
|
export declare const loadCommand: <T>(command: Commands[keyof Commands] | undefined) => Promise<Command<T>>;
|
package/dist/output.js
CHANGED
|
@@ -2,7 +2,7 @@ import { formatWithOptions, styleText as utilStyleText, } from 'node:util';
|
|
|
2
2
|
import { createSupportsColor } from 'supports-color';
|
|
3
3
|
import { defaultView } from "./config/definition.js";
|
|
4
4
|
import { printErr, formatOptions } from "./print-err.js";
|
|
5
|
-
import { hasConfiguredRegistry, missingRegistryError, } from "./require-registry.js";
|
|
5
|
+
import { hasConfiguredRegistry, hasNpmRegistry, missingNpmRegistryError, missingRegistryError, } from "./require-registry.js";
|
|
6
6
|
import { isLazyView, isViewClass, loadLazyView } from "./view.js";
|
|
7
7
|
import { generateDefaultHelp, generateFullHelp, } from "./custom-help.js";
|
|
8
8
|
import { flush as flushTelemetry, trackCommand, trackError, } from "./telemetry.js";
|
|
@@ -103,7 +103,7 @@ const startView = async (conf, opts, views, { start } = { start: Date.now() }) =
|
|
|
103
103
|
export const outputCommand = async (cliCommand, conf, { start, vltVersion } = {
|
|
104
104
|
start: Date.now(),
|
|
105
105
|
}) => {
|
|
106
|
-
const { usage, views, command, needsRegistry } = cliCommand;
|
|
106
|
+
const { usage, views, command, needsRegistry, needsNpmRegistry } = cliCommand;
|
|
107
107
|
const stdoutColor = conf.values.color ?? supportsColor(process.stdout);
|
|
108
108
|
const stderrColor = conf.values.color ?? supportsColor(process.stderr);
|
|
109
109
|
if (conf.values.help) {
|
|
@@ -140,6 +140,9 @@ export const outputCommand = async (cliCommand, conf, { start, vltVersion } = {
|
|
|
140
140
|
if (needsRegistry && !hasConfiguredRegistry(conf)) {
|
|
141
141
|
throw missingRegistryError();
|
|
142
142
|
}
|
|
143
|
+
if (needsNpmRegistry && !hasNpmRegistry(conf)) {
|
|
144
|
+
throw missingNpmRegistryError(conf.options['default-registry-alias']);
|
|
145
|
+
}
|
|
143
146
|
const output = await onDone(await command(conf));
|
|
144
147
|
stopRequestLog();
|
|
145
148
|
const duration_ms = Date.now() - start;
|
|
@@ -5,6 +5,13 @@ import type { LoadedConfig } from './config/index.ts';
|
|
|
5
5
|
* everywhere a registry is required but missing.
|
|
6
6
|
*/
|
|
7
7
|
export declare const missingRegistryError: () => Error;
|
|
8
|
+
/**
|
|
9
|
+
* Install-related commands need the alias that bare specs resolve
|
|
10
|
+
* through (not merely some other configured registry) so packages and
|
|
11
|
+
* transitive deps get stable, alias-keyed DepIDs. That alias is
|
|
12
|
+
* `registries.npm` unless `default-registry-alias` points elsewhere.
|
|
13
|
+
*/
|
|
14
|
+
export declare const missingNpmRegistryError: (alias?: string) => Error;
|
|
8
15
|
/**
|
|
9
16
|
* Multiple registries are configured and none was selected. Used in
|
|
10
17
|
* non-interactive contexts where we cannot prompt and there is no
|
|
@@ -25,6 +32,15 @@ export declare const resolveRegistryAlias: (conf: LoadedConfig, alias: string) =
|
|
|
25
32
|
* the resolver would otherwise accept or prompt for.
|
|
26
33
|
*/
|
|
27
34
|
export declare const hasConfiguredRegistry: (conf: LoadedConfig) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the alias bare specs resolve through is configured:
|
|
37
|
+
* `registries.npm` by default, or whatever `default-registry-alias`
|
|
38
|
+
* points at. A scalar `--registry` or some unrelated alias is not
|
|
39
|
+
* enough: install-related commands need the default alias itself.
|
|
40
|
+
* Kept next to {@link hasConfiguredRegistry} so both pre-command
|
|
41
|
+
* gates share the same config surface.
|
|
42
|
+
*/
|
|
43
|
+
export declare const hasNpmRegistry: (conf: LoadedConfig) => boolean;
|
|
28
44
|
/**
|
|
29
45
|
* Synchronous, non-interactive registry resolution used by
|
|
30
46
|
* programmatic callers. Precedence: explicit alias > `--registry`
|
package/dist/require-registry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { error } from '@vltpkg/error-cause';
|
|
2
|
-
import { defaultRegistries } from '@vltpkg/spec';
|
|
2
|
+
import { defaultRegistries, defaultRegistryName } from '@vltpkg/spec';
|
|
3
3
|
import { selectRegistry } from "./select-registry.js";
|
|
4
4
|
/**
|
|
5
5
|
* There is no default registry. This is the single message used
|
|
@@ -12,6 +12,20 @@ export const missingRegistryError = () => error([
|
|
|
12
12
|
'',
|
|
13
13
|
'See https://docs.vlt.sh/cli for other ways to set a registry.',
|
|
14
14
|
].join('\n'), { code: 'ECONFIG' });
|
|
15
|
+
/**
|
|
16
|
+
* Install-related commands need the alias that bare specs resolve
|
|
17
|
+
* through (not merely some other configured registry) so packages and
|
|
18
|
+
* transitive deps get stable, alias-keyed DepIDs. That alias is
|
|
19
|
+
* `registries.npm` unless `default-registry-alias` points elsewhere.
|
|
20
|
+
*/
|
|
21
|
+
export const missingNpmRegistryError = (alias = defaultRegistryName) => error([
|
|
22
|
+
`Missing ${alias} registry configuration.`,
|
|
23
|
+
'',
|
|
24
|
+
`Install commands require the \`registries.${alias}\` alias.`,
|
|
25
|
+
'Run `vlt setup` to get configured.',
|
|
26
|
+
'',
|
|
27
|
+
'See https://docs.vlt.sh/cli for other ways to set a registry.',
|
|
28
|
+
].join('\n'), { code: 'ECONFIG' });
|
|
15
29
|
/**
|
|
16
30
|
* Multiple registries are configured and none was selected. Used in
|
|
17
31
|
* non-interactive contexts where we cannot prompt and there is no
|
|
@@ -68,6 +82,15 @@ const gatherCandidates = (conf) => {
|
|
|
68
82
|
* the resolver would otherwise accept or prompt for.
|
|
69
83
|
*/
|
|
70
84
|
export const hasConfiguredRegistry = (conf) => !!conf.options.registry || gatherCandidates(conf).length > 0;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the alias bare specs resolve through is configured:
|
|
87
|
+
* `registries.npm` by default, or whatever `default-registry-alias`
|
|
88
|
+
* points at. A scalar `--registry` or some unrelated alias is not
|
|
89
|
+
* enough: install-related commands need the default alias itself.
|
|
90
|
+
* Kept next to {@link hasConfiguredRegistry} so both pre-command
|
|
91
|
+
* gates share the same config surface.
|
|
92
|
+
*/
|
|
93
|
+
export const hasNpmRegistry = (conf) => !!conf.options.registries[conf.options['default-registry-alias']];
|
|
71
94
|
/**
|
|
72
95
|
* Synchronous, non-interactive registry resolution used by
|
|
73
96
|
* programmatic callers. Precedence: explicit alias > `--registry`
|
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.
|
|
4
|
+
"version": "1.0.5",
|
|
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.
|
|
18
|
-
"@vltpkg/dep-id": "1.0.
|
|
19
|
-
"@vltpkg/dot-prop": "1.0.
|
|
20
|
-
"@vltpkg/error-cause": "1.0.
|
|
21
|
-
"@vltpkg/git": "1.0.
|
|
22
|
-
"@vltpkg/graph": "1.0.
|
|
23
|
-
"@vltpkg/graph-run": "1.0.
|
|
24
|
-
"@vltpkg/init": "1.0.
|
|
25
|
-
"@vltpkg/output": "1.0.
|
|
26
|
-
"@vltpkg/package-info": "1.0.
|
|
27
|
-
"@vltpkg/package-json": "1.0.
|
|
28
|
-
"@vltpkg/promise-spawn": "1.0.
|
|
29
|
-
"@vltpkg/query": "1.0.
|
|
30
|
-
"@vltpkg/registry-client": "1.0.
|
|
31
|
-
"@vltpkg/rollback-remove": "1.0.
|
|
32
|
-
"@vltpkg/run": "1.0.
|
|
33
|
-
"@vltpkg/security-archive": "1.0.
|
|
34
|
-
"@vltpkg/spec": "1.0.
|
|
35
|
-
"@vltpkg/types": "1.0.
|
|
36
|
-
"@vltpkg/url-open": "1.0.
|
|
37
|
-
"@vltpkg/vlt-json": "1.0.
|
|
38
|
-
"@vltpkg/vlx": "1.0.
|
|
39
|
-
"@vltpkg/workspaces": "1.0.
|
|
40
|
-
"@vltpkg/xdg": "1.0.
|
|
17
|
+
"@vltpkg/config": "1.0.5",
|
|
18
|
+
"@vltpkg/dep-id": "1.0.5",
|
|
19
|
+
"@vltpkg/dot-prop": "1.0.5",
|
|
20
|
+
"@vltpkg/error-cause": "1.0.5",
|
|
21
|
+
"@vltpkg/git": "1.0.5",
|
|
22
|
+
"@vltpkg/graph": "1.0.5",
|
|
23
|
+
"@vltpkg/graph-run": "1.0.5",
|
|
24
|
+
"@vltpkg/init": "1.0.5",
|
|
25
|
+
"@vltpkg/output": "1.0.5",
|
|
26
|
+
"@vltpkg/package-info": "1.0.5",
|
|
27
|
+
"@vltpkg/package-json": "1.0.5",
|
|
28
|
+
"@vltpkg/promise-spawn": "1.0.5",
|
|
29
|
+
"@vltpkg/query": "1.0.5",
|
|
30
|
+
"@vltpkg/registry-client": "1.0.5",
|
|
31
|
+
"@vltpkg/rollback-remove": "1.0.5",
|
|
32
|
+
"@vltpkg/run": "1.0.5",
|
|
33
|
+
"@vltpkg/security-archive": "1.0.5",
|
|
34
|
+
"@vltpkg/spec": "1.0.5",
|
|
35
|
+
"@vltpkg/types": "1.0.5",
|
|
36
|
+
"@vltpkg/url-open": "1.0.5",
|
|
37
|
+
"@vltpkg/vlt-json": "1.0.5",
|
|
38
|
+
"@vltpkg/vlx": "1.0.5",
|
|
39
|
+
"@vltpkg/workspaces": "1.0.5",
|
|
40
|
+
"@vltpkg/xdg": "1.0.5",
|
|
41
41
|
"ansi-to-pre": "^1.0.6",
|
|
42
42
|
"beautiful-mermaid": "^1.1.3",
|
|
43
43
|
"chalk": "^5.6.2",
|