@pluginfinity/cli 0.1.1 → 0.2.0
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/commands/validate.js +2 -2
- package/package.json +8 -8
- package/render/build.js +37 -6
- package/version.js +1 -1
package/commands/validate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validateLines } from "../render/build.js";
|
|
1
|
+
import { validateJson, validateLines } from "../render/build.js";
|
|
2
2
|
import { reportFindings } from "../render/config-error.js";
|
|
3
3
|
import { allFlag, configFlag, pathArgument, targetFlag, toSelection } from "./shared.js";
|
|
4
4
|
import { Command, Flag } from "effect/cli";
|
|
@@ -29,7 +29,7 @@ const validateCommand = (launch) => Command.make("validate", {
|
|
|
29
29
|
engine_version: ENGINE_VERSION,
|
|
30
30
|
distribution: Option.getOrNull(distribution),
|
|
31
31
|
ok: true,
|
|
32
|
-
validations
|
|
32
|
+
validations: validations.map(validateJson)
|
|
33
33
|
}));
|
|
34
34
|
}
|
|
35
35
|
}).pipe(reportFindings)).pipe(Command.withDescription("Run pluginfinity's own checks, then each host's CLI"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluginfinity/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The pluginfinity command-line front end. Install the pluginfinity package to get the pluginfinity bin.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@effect/platform-node": "^4.0.
|
|
44
|
-
"@effected/cli": "^0.
|
|
43
|
+
"@effect/platform-node": "^4.0.1",
|
|
44
|
+
"@effected/cli": "^0.13.0",
|
|
45
45
|
"@effected/commands": "^0.11.0",
|
|
46
|
-
"@effected/engine": "^0.
|
|
46
|
+
"@effected/engine": "^0.4.0",
|
|
47
47
|
"@effected/env": "^0.1.0",
|
|
48
48
|
"@effected/glob": "^0.10.0",
|
|
49
49
|
"@effected/semver": "^0.11.0",
|
|
50
50
|
"@effected/walker": "^0.15.0",
|
|
51
|
-
"@pluginfinity/core": "0.
|
|
52
|
-
"@pluginfinity/engine": "0.
|
|
53
|
-
"@pluginfinity/targets": "0.
|
|
54
|
-
"effect": "^4.0.
|
|
51
|
+
"@pluginfinity/core": "0.2.0",
|
|
52
|
+
"@pluginfinity/engine": "0.2.0",
|
|
53
|
+
"@pluginfinity/targets": "0.2.0",
|
|
54
|
+
"effect": "^4.0.1",
|
|
55
55
|
"jiti": "^2.6.1"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
package/render/build.js
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
|
+
import { BUILD_NOTE_KINDS } from "@pluginfinity/engine";
|
|
2
|
+
|
|
1
3
|
//#region src/render/build.ts
|
|
2
4
|
const counts = (build) => `${build.plan.added.length} added, ${build.plan.changed.length} changed, ${build.plan.removed.length} removed`;
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* One indented line per component, in the notes' order: kinds in
|
|
7
|
+
* `BUILD_NOTE_KINDS` order separated by `; `, names within a kind by `, `.
|
|
8
|
+
*/
|
|
9
|
+
const noteLines = (notes) => {
|
|
10
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
11
|
+
for (const note of notes) byPath.set(note.path, [...byPath.get(note.path) ?? [], note]);
|
|
12
|
+
return [...byPath].map(([path, group]) => {
|
|
13
|
+
return ` · ${path}: ${BUILD_NOTE_KINDS.flatMap((kind) => {
|
|
14
|
+
const names = group.filter((note) => note.kind === kind).map((note) => note.name);
|
|
15
|
+
return names.length === 0 ? [] : [`${kind} ${names.join(", ")}`];
|
|
16
|
+
}).join("; ")}`;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
/** One line per target build a person reads, each followed by its notes. */
|
|
20
|
+
const buildLines = (builds, check) => builds.flatMap((build) => [check ? `✓ ${build.target}: ${build.out} is up to date` : build.plan.clean ? `✓ ${build.target}: ${build.out} unchanged` : `✓ ${build.target}: ${build.out} (${counts(build)})`, ...noteLines(build.notes)]);
|
|
21
|
+
/** A note's JSON shape: its target is already on the enclosing build. */
|
|
22
|
+
const noteJson = ({ path, kind, name }) => ({
|
|
23
|
+
path,
|
|
24
|
+
kind,
|
|
25
|
+
name
|
|
26
|
+
});
|
|
5
27
|
/** The JSON shape of one target build. */
|
|
6
28
|
const buildJson = (build) => ({
|
|
7
29
|
config: build.config,
|
|
@@ -9,10 +31,19 @@ const buildJson = (build) => ({
|
|
|
9
31
|
out: build.out,
|
|
10
32
|
added: build.plan.added,
|
|
11
33
|
changed: build.plan.changed,
|
|
12
|
-
removed: build.plan.removed
|
|
34
|
+
removed: build.plan.removed,
|
|
35
|
+
notes: build.notes.map(noteJson)
|
|
36
|
+
});
|
|
37
|
+
/** One line per target validation a person reads, each followed by its notes. */
|
|
38
|
+
const validateLines = (validations) => validations.flatMap((validation) => [`✓ ${validation.target}: ${validation.out} ${validation.host === "passed" ? "passed the host check" : "is current (host check skipped)"}`, ...noteLines(validation.notes)]);
|
|
39
|
+
/** The JSON shape of one target validation. */
|
|
40
|
+
const validateJson = (validation) => ({
|
|
41
|
+
config: validation.config,
|
|
42
|
+
target: validation.target,
|
|
43
|
+
out: validation.out,
|
|
44
|
+
host: validation.host,
|
|
45
|
+
notes: validation.notes.map(noteJson)
|
|
13
46
|
});
|
|
14
|
-
/** One line per target validation a person reads. */
|
|
15
|
-
const validateLines = (validations) => validations.map((validation) => `✓ ${validation.target}: ${validation.out} ${validation.host === "passed" ? "passed the host check" : "is current (host check skipped)"}`);
|
|
16
47
|
|
|
17
48
|
//#endregion
|
|
18
|
-
export { buildJson, buildLines, validateLines };
|
|
49
|
+
export { buildJson, buildLines, noteLines, validateJson, validateLines };
|
package/version.js
CHANGED