@vltpkg/cli-sdk 1.0.0-rc.24 → 1.0.0-rc.26

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.
@@ -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,13 +14,32 @@ 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
  };
18
22
  export declare const usage: CommandUsage;
19
23
  export declare const views: {
20
24
  readonly json: (i: InstallResult) => {
21
- graph: import("@vltpkg/graph").LockfileData;
22
25
  buildQueue?: DepID[] | undefined;
23
26
  message?: string | undefined;
27
+ add: {
28
+ name: string;
29
+ version?: string;
30
+ }[];
31
+ added: number;
32
+ change: {
33
+ name: string;
34
+ from?: string;
35
+ to?: string;
36
+ }[];
37
+ changed: number;
38
+ remove: {
39
+ name: string;
40
+ version?: string;
41
+ }[];
42
+ removed: number;
24
43
  };
25
44
  readonly human: typeof InstallReporter;
26
45
  };
@@ -44,15 +44,65 @@ export const usage = () => commandUsage({
44
44
  },
45
45
  });
46
46
  export const views = {
47
- json: i => ({
48
- ...(i.buildQueue?.length ?
49
- {
50
- buildQueue: i.buildQueue,
51
- message: `${i.buildQueue.length} packages that will need to be built, run "vlt build" to complete the install.`,
47
+ json: i => {
48
+ const added = i.diff?.nodes.add ?? new Set();
49
+ const deleted = i.diff?.nodes.delete ?? new Set();
50
+ // The actual (from) graph represents what was on disk before the install.
51
+ // Used to filter out optional deps that were never installed (e.g.
52
+ // platform-specific binaries). These end up in the delete set via
53
+ // optionalFail but should not be reported as removals.
54
+ const actual = i.diff?.from;
55
+ // Build a map of deleted nodes by name for detecting changes
56
+ const deletedByName = new Map();
57
+ for (const node of deleted) {
58
+ if (node.importer)
59
+ continue;
60
+ // Skip nodes that were never on disk — these are optional deps
61
+ // that failed during install (e.g. wrong platform) and were moved
62
+ // to the delete set by optionalFail.
63
+ if (actual && !actual.nodes.has(node.id))
64
+ continue;
65
+ deletedByName.set(node.name, {
66
+ name: node.name,
67
+ version: node.version,
68
+ });
69
+ }
70
+ const add = [];
71
+ const change = [];
72
+ for (const node of added) {
73
+ if (node.importer)
74
+ continue;
75
+ const prev = deletedByName.get(node.name);
76
+ if (prev) {
77
+ // Package exists in both add and delete = changed
78
+ change.push({
79
+ name: node.name,
80
+ from: prev.version,
81
+ to: node.version,
82
+ });
83
+ deletedByName.delete(node.name);
52
84
  }
53
- : null),
54
- graph: i.graph.toJSON(),
55
- }),
85
+ else {
86
+ add.push({ name: node.name, version: node.version });
87
+ }
88
+ }
89
+ // Remaining deleted nodes that weren't matched = pure removals
90
+ const remove = [...deletedByName.values()];
91
+ return {
92
+ add,
93
+ added: add.length,
94
+ change,
95
+ changed: change.length,
96
+ remove,
97
+ removed: remove.length,
98
+ ...(i.buildQueue?.length ?
99
+ {
100
+ buildQueue: i.buildQueue,
101
+ message: `${i.buildQueue.length} packages that will need to be built, run "vlt build" to complete the install.`,
102
+ }
103
+ : null),
104
+ };
105
+ },
56
106
  human: InstallReporter,
57
107
  };
58
108
  export const command = async (conf) => {
@@ -69,12 +119,12 @@ export const command = async (conf) => {
69
119
  String(conf.get('allow-scripts'))
70
120
  : ':not(*)';
71
121
  /* c8 ignore stop */
72
- const { buildQueue, graph } = await install({
122
+ const { buildQueue, graph, diff } = await install({
73
123
  ...conf.options,
74
124
  frozenLockfile,
75
125
  expectLockfile,
76
126
  allowScripts,
77
127
  lockfileOnly,
78
128
  }, add);
79
- return { buildQueue, graph };
129
+ return { buildQueue, graph, diff };
80
130
  };
@@ -261,6 +261,7 @@ export class ExecCommand {
261
261
  arg0,
262
262
  args: this.args,
263
263
  env: this.env,
264
+ ignoreMissing: this.conf.get('if-present') ?? this.#defaultIgnoreMissing,
264
265
  projectRoot: this.projectRoot,
265
266
  packageJson: this.conf.options.packageJson,
266
267
  'script-shell': this.arg0 ? this.conf.get('script-shell') : false,
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.0-rc.24",
4
+ "version": "1.0.0-rc.26",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -9,34 +9,35 @@
9
9
  },
10
10
  "author": {
11
11
  "name": "vlt technology inc.",
12
- "email": "support@vlt.sh"
12
+ "email": "support@vlt.sh",
13
+ "url": "http://vlt.sh"
13
14
  },
14
15
  "dependencies": {
15
16
  "@resvg/resvg-wasm": "^2.6.2",
16
- "@vltpkg/config": "1.0.0-rc.24",
17
- "@vltpkg/dep-id": "1.0.0-rc.24",
18
- "@vltpkg/dot-prop": "1.0.0-rc.24",
19
- "@vltpkg/error-cause": "1.0.0-rc.24",
20
- "@vltpkg/git": "1.0.0-rc.24",
21
- "@vltpkg/graph": "1.0.0-rc.24",
22
- "@vltpkg/graph-run": "1.0.0-rc.24",
23
- "@vltpkg/init": "1.0.0-rc.24",
24
- "@vltpkg/output": "1.0.0-rc.24",
25
- "@vltpkg/package-info": "1.0.0-rc.24",
26
- "@vltpkg/package-json": "1.0.0-rc.24",
27
- "@vltpkg/promise-spawn": "1.0.0-rc.24",
28
- "@vltpkg/query": "1.0.0-rc.24",
29
- "@vltpkg/registry-client": "1.0.0-rc.24",
30
- "@vltpkg/rollback-remove": "1.0.0-rc.24",
31
- "@vltpkg/run": "1.0.0-rc.24",
32
- "@vltpkg/security-archive": "1.0.0-rc.24",
33
- "@vltpkg/spec": "1.0.0-rc.24",
34
- "@vltpkg/types": "1.0.0-rc.24",
35
- "@vltpkg/url-open": "1.0.0-rc.24",
36
- "@vltpkg/vlt-json": "1.0.0-rc.24",
37
- "@vltpkg/vlx": "1.0.0-rc.24",
38
- "@vltpkg/workspaces": "1.0.0-rc.24",
39
- "@vltpkg/xdg": "1.0.0-rc.24",
17
+ "@vltpkg/config": "1.0.0-rc.26",
18
+ "@vltpkg/dep-id": "1.0.0-rc.26",
19
+ "@vltpkg/dot-prop": "1.0.0-rc.26",
20
+ "@vltpkg/error-cause": "1.0.0-rc.26",
21
+ "@vltpkg/git": "1.0.0-rc.26",
22
+ "@vltpkg/graph": "1.0.0-rc.26",
23
+ "@vltpkg/graph-run": "1.0.0-rc.26",
24
+ "@vltpkg/init": "1.0.0-rc.26",
25
+ "@vltpkg/output": "1.0.0-rc.26",
26
+ "@vltpkg/package-info": "1.0.0-rc.26",
27
+ "@vltpkg/package-json": "1.0.0-rc.26",
28
+ "@vltpkg/promise-spawn": "1.0.0-rc.26",
29
+ "@vltpkg/query": "1.0.0-rc.26",
30
+ "@vltpkg/registry-client": "1.0.0-rc.26",
31
+ "@vltpkg/rollback-remove": "1.0.0-rc.26",
32
+ "@vltpkg/run": "1.0.0-rc.26",
33
+ "@vltpkg/security-archive": "1.0.0-rc.26",
34
+ "@vltpkg/spec": "1.0.0-rc.26",
35
+ "@vltpkg/types": "1.0.0-rc.26",
36
+ "@vltpkg/url-open": "1.0.0-rc.26",
37
+ "@vltpkg/vlt-json": "1.0.0-rc.26",
38
+ "@vltpkg/vlx": "1.0.0-rc.26",
39
+ "@vltpkg/workspaces": "1.0.0-rc.26",
40
+ "@vltpkg/xdg": "1.0.0-rc.26",
40
41
  "ansi-to-pre": "^1.0.6",
41
42
  "beautiful-mermaid": "^1.1.3",
42
43
  "chalk": "^5.6.2",