@vltpkg/cli-sdk 1.0.0-rc.9 → 1.0.2
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 +23 -0
- package/dist/commands/access.js +251 -0
- package/dist/{esm/commands → commands}/bugs.d.ts +0 -1
- package/dist/{esm/commands → commands}/bugs.js +0 -1
- package/dist/{esm/commands → commands}/build.d.ts +1 -1
- package/dist/{esm/commands → commands}/build.js +1 -1
- package/dist/{esm/commands → commands}/cache.d.ts +1 -1
- package/dist/{esm/commands → commands}/cache.js +1 -1
- package/dist/{esm/commands → commands}/ci.d.ts +1 -1
- package/dist/{esm/commands → commands}/ci.js +12 -3
- package/dist/{esm/commands → commands}/config.d.ts +0 -1
- package/dist/{esm/commands → commands}/config.js +6 -1
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.js +103 -0
- package/dist/commands/deprecate.d.ts +14 -0
- package/dist/commands/deprecate.js +142 -0
- package/dist/commands/dist-tag.d.ts +22 -0
- package/dist/commands/dist-tag.js +179 -0
- package/dist/{esm/commands → commands}/docs.d.ts +0 -1
- package/dist/{esm/commands → commands}/docs.js +0 -1
- package/dist/{esm/commands → commands}/exec-cache.d.ts +1 -1
- package/dist/{esm/commands → commands}/exec-cache.js +1 -1
- package/dist/{esm/commands/run-exec.d.ts → commands/exec-local.d.ts} +0 -1
- package/dist/{esm/commands → commands}/exec-local.js +23 -1
- package/dist/{esm/commands → commands}/exec.d.ts +1 -1
- package/dist/{esm/commands → commands}/exec.js +85 -10
- package/dist/{esm/commands → commands}/help.d.ts +0 -1
- package/dist/{esm/commands → commands}/help.js +5 -1
- package/dist/{esm/commands → commands}/init.d.ts +0 -1
- package/dist/{esm/commands → commands}/init.js +31 -10
- package/dist/{esm/commands → commands}/install/reporter.d.ts +0 -1
- package/dist/{esm/commands → commands}/install/reporter.js +0 -1
- package/dist/{esm/commands → commands}/install.d.ts +22 -3
- package/dist/commands/install.js +152 -0
- package/dist/{esm/commands → commands}/list.d.ts +5 -2
- package/dist/{esm/commands → commands}/list.js +9 -10
- package/dist/{esm/commands → commands}/login.d.ts +0 -1
- package/dist/commands/login.js +35 -0
- package/dist/{esm/commands → commands}/logout.d.ts +1 -1
- package/dist/commands/logout.js +27 -0
- package/dist/{esm/commands → commands}/pack.d.ts +1 -1
- package/dist/{esm/commands → commands}/pack.js +91 -32
- package/dist/commands/ping.d.ts +18 -0
- package/dist/commands/ping.js +117 -0
- package/dist/{esm/commands → commands}/pkg.d.ts +0 -1
- package/dist/{esm/commands → commands}/pkg.js +27 -1
- package/dist/commands/profile.d.ts +14 -0
- package/dist/commands/profile.js +106 -0
- package/dist/{esm/commands → commands}/publish.d.ts +2 -2
- package/dist/{esm/commands → commands}/publish.js +70 -16
- package/dist/{esm/commands → commands}/query.d.ts +5 -2
- package/dist/{esm/commands → commands}/query.js +54 -11
- package/dist/commands/registry.d.ts +26 -0
- package/dist/commands/registry.js +99 -0
- package/dist/commands/repo.d.ts +17 -0
- package/dist/commands/repo.js +157 -0
- package/dist/{esm/commands/exec-local.d.ts → commands/run-exec.d.ts} +1 -1
- package/dist/commands/run-exec.js +41 -0
- package/dist/{esm/commands → commands}/run.d.ts +0 -1
- package/dist/{esm/commands → commands}/run.js +27 -1
- package/dist/commands/setup.d.ts +25 -0
- package/dist/commands/setup.js +155 -0
- package/dist/commands/token.d.ts +32 -0
- package/dist/commands/token.js +193 -0
- package/dist/{esm/commands → commands}/uninstall.d.ts +1 -1
- package/dist/{esm/commands → commands}/uninstall.js +15 -1
- package/dist/commands/unpublish.d.ts +16 -0
- package/dist/commands/unpublish.js +203 -0
- package/dist/{esm/commands → commands}/update.d.ts +1 -1
- package/dist/{esm/commands → commands}/update.js +7 -1
- package/dist/{esm/commands → commands}/version.d.ts +0 -1
- package/dist/{esm/commands → commands}/version.js +27 -1
- package/dist/commands/view.d.ts +23 -0
- package/dist/commands/view.js +335 -0
- package/dist/{esm/commands → commands}/whoami.d.ts +1 -1
- package/dist/commands/whoami.js +33 -0
- package/dist/{esm/config → config}/definition.d.ts +72 -19
- package/dist/{esm/config → config}/definition.js +157 -50
- package/dist/{esm/config → config}/index.d.ts +0 -1
- package/dist/{esm/config → config}/index.js +43 -2
- package/dist/{esm/config → config}/merge.d.ts +0 -1
- package/dist/{esm/config → config}/merge.js +0 -1
- package/dist/{esm/config → config}/usage.d.ts +0 -1
- package/dist/{esm/config → config}/usage.js +0 -1
- package/dist/{esm/custom-help.d.ts → custom-help.d.ts} +0 -1
- package/dist/{esm/custom-help.js → custom-help.js} +95 -120
- package/dist/{esm/exec-command.d.ts → exec-command.d.ts} +0 -1
- package/dist/{esm/exec-command.js → exec-command.js} +14 -8
- package/dist/{esm/index.d.ts → index.d.ts} +0 -1
- package/dist/{esm/index.js → index.js} +5 -2
- package/dist/{esm/load-command.d.ts → load-command.d.ts} +6 -1
- package/dist/{esm/load-command.js → load-command.js} +0 -1
- package/dist/mermaid-image-view.d.ts +18 -0
- package/dist/mermaid-image-view.js +36 -0
- package/dist/{esm/output.d.ts → output.d.ts} +2 -2
- package/dist/{esm/output.js → output.js} +70 -3
- package/dist/{esm/pack-tarball.d.ts → pack-tarball.d.ts} +15 -1
- package/dist/{esm/pack-tarball.js → pack-tarball.js} +133 -91
- package/dist/{esm/parse-add-remove-args.d.ts → parse-add-remove-args.d.ts} +0 -1
- package/dist/{esm/parse-add-remove-args.js → parse-add-remove-args.js} +65 -12
- package/dist/{esm/print-err.d.ts → print-err.d.ts} +0 -1
- package/dist/{esm/print-err.js → print-err.js} +28 -4
- package/dist/query-diff-files.d.ts +17 -0
- package/dist/query-diff-files.js +63 -0
- package/dist/{esm/query-host-contexts.d.ts → query-host-contexts.d.ts} +0 -1
- package/dist/{esm/query-host-contexts.js → query-host-contexts.js} +8 -7
- package/dist/{esm/read-password.d.ts → read-password.d.ts} +0 -1
- package/dist/{esm/read-password.js → read-password.js} +0 -1
- package/dist/read-project-folders.d.ts +17 -0
- package/dist/read-project-folders.js +100 -0
- package/dist/registry-error-message.d.ts +2 -0
- package/dist/registry-error-message.js +29 -0
- package/dist/reload-config.d.ts +2 -0
- package/dist/reload-config.js +11 -0
- package/dist/render-mermaid.d.ts +22 -0
- package/dist/render-mermaid.js +68 -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/telemetry.d.ts +58 -0
- package/dist/telemetry.js +170 -0
- package/dist/verbose-log.d.ts +31 -0
- package/dist/verbose-log.js +62 -0
- package/dist/{esm/view.d.ts → view.d.ts} +0 -1
- package/dist/{esm/view.js → view.js} +1 -2
- package/package.json +75 -82
- package/dist/esm/commands/bugs.d.ts.map +0 -1
- package/dist/esm/commands/bugs.js.map +0 -1
- package/dist/esm/commands/build.d.ts.map +0 -1
- package/dist/esm/commands/build.js.map +0 -1
- package/dist/esm/commands/cache.d.ts.map +0 -1
- package/dist/esm/commands/cache.js.map +0 -1
- package/dist/esm/commands/ci.d.ts.map +0 -1
- package/dist/esm/commands/ci.js.map +0 -1
- package/dist/esm/commands/config.d.ts.map +0 -1
- package/dist/esm/commands/config.js.map +0 -1
- package/dist/esm/commands/docs.d.ts.map +0 -1
- package/dist/esm/commands/docs.js.map +0 -1
- package/dist/esm/commands/exec-cache.d.ts.map +0 -1
- package/dist/esm/commands/exec-cache.js.map +0 -1
- package/dist/esm/commands/exec-local.d.ts.map +0 -1
- package/dist/esm/commands/exec-local.js.map +0 -1
- package/dist/esm/commands/exec.d.ts.map +0 -1
- package/dist/esm/commands/exec.js.map +0 -1
- package/dist/esm/commands/help.d.ts.map +0 -1
- package/dist/esm/commands/help.js.map +0 -1
- package/dist/esm/commands/init.d.ts.map +0 -1
- package/dist/esm/commands/init.js.map +0 -1
- package/dist/esm/commands/install/reporter.d.ts.map +0 -1
- package/dist/esm/commands/install/reporter.js.map +0 -1
- package/dist/esm/commands/install.d.ts.map +0 -1
- package/dist/esm/commands/install.js +0 -46
- package/dist/esm/commands/install.js.map +0 -1
- package/dist/esm/commands/list.d.ts.map +0 -1
- package/dist/esm/commands/list.js.map +0 -1
- package/dist/esm/commands/login.d.ts.map +0 -1
- package/dist/esm/commands/login.js +0 -13
- package/dist/esm/commands/login.js.map +0 -1
- package/dist/esm/commands/logout.d.ts.map +0 -1
- package/dist/esm/commands/logout.js +0 -13
- package/dist/esm/commands/logout.js.map +0 -1
- package/dist/esm/commands/pack.d.ts.map +0 -1
- package/dist/esm/commands/pack.js.map +0 -1
- package/dist/esm/commands/pkg.d.ts.map +0 -1
- package/dist/esm/commands/pkg.js.map +0 -1
- package/dist/esm/commands/publish.d.ts.map +0 -1
- package/dist/esm/commands/publish.js.map +0 -1
- package/dist/esm/commands/query.d.ts.map +0 -1
- package/dist/esm/commands/query.js.map +0 -1
- package/dist/esm/commands/run-exec.d.ts.map +0 -1
- package/dist/esm/commands/run-exec.js +0 -14
- package/dist/esm/commands/run-exec.js.map +0 -1
- package/dist/esm/commands/run.d.ts.map +0 -1
- package/dist/esm/commands/run.js.map +0 -1
- package/dist/esm/commands/serve.d.ts +0 -14
- package/dist/esm/commands/serve.d.ts.map +0 -1
- package/dist/esm/commands/serve.js +0 -103
- package/dist/esm/commands/serve.js.map +0 -1
- package/dist/esm/commands/token.d.ts +0 -4
- package/dist/esm/commands/token.d.ts.map +0 -1
- package/dist/esm/commands/token.js +0 -30
- package/dist/esm/commands/token.js.map +0 -1
- package/dist/esm/commands/uninstall.d.ts.map +0 -1
- package/dist/esm/commands/uninstall.js.map +0 -1
- package/dist/esm/commands/update.d.ts.map +0 -1
- package/dist/esm/commands/update.js.map +0 -1
- package/dist/esm/commands/version.d.ts.map +0 -1
- package/dist/esm/commands/version.js.map +0 -1
- package/dist/esm/commands/whoami.d.ts.map +0 -1
- package/dist/esm/commands/whoami.js +0 -19
- package/dist/esm/commands/whoami.js.map +0 -1
- package/dist/esm/config/definition.d.ts.map +0 -1
- package/dist/esm/config/definition.js.map +0 -1
- package/dist/esm/config/index.d.ts.map +0 -1
- package/dist/esm/config/index.js.map +0 -1
- package/dist/esm/config/merge.d.ts.map +0 -1
- package/dist/esm/config/merge.js.map +0 -1
- package/dist/esm/config/usage.d.ts.map +0 -1
- package/dist/esm/config/usage.js.map +0 -1
- package/dist/esm/custom-help.d.ts.map +0 -1
- package/dist/esm/custom-help.js.map +0 -1
- package/dist/esm/exec-command.d.ts.map +0 -1
- package/dist/esm/exec-command.js.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/load-command.d.ts.map +0 -1
- package/dist/esm/load-command.js.map +0 -1
- package/dist/esm/output.d.ts.map +0 -1
- package/dist/esm/output.js.map +0 -1
- package/dist/esm/pack-tarball.d.ts.map +0 -1
- package/dist/esm/pack-tarball.js.map +0 -1
- package/dist/esm/package.json +0 -3
- package/dist/esm/parse-add-remove-args.d.ts.map +0 -1
- package/dist/esm/parse-add-remove-args.js.map +0 -1
- package/dist/esm/print-err.d.ts.map +0 -1
- package/dist/esm/print-err.js.map +0 -1
- package/dist/esm/query-host-contexts.d.ts.map +0 -1
- package/dist/esm/query-host-contexts.js.map +0 -1
- package/dist/esm/read-password.d.ts.map +0 -1
- package/dist/esm/read-password.js.map +0 -1
- package/dist/esm/start-gui.d.ts +0 -10
- package/dist/esm/start-gui.d.ts.map +0 -1
- package/dist/esm/start-gui.js +0 -60
- package/dist/esm/start-gui.js.map +0 -1
- package/dist/esm/view.d.ts.map +0 -1
- package/dist/esm/view.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InstallReporter } from './install/reporter.ts';
|
|
2
2
|
import type { DepID } from '@vltpkg/dep-id';
|
|
3
|
-
import type { Graph } from '@vltpkg/graph';
|
|
3
|
+
import type { Diff, Graph } from '@vltpkg/graph';
|
|
4
4
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
5
5
|
/**
|
|
6
6
|
* The resulting object of an install operation. To be used by the view impl.
|
|
@@ -14,15 +14,34 @@ export type InstallResult = {
|
|
|
14
14
|
* The resulting graph structure at the end of an install.
|
|
15
15
|
*/
|
|
16
16
|
graph: Graph;
|
|
17
|
+
/**
|
|
18
|
+
* The diff between the actual and ideal graphs, if available.
|
|
19
|
+
*/
|
|
20
|
+
diff?: Diff;
|
|
17
21
|
};
|
|
22
|
+
export declare const needsRegistry = true;
|
|
18
23
|
export declare const usage: CommandUsage;
|
|
19
24
|
export declare const views: {
|
|
20
25
|
readonly json: (i: InstallResult) => {
|
|
21
|
-
graph: import("@vltpkg/graph").LockfileData;
|
|
22
26
|
buildQueue?: DepID[] | undefined;
|
|
23
27
|
message?: string | undefined;
|
|
28
|
+
add: {
|
|
29
|
+
name: string;
|
|
30
|
+
version?: string;
|
|
31
|
+
}[];
|
|
32
|
+
added: number;
|
|
33
|
+
change: {
|
|
34
|
+
name: string;
|
|
35
|
+
from?: string;
|
|
36
|
+
to?: string;
|
|
37
|
+
}[];
|
|
38
|
+
changed: number;
|
|
39
|
+
remove: {
|
|
40
|
+
name: string;
|
|
41
|
+
version?: string;
|
|
42
|
+
}[];
|
|
43
|
+
removed: number;
|
|
24
44
|
};
|
|
25
45
|
readonly human: typeof InstallReporter;
|
|
26
46
|
};
|
|
27
47
|
export declare const command: CommandFn<InstallResult>;
|
|
28
|
-
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { commandUsage } from "../config/usage.js";
|
|
2
|
+
import { install } from '@vltpkg/graph';
|
|
3
|
+
import { parseAddArgs } from "../parse-add-remove-args.js";
|
|
4
|
+
import { InstallReporter } from "./install/reporter.js";
|
|
5
|
+
import { trackInstall } from "../telemetry.js";
|
|
6
|
+
export const needsRegistry = true;
|
|
7
|
+
export const usage = () => commandUsage({
|
|
8
|
+
command: 'install',
|
|
9
|
+
usage: '[packages ...]',
|
|
10
|
+
description: `Install the specified packages, updating package.json and
|
|
11
|
+
vlt-lock.json appropriately.`,
|
|
12
|
+
options: {
|
|
13
|
+
'save-dev': {
|
|
14
|
+
description: 'Save installed packages to package.json as devDependencies.',
|
|
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
|
+
},
|
|
23
|
+
'save-optional': {
|
|
24
|
+
description: 'Save installed packages to package.json as optionalDependencies.',
|
|
25
|
+
},
|
|
26
|
+
'save-peer': {
|
|
27
|
+
description: 'Save installed packages to package.json as peerDependencies.',
|
|
28
|
+
},
|
|
29
|
+
'save-prod': {
|
|
30
|
+
description: 'Save installed packages to package.json as dependencies.',
|
|
31
|
+
},
|
|
32
|
+
workspace: {
|
|
33
|
+
value: '<path|glob>',
|
|
34
|
+
description: 'Limit installation targets to matching workspaces.',
|
|
35
|
+
},
|
|
36
|
+
'workspace-group': {
|
|
37
|
+
value: '<name>',
|
|
38
|
+
description: 'Limit installation targets to workspace groups.',
|
|
39
|
+
},
|
|
40
|
+
'expect-lockfile': {
|
|
41
|
+
description: 'Fail if lockfile is missing or out of date.',
|
|
42
|
+
},
|
|
43
|
+
'frozen-lockfile': {
|
|
44
|
+
description: 'Fail if lockfile is missing or out of sync with package.json.',
|
|
45
|
+
},
|
|
46
|
+
'lockfile-only': {
|
|
47
|
+
description: 'Only update lockfile and package.json files; skip node_modules operations.',
|
|
48
|
+
},
|
|
49
|
+
'allow-scripts': {
|
|
50
|
+
value: '<query>',
|
|
51
|
+
description: 'Filter which packages are allowed to run lifecycle scripts using DSS query syntax.',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
export const views = {
|
|
56
|
+
json: i => {
|
|
57
|
+
const added = i.diff?.nodes.add ?? new Set();
|
|
58
|
+
const deleted = i.diff?.nodes.delete ?? new Set();
|
|
59
|
+
// The actual (from) graph represents what was on disk before the install.
|
|
60
|
+
// Used to filter out optional deps that were never installed (e.g.
|
|
61
|
+
// platform-specific binaries). These end up in the delete set via
|
|
62
|
+
// optionalFail but should not be reported as removals.
|
|
63
|
+
const actual = i.diff?.from;
|
|
64
|
+
// Build a map of deleted nodes by name for detecting changes
|
|
65
|
+
const deletedByName = new Map();
|
|
66
|
+
for (const node of deleted) {
|
|
67
|
+
if (node.importer)
|
|
68
|
+
continue;
|
|
69
|
+
// Skip nodes that were never on disk — these are optional deps
|
|
70
|
+
// that failed during install (e.g. wrong platform) and were moved
|
|
71
|
+
// to the delete set by optionalFail.
|
|
72
|
+
if (actual && !actual.nodes.has(node.id))
|
|
73
|
+
continue;
|
|
74
|
+
deletedByName.set(node.name, {
|
|
75
|
+
name: node.name,
|
|
76
|
+
version: node.version,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const add = [];
|
|
80
|
+
const change = [];
|
|
81
|
+
for (const node of added) {
|
|
82
|
+
if (node.importer)
|
|
83
|
+
continue;
|
|
84
|
+
const prev = deletedByName.get(node.name);
|
|
85
|
+
if (prev) {
|
|
86
|
+
// Package exists in both add and delete = changed
|
|
87
|
+
change.push({
|
|
88
|
+
name: node.name,
|
|
89
|
+
from: prev.version,
|
|
90
|
+
to: node.version,
|
|
91
|
+
});
|
|
92
|
+
deletedByName.delete(node.name);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
add.push({ name: node.name, version: node.version });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Remaining deleted nodes that weren't matched = pure removals
|
|
99
|
+
const remove = [...deletedByName.values()];
|
|
100
|
+
return {
|
|
101
|
+
add,
|
|
102
|
+
added: add.length,
|
|
103
|
+
change,
|
|
104
|
+
changed: change.length,
|
|
105
|
+
remove,
|
|
106
|
+
removed: remove.length,
|
|
107
|
+
...(i.buildQueue?.length ?
|
|
108
|
+
{
|
|
109
|
+
buildQueue: i.buildQueue,
|
|
110
|
+
message: `${i.buildQueue.length} packages that will need to be built, run "vlt build" to complete the install.`,
|
|
111
|
+
}
|
|
112
|
+
: null),
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
human: InstallReporter,
|
|
116
|
+
};
|
|
117
|
+
export const command = async (conf) => {
|
|
118
|
+
// TODO: we should probably throw an error if the user
|
|
119
|
+
// tries to install using view=mermaid
|
|
120
|
+
const monorepo = conf.options.monorepo;
|
|
121
|
+
const scurry = conf.options.scurry;
|
|
122
|
+
const { add } = parseAddArgs(conf, scurry, monorepo);
|
|
123
|
+
const frozenLockfile = conf.options['frozen-lockfile'];
|
|
124
|
+
const expectLockfile = conf.options['expect-lockfile'];
|
|
125
|
+
const lockfileOnly = conf.options['lockfile-only'];
|
|
126
|
+
const saveExact = conf.values['save-exact'];
|
|
127
|
+
const savePrefix = conf.values['save-prefix'];
|
|
128
|
+
/* c8 ignore start */
|
|
129
|
+
const allowScripts = conf.get('allow-scripts') ?
|
|
130
|
+
String(conf.get('allow-scripts'))
|
|
131
|
+
: ':not(*)';
|
|
132
|
+
/* c8 ignore stop */
|
|
133
|
+
const installStart = Date.now();
|
|
134
|
+
const { buildQueue, graph, diff } = await install({
|
|
135
|
+
...conf.options,
|
|
136
|
+
frozenLockfile,
|
|
137
|
+
expectLockfile,
|
|
138
|
+
allowScripts,
|
|
139
|
+
lockfileOnly,
|
|
140
|
+
saveExact,
|
|
141
|
+
savePrefix,
|
|
142
|
+
}, add);
|
|
143
|
+
/* c8 ignore next 9 - telemetry is best-effort */
|
|
144
|
+
try {
|
|
145
|
+
trackInstall({
|
|
146
|
+
dependency_count: graph.nodes.size,
|
|
147
|
+
duration_ms: Date.now() - installStart,
|
|
148
|
+
}, conf.values.telemetry);
|
|
149
|
+
}
|
|
150
|
+
catch { }
|
|
151
|
+
return { buildQueue, graph, diff };
|
|
152
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { humanReadableOutput, jsonOutput, mermaidOutput } from '@vltpkg/graph';
|
|
2
2
|
import type { HumanReadableOutputGraph, JSONOutputGraph, MermaidOutputGraph } from '@vltpkg/graph';
|
|
3
|
+
import { MermaidImageView } from '../mermaid-image-view.ts';
|
|
3
4
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
5
|
+
export declare const needsRegistry = true;
|
|
4
6
|
export declare const usage: CommandUsage;
|
|
5
7
|
export type ListResult = JSONOutputGraph & MermaidOutputGraph & HumanReadableOutputGraph & {
|
|
6
8
|
queryString: string;
|
|
@@ -9,7 +11,8 @@ export declare const views: {
|
|
|
9
11
|
readonly json: typeof jsonOutput;
|
|
10
12
|
readonly mermaid: typeof mermaidOutput;
|
|
11
13
|
readonly human: typeof humanReadableOutput;
|
|
12
|
-
readonly
|
|
14
|
+
readonly count: (result: ListResult) => number;
|
|
15
|
+
readonly svg: typeof MermaidImageView;
|
|
16
|
+
readonly png: typeof MermaidImageView;
|
|
13
17
|
};
|
|
14
18
|
export declare const command: CommandFn<ListResult>;
|
|
15
|
-
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { actual, asNode, humanReadableOutput, jsonOutput, mermaidOutput, GraphModifier, } from '@vltpkg/graph';
|
|
2
|
-
import LZString from 'lz-string';
|
|
3
2
|
import { Query } from '@vltpkg/query';
|
|
4
3
|
import { SecurityArchive } from '@vltpkg/security-archive';
|
|
5
4
|
import { error } from '@vltpkg/error-cause';
|
|
6
5
|
import { commandUsage } from "../config/usage.js";
|
|
7
|
-
import { startGUI } from "../start-gui.js";
|
|
8
6
|
import { createHostContextsMap } from "../query-host-contexts.js";
|
|
7
|
+
import { MermaidImageView } from "../mermaid-image-view.js";
|
|
8
|
+
export const needsRegistry = true;
|
|
9
9
|
export const usage = () => commandUsage({
|
|
10
10
|
command: 'ls',
|
|
11
11
|
usage: [
|
|
12
12
|
'',
|
|
13
|
-
'[package-names...] [--view=human | json | mermaid |
|
|
14
|
-
'[--scope=<query>] [--target=<query>] [--view=human | json | mermaid |
|
|
13
|
+
'[package-names...] [--view=human | json | mermaid | svg | png | count]',
|
|
14
|
+
'[--scope=<query>] [--target=<query>] [--view=human | json | mermaid | svg | png | count]',
|
|
15
15
|
],
|
|
16
16
|
description: `List installed dependencies matching given package names or query selectors.
|
|
17
17
|
|
|
@@ -53,8 +53,8 @@ export const usage = () => commandUsage({
|
|
|
53
53
|
description: 'Query selector to filter packages using the DSS query language syntax.',
|
|
54
54
|
},
|
|
55
55
|
view: {
|
|
56
|
-
value: '[human | json | mermaid |
|
|
57
|
-
description: 'Output format. Defaults to human-readable or json if no tty.',
|
|
56
|
+
value: '[human | json | mermaid | svg | png | count]',
|
|
57
|
+
description: 'Output format. Defaults to human-readable or json if no tty. Use svg or png to render the dependency graph as an image and open it. Count outputs the number of dependency relationships in the result.',
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
});
|
|
@@ -62,9 +62,9 @@ export const views = {
|
|
|
62
62
|
json: jsonOutput,
|
|
63
63
|
mermaid: mermaidOutput,
|
|
64
64
|
human: humanReadableOutput,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
count: (result) => result.edges.length,
|
|
66
|
+
svg: MermaidImageView,
|
|
67
|
+
png: MermaidImageView,
|
|
68
68
|
};
|
|
69
69
|
export const command = async (conf) => {
|
|
70
70
|
const modifiers = GraphModifier.maybeLoad(conf.options);
|
|
@@ -196,4 +196,3 @@ export const command = async (conf) => {
|
|
|
196
196
|
: defaultLocalScopeQueryString),
|
|
197
197
|
};
|
|
198
198
|
};
|
|
199
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RegistryClient } from '@vltpkg/registry-client';
|
|
2
|
+
import { commandUsage } from "../config/usage.js";
|
|
3
|
+
import { missingRegistryError } from "../require-registry.js";
|
|
4
|
+
export const usage = () => commandUsage({
|
|
5
|
+
command: 'login',
|
|
6
|
+
usage: [''],
|
|
7
|
+
description: `Authenticate against a registry, and store the token in
|
|
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\`.`,
|
|
14
|
+
options: {
|
|
15
|
+
registry: {
|
|
16
|
+
value: '<url>',
|
|
17
|
+
description: 'Registry URL to authenticate against. Saved to vlt.json.',
|
|
18
|
+
},
|
|
19
|
+
identity: {
|
|
20
|
+
value: '<name>',
|
|
21
|
+
description: 'Identity namespace used to store auth tokens.',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
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();
|
|
31
|
+
const rc = new RegistryClient(conf.options);
|
|
32
|
+
await rc.login(registry);
|
|
33
|
+
// persist the registry so subsequent commands are configured
|
|
34
|
+
await conf.addConfigToFile('project', { registry });
|
|
35
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RegistryClient } from '@vltpkg/registry-client';
|
|
2
|
+
import { commandUsage } from "../config/usage.js";
|
|
3
|
+
import { resolveRegistry } from "../require-registry.js";
|
|
4
|
+
export const needsRegistry = true;
|
|
5
|
+
export const usage = () => commandUsage({
|
|
6
|
+
command: 'logout',
|
|
7
|
+
usage: [''],
|
|
8
|
+
description: `Log out of the default registry, deleting the token from
|
|
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\`.`,
|
|
13
|
+
options: {
|
|
14
|
+
registry: {
|
|
15
|
+
value: '<url>',
|
|
16
|
+
description: 'Registry URL to log out from.',
|
|
17
|
+
},
|
|
18
|
+
identity: {
|
|
19
|
+
value: '<name>',
|
|
20
|
+
description: 'Identity namespace used to look up auth tokens.',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
export const command = async (conf) => {
|
|
25
|
+
const rc = new RegistryClient(conf.options);
|
|
26
|
+
await rc.logout(await resolveRegistry(conf));
|
|
27
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
2
2
|
import type { LoadedConfig } from '../config/index.ts';
|
|
3
|
+
export declare const needsRegistry = true;
|
|
3
4
|
export declare const usage: CommandUsage;
|
|
4
5
|
export type CommandResultSingle = {
|
|
5
6
|
id: string;
|
|
@@ -29,4 +30,3 @@ export declare const commandSingle: (location: string, conf: LoadedConfig) => Pr
|
|
|
29
30
|
shasum: string | undefined;
|
|
30
31
|
integrity: string | undefined;
|
|
31
32
|
}>;
|
|
32
|
-
//# sourceMappingURL=pack.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
|
-
import { dirname, join, resolve } from 'node:path';
|
|
2
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
3
3
|
import assert from 'node:assert';
|
|
4
4
|
import { run } from '@vltpkg/run';
|
|
5
5
|
import { commandUsage } from "../config/usage.js";
|
|
@@ -9,6 +9,8 @@ import { actual } from '@vltpkg/graph';
|
|
|
9
9
|
import { Query } from '@vltpkg/query';
|
|
10
10
|
import { error } from '@vltpkg/error-cause';
|
|
11
11
|
import { createHostContextsMap } from "../query-host-contexts.js";
|
|
12
|
+
import { minimatch } from 'minimatch';
|
|
13
|
+
export const needsRegistry = true;
|
|
12
14
|
export const usage = () => commandUsage({
|
|
13
15
|
command: 'pack',
|
|
14
16
|
usage: '',
|
|
@@ -20,6 +22,21 @@ export const usage = () => commandUsage({
|
|
|
20
22
|
'dry-run': {
|
|
21
23
|
description: 'Show what would be packed without creating a tarball',
|
|
22
24
|
},
|
|
25
|
+
scope: {
|
|
26
|
+
value: '<query>',
|
|
27
|
+
description: 'Filter packages to pack using a DSS query selector.',
|
|
28
|
+
},
|
|
29
|
+
workspace: {
|
|
30
|
+
value: '<path|glob>',
|
|
31
|
+
description: 'Limit pack targets to matching workspaces.',
|
|
32
|
+
},
|
|
33
|
+
'workspace-group': {
|
|
34
|
+
value: '<name>',
|
|
35
|
+
description: 'Limit pack targets to workspace groups.',
|
|
36
|
+
},
|
|
37
|
+
recursive: {
|
|
38
|
+
description: 'Pack all workspaces in the monorepo.',
|
|
39
|
+
},
|
|
23
40
|
},
|
|
24
41
|
});
|
|
25
42
|
export const views = {
|
|
@@ -45,6 +62,43 @@ export const views = {
|
|
|
45
62
|
},
|
|
46
63
|
json: r => r,
|
|
47
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Resolve a scope query string to workspace locations using the DSS query system.
|
|
67
|
+
*/
|
|
68
|
+
const scopeLocations = async (queryString, conf) => {
|
|
69
|
+
const { options, projectRoot } = conf;
|
|
70
|
+
const mainManifest = options.packageJson.maybeRead(projectRoot);
|
|
71
|
+
let graph;
|
|
72
|
+
if (mainManifest) {
|
|
73
|
+
graph = actual.load({
|
|
74
|
+
...options,
|
|
75
|
+
mainManifest,
|
|
76
|
+
monorepo: options.monorepo,
|
|
77
|
+
loadManifests: false,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const hostContexts = await createHostContextsMap(conf);
|
|
81
|
+
const query = new Query({
|
|
82
|
+
/* c8 ignore next */
|
|
83
|
+
nodes: graph ? new Set(graph.nodes.values()) : new Set(),
|
|
84
|
+
edges: graph?.edges ?? new Set(),
|
|
85
|
+
importers: graph?.importers ?? new Set(),
|
|
86
|
+
securityArchive: undefined,
|
|
87
|
+
hostContexts,
|
|
88
|
+
});
|
|
89
|
+
const { nodes } = await query.search(queryString, {
|
|
90
|
+
signal: new AbortController().signal,
|
|
91
|
+
});
|
|
92
|
+
const locations = [];
|
|
93
|
+
for (const node of nodes) {
|
|
94
|
+
const { location } = node.toJSON();
|
|
95
|
+
assert(location, error(`node ${node.id} has no location`, {
|
|
96
|
+
found: node,
|
|
97
|
+
}));
|
|
98
|
+
locations.push(resolve(projectRoot, location));
|
|
99
|
+
}
|
|
100
|
+
return locations;
|
|
101
|
+
};
|
|
48
102
|
export const command = async (conf) => {
|
|
49
103
|
const { options, projectRoot } = conf;
|
|
50
104
|
const queryString = conf.get('scope');
|
|
@@ -54,41 +108,43 @@ export const command = async (conf) => {
|
|
|
54
108
|
const locations = [];
|
|
55
109
|
let single = null;
|
|
56
110
|
if (queryString) {
|
|
57
|
-
|
|
58
|
-
let graph;
|
|
59
|
-
if (mainManifest) {
|
|
60
|
-
graph = actual.load({
|
|
61
|
-
...options,
|
|
62
|
-
mainManifest,
|
|
63
|
-
monorepo: options.monorepo,
|
|
64
|
-
loadManifests: false,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
const hostContexts = await createHostContextsMap(conf);
|
|
68
|
-
const query = new Query({
|
|
69
|
-
/* c8 ignore next */
|
|
70
|
-
nodes: graph ? new Set(graph.nodes.values()) : new Set(),
|
|
71
|
-
edges: graph?.edges ?? new Set(),
|
|
72
|
-
importers: graph?.importers ?? new Set(),
|
|
73
|
-
securityArchive: undefined,
|
|
74
|
-
hostContexts,
|
|
75
|
-
});
|
|
76
|
-
const { nodes } = await query.search(queryString, {
|
|
77
|
-
signal: new AbortController().signal,
|
|
78
|
-
});
|
|
79
|
-
for (const node of nodes) {
|
|
80
|
-
const { location } = node.toJSON();
|
|
81
|
-
assert(location, error(`node ${node.id} has no location`, {
|
|
82
|
-
found: node,
|
|
83
|
-
}));
|
|
84
|
-
locations.push(resolve(projectRoot, location));
|
|
85
|
-
}
|
|
111
|
+
locations.push(...(await scopeLocations(queryString, conf)));
|
|
86
112
|
}
|
|
87
113
|
else if (paths?.length || groups?.length || recursive) {
|
|
88
114
|
for (const workspace of options.monorepo ?? []) {
|
|
115
|
+
// When specific workspace paths are set (including auto-inferred from cwd),
|
|
116
|
+
// filter to only matching workspaces. Without this, all monorepo workspaces
|
|
117
|
+
// would be operated on even when only one was specified.
|
|
118
|
+
if (paths?.length) {
|
|
119
|
+
const matches = paths.some((p) => workspace.path === p ||
|
|
120
|
+
workspace.name === p ||
|
|
121
|
+
workspace.fullpath === p ||
|
|
122
|
+
resolve(projectRoot, p) === workspace.fullpath ||
|
|
123
|
+
minimatch(workspace.path, p));
|
|
124
|
+
if (!matches)
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
89
127
|
locations.push(workspace.fullpath);
|
|
90
128
|
}
|
|
91
129
|
}
|
|
130
|
+
else if (options.monorepo) {
|
|
131
|
+
const cwd = process.cwd();
|
|
132
|
+
if (cwd === projectRoot) {
|
|
133
|
+
for (const workspace of options.monorepo) {
|
|
134
|
+
locations.push(workspace.fullpath);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
const ws = options.monorepo.get(cwd);
|
|
139
|
+
if (ws) {
|
|
140
|
+
locations.push(ws.fullpath);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const rel = relative(projectRoot, cwd).replaceAll('\\', '/');
|
|
144
|
+
locations.push(...(await scopeLocations(`:path("${rel}")`, conf)));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
92
148
|
else {
|
|
93
149
|
single = options.packageJson.find(process.cwd()) ?? projectRoot;
|
|
94
150
|
}
|
|
@@ -124,7 +180,11 @@ export const commandSingle = async (location, conf) => {
|
|
|
124
180
|
...runOptions,
|
|
125
181
|
arg0: 'prepare',
|
|
126
182
|
});
|
|
127
|
-
|
|
183
|
+
// Re-read the manifest after lifecycle scripts, which may have modified package.json.
|
|
184
|
+
const updatedManifest = conf.options.packageJson.read(manifestDir, {
|
|
185
|
+
reload: true,
|
|
186
|
+
});
|
|
187
|
+
const { name, version, filename, tarballData, unpackedSize, files, integrity, shasum, } = await packTarball(updatedManifest, manifestDir, conf);
|
|
128
188
|
if (!isDryRun) {
|
|
129
189
|
await writeFile(join(manifestDir, filename), tarballData);
|
|
130
190
|
}
|
|
@@ -144,4 +204,3 @@ export const commandSingle = async (location, conf) => {
|
|
|
144
204
|
integrity,
|
|
145
205
|
};
|
|
146
206
|
};
|
|
147
|
-
//# sourceMappingURL=pack.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CommandFn, CommandUsage } from '../index.ts';
|
|
2
|
+
export declare const needsRegistry = true;
|
|
3
|
+
export declare const usage: CommandUsage;
|
|
4
|
+
type PingResult = {
|
|
5
|
+
registry: string;
|
|
6
|
+
alias?: string;
|
|
7
|
+
status: 'ok' | 'error';
|
|
8
|
+
time: number;
|
|
9
|
+
statusCode?: number;
|
|
10
|
+
error?: string;
|
|
11
|
+
};
|
|
12
|
+
type CommandResult = PingResult | PingResult[];
|
|
13
|
+
export declare const views: {
|
|
14
|
+
readonly human: (r: CommandResult) => string;
|
|
15
|
+
readonly json: (r: CommandResult) => CommandResult;
|
|
16
|
+
};
|
|
17
|
+
export declare const command: CommandFn<CommandResult>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { RegistryClient } from '@vltpkg/registry-client';
|
|
2
|
+
import { error } from '@vltpkg/error-cause';
|
|
3
|
+
import { commandUsage } from "../config/usage.js";
|
|
4
|
+
import { requireRegistry } from "../require-registry.js";
|
|
5
|
+
export const needsRegistry = true;
|
|
6
|
+
export const usage = () => commandUsage({
|
|
7
|
+
command: 'ping',
|
|
8
|
+
usage: ['', '[<registry-alias>]'],
|
|
9
|
+
description: `Ping configured registries to verify connectivity
|
|
10
|
+
and check registry health.
|
|
11
|
+
|
|
12
|
+
By default, pings all configured registries including
|
|
13
|
+
the default registry.
|
|
14
|
+
|
|
15
|
+
If a registry alias is provided, ping only that specific
|
|
16
|
+
registry. Registry aliases are configured via the
|
|
17
|
+
\`registries\` field in vlt.json or with the
|
|
18
|
+
\`--registries\` option.`,
|
|
19
|
+
options: {
|
|
20
|
+
registry: {
|
|
21
|
+
value: '<url>',
|
|
22
|
+
description: 'The default registry URL to ping.',
|
|
23
|
+
},
|
|
24
|
+
registries: {
|
|
25
|
+
value: '<alias=url>',
|
|
26
|
+
description: 'Named registry aliases to ping.',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const formatPingResult = (r) => {
|
|
31
|
+
const prefix = r.alias ? `${r.alias} (${r.registry})` : r.registry;
|
|
32
|
+
if (r.status === 'ok') {
|
|
33
|
+
return `Ping successful: ${prefix} (${r.time}ms)`;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return `Ping failed: ${prefix} - ${r.error}`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const views = {
|
|
40
|
+
human: r => {
|
|
41
|
+
if (Array.isArray(r)) {
|
|
42
|
+
return r.map(formatPingResult).join('\n');
|
|
43
|
+
}
|
|
44
|
+
return formatPingResult(r);
|
|
45
|
+
},
|
|
46
|
+
json: r => r,
|
|
47
|
+
};
|
|
48
|
+
const pingRegistry = async (rc, registry, alias) => {
|
|
49
|
+
const url = new URL('-/ping?write=true', registry);
|
|
50
|
+
const start = Date.now();
|
|
51
|
+
try {
|
|
52
|
+
const response = await rc.request(url, { useCache: false });
|
|
53
|
+
const time = Date.now() - start;
|
|
54
|
+
if (response.statusCode >= 200 && response.statusCode < 300) {
|
|
55
|
+
return {
|
|
56
|
+
registry,
|
|
57
|
+
alias,
|
|
58
|
+
status: 'ok',
|
|
59
|
+
time,
|
|
60
|
+
statusCode: response.statusCode,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return {
|
|
65
|
+
registry,
|
|
66
|
+
alias,
|
|
67
|
+
status: 'error',
|
|
68
|
+
time,
|
|
69
|
+
statusCode: response.statusCode,
|
|
70
|
+
error: `Registry returned status ${response.statusCode}`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
const time = Date.now() - start;
|
|
76
|
+
return {
|
|
77
|
+
registry,
|
|
78
|
+
alias,
|
|
79
|
+
status: 'error',
|
|
80
|
+
time,
|
|
81
|
+
error: err instanceof Error ? err.message : String(err),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
export const command = async (conf) => {
|
|
86
|
+
const rc = new RegistryClient(conf.options);
|
|
87
|
+
const registryAlias = conf.positionals[0];
|
|
88
|
+
if (registryAlias) {
|
|
89
|
+
// Ping a specific registry by alias
|
|
90
|
+
const registries = conf.options.registries;
|
|
91
|
+
const registry = registries[registryAlias];
|
|
92
|
+
if (!registry) {
|
|
93
|
+
const availableAliases = Object.keys(registries);
|
|
94
|
+
throw error('Unknown registry alias', {
|
|
95
|
+
found: registryAlias,
|
|
96
|
+
wanted: availableAliases.length > 0 ? availableAliases : undefined,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return await pingRegistry(rc, registry, registryAlias);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// Ping all configured registries
|
|
103
|
+
const registries = conf.options.registries;
|
|
104
|
+
const defaultRegistry = requireRegistry(conf);
|
|
105
|
+
const results = [];
|
|
106
|
+
// Always ping the default registry first
|
|
107
|
+
results.push(await pingRegistry(rc, defaultRegistry, 'default'));
|
|
108
|
+
// Then ping all configured registry aliases
|
|
109
|
+
for (const [alias, registry] of Object.entries(registries)) {
|
|
110
|
+
// Skip if it's the same as the default registry
|
|
111
|
+
if (registry !== defaultRegistry) {
|
|
112
|
+
results.push(await pingRegistry(rc, registry, alias));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return results;
|
|
116
|
+
}
|
|
117
|
+
};
|