@plexus-ms/lib 0.126.0 → 0.128.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/dist/bookkeeping.d.ts +0 -4
- package/dist/bookkeeping.d.ts.map +1 -1
- package/dist/bookkeeping.js +0 -4
- package/dist/bookkeeping.js.map +1 -1
- package/dist/conflicts.d.ts +12 -0
- package/dist/conflicts.d.ts.map +1 -0
- package/dist/conflicts.js +48 -0
- package/dist/conflicts.js.map +1 -0
- package/dist/consumers.d.ts +20 -0
- package/dist/consumers.d.ts.map +1 -1
- package/dist/consumers.js +34 -2
- package/dist/consumers.js.map +1 -1
- package/dist/copier.d.ts +2 -0
- package/dist/copier.d.ts.map +1 -1
- package/dist/copier.js +10 -2
- package/dist/copier.js.map +1 -1
- package/dist/deployTargets.d.ts +22 -5
- package/dist/deployTargets.d.ts.map +1 -1
- package/dist/deployTargets.js +53 -13
- package/dist/deployTargets.js.map +1 -1
- package/dist/doctor.d.ts +4 -2
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +19 -1
- package/dist/doctor.js.map +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/io.d.ts +6 -0
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +19 -0
- package/dist/io.js.map +1 -1
- package/dist/overview.d.ts +13 -0
- package/dist/overview.d.ts.map +1 -1
- package/dist/overview.js +35 -2
- package/dist/overview.js.map +1 -1
- package/dist/pull.d.ts +153 -0
- package/dist/pull.d.ts.map +1 -0
- package/dist/pull.js +429 -0
- package/dist/pull.js.map +1 -0
- package/dist/recursive.d.ts +8 -0
- package/dist/recursive.d.ts.map +1 -0
- package/dist/recursive.js +60 -0
- package/dist/recursive.js.map +1 -0
- package/dist/standard-index.json +1 -1
- package/dist/summary.d.ts +35 -1
- package/dist/summary.d.ts.map +1 -1
- package/dist/summary.js +95 -8
- package/dist/summary.js.map +1 -1
- package/dist/take.d.ts +54 -43
- package/dist/take.d.ts.map +1 -1
- package/dist/take.js +152 -181
- package/dist/take.js.map +1 -1
- package/dist/umbrella.d.ts.map +1 -1
- package/dist/umbrella.js +3 -0
- package/dist/umbrella.js.map +1 -1
- package/dist/update.d.ts +59 -2
- package/dist/update.d.ts.map +1 -1
- package/dist/update.js +146 -58
- package/dist/update.js.map +1 -1
- package/package.json +1 -1
- package/dist/propagate.d.ts +0 -16
- package/dist/propagate.d.ts.map +0 -1
- package/dist/propagate.js +0 -51
- package/dist/propagate.js.map +0 -1
package/dist/bookkeeping.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export declare const WORKFLOW_REF = "plexus-ms/tooling/.github/workflows/";
|
|
2
2
|
/** Every `uses: plexus-ms/tooling/.github/workflows/<file>@<ref>` pinned to the version. */
|
|
3
3
|
export declare const bumpWorkflowRefs: (text: string, version: string) => string;
|
|
4
|
-
/** Leftovers of a three-way apply that did not go through. */
|
|
5
|
-
export declare const hasConflictMarkers: (text: string) => boolean;
|
|
6
|
-
/** Whether `git status --porcelain` output shows unmerged entries. */
|
|
7
|
-
export declare const hasUnmergedEntries: (porcelain: string) => boolean;
|
|
8
4
|
//# sourceMappingURL=bookkeeping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookkeeping.d.ts","sourceRoot":"","sources":["../src/bookkeeping.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,yCAAyC,CAAC;AAEnE,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,MACuC,CAAC
|
|
1
|
+
{"version":3,"file":"bookkeeping.d.ts","sourceRoot":"","sources":["../src/bookkeeping.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,yCAAyC,CAAC;AAEnE,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,MACuC,CAAC"}
|
package/dist/bookkeeping.js
CHANGED
|
@@ -7,8 +7,4 @@
|
|
|
7
7
|
export const WORKFLOW_REF = 'plexus-ms/tooling/.github/workflows/';
|
|
8
8
|
/** Every `uses: plexus-ms/tooling/.github/workflows/<file>@<ref>` pinned to the version. */
|
|
9
9
|
export const bumpWorkflowRefs = (text, version) => text.replace(/(plexus-ms\/tooling\/\.github\/workflows\/[A-Za-z0-9._-]+)@v?[0-9.]+/g, `$1@${version}`);
|
|
10
|
-
/** Leftovers of a three-way apply that did not go through. */
|
|
11
|
-
export const hasConflictMarkers = (text) => /^<<<<<<< /m.test(text);
|
|
12
|
-
/** Whether `git status --porcelain` output shows unmerged entries. */
|
|
13
|
-
export const hasUnmergedEntries = (porcelain) => /^(UU|AA|DU|UD)/m.test(porcelain);
|
|
14
10
|
//# sourceMappingURL=bookkeeping.js.map
|
package/dist/bookkeeping.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookkeeping.js","sourceRoot":"","sources":["../src/bookkeeping.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0EAA0E;AAC1E,6EAA6E;AAC7E,sEAAsE;AACtE,4EAA4E;AAC5E,uBAAuB;AACvB,MAAM,CAAC,MAAM,YAAY,GAAG,sCAAsC,CAAC;AAEnE,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,OAAe,EAAU,EAAE,CACxE,IAAI,CAAC,OAAO,CAAC,uEAAuE,EAAE,MAAM,OAAO,EAAE,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"bookkeeping.js","sourceRoot":"","sources":["../src/bookkeeping.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0EAA0E;AAC1E,6EAA6E;AAC7E,sEAAsE;AACtE,4EAA4E;AAC5E,uBAAuB;AACvB,MAAM,CAAC,MAAM,YAAY,GAAG,sCAAsC,CAAC;AAEnE,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,OAAe,EAAU,EAAE,CACxE,IAAI,CAAC,OAAO,CAAC,uEAAuE,EAAE,MAAM,OAAO,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Context } from './context.ts';
|
|
2
|
+
/** Whether the text holds a line that opens or closes a conflict. */
|
|
3
|
+
export declare const hasConflictMarkers: (text: string) => boolean;
|
|
4
|
+
/** Whether `git status --porcelain` output shows unmerged entries. */
|
|
5
|
+
export declare const hasUnmergedEntries: (porcelain: string) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The tracked files of the repo at `dir` that hold conflict markers, relative
|
|
8
|
+
* to it, sorted: as the working tree has them, or, given a `ref`, as that
|
|
9
|
+
* commit has them, which needs no checkout of it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function filesWithConflictMarkers(ctx: Context, dir: string, ref?: string): Promise<string[]>;
|
|
12
|
+
//# sourceMappingURL=conflicts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflicts.d.ts","sourceRoot":"","sources":["../src/conflicts.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAM5C,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,OAA4B,CAAC;AAE/E,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,KAAG,OAA4C,CAAC;AAEpG;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBzG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// conflicts: whether a text, or the tracked files of a repo, hold conflict
|
|
2
|
+
// markers. The one detector of plx, for every verb that asks: `doctor`
|
|
3
|
+
// reports a repo's files that hold one, a repo taking a version (take.ts)
|
|
4
|
+
// tells a conflicted site by it and lists the files in its pull request, and
|
|
5
|
+
// a later run tells by it whether that pull request still needs a hand
|
|
6
|
+
// (pull.ts).
|
|
7
|
+
//
|
|
8
|
+
// A marker is a line that opens (`<<<<<<<`) or closes (`>>>>>>>`) a
|
|
9
|
+
// conflict, followed by a space or the end of the line. The `=======` line
|
|
10
|
+
// between them is never one alone: it is also a Markdown setext heading.
|
|
11
|
+
//
|
|
12
|
+
// The files are found with `git grep`, which reads only what git tracks and
|
|
13
|
+
// can read a ref without a checkout; it only narrows the candidates, and the
|
|
14
|
+
// detector below decides each of them, read as git stores it (`cat-file`, no
|
|
15
|
+
// textconv). Nothing a user's git config colours reaches the parse.
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
import { orAbsent } from "./io.js";
|
|
18
|
+
/** A line that opens or closes a conflict; a carriage return before the line's end counts as its end. */
|
|
19
|
+
const MARKER = /^(?:<<<<<<<|>>>>>>>)(?: |\r?$)/m;
|
|
20
|
+
/** Whether the text holds a line that opens or closes a conflict. */
|
|
21
|
+
export const hasConflictMarkers = (text) => MARKER.test(text);
|
|
22
|
+
/** Whether `git status --porcelain` output shows unmerged entries. */
|
|
23
|
+
export const hasUnmergedEntries = (porcelain) => /^(UU|AA|DU|UD)/m.test(porcelain);
|
|
24
|
+
/**
|
|
25
|
+
* The tracked files of the repo at `dir` that hold conflict markers, relative
|
|
26
|
+
* to it, sorted: as the working tree has them, or, given a `ref`, as that
|
|
27
|
+
* commit has them, which needs no checkout of it.
|
|
28
|
+
*/
|
|
29
|
+
export async function filesWithConflictMarkers(ctx, dir, ref) {
|
|
30
|
+
// --no-color: under color.grep=always git colours the names even with -l -z.
|
|
31
|
+
const args = ['grep', '-l', '-z', '--no-color', '-E', '-e', '^(<<<<<<<|>>>>>>>)', ...(ref ? [ref] : []), '--'];
|
|
32
|
+
// git grep exits 1 when nothing matches.
|
|
33
|
+
const listed = await orAbsent(ctx.read('git', args, { cwd: dir }), (error) => error.code === 1);
|
|
34
|
+
const candidates = (listed ?? '')
|
|
35
|
+
.split('\0')
|
|
36
|
+
.filter(Boolean)
|
|
37
|
+
.map((name) => (ref && name.startsWith(`${ref}:`) ? name.slice(ref.length + 1) : name));
|
|
38
|
+
const held = [];
|
|
39
|
+
for (const file of candidates) {
|
|
40
|
+
const text = ref
|
|
41
|
+
? await ctx.read('git', ['cat-file', 'blob', `${ref}:${file}`], { cwd: dir })
|
|
42
|
+
: await ctx.readFile(join(dir, file));
|
|
43
|
+
if (hasConflictMarkers(text))
|
|
44
|
+
held.push(file);
|
|
45
|
+
}
|
|
46
|
+
return held.sort();
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=conflicts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflicts.js","sourceRoot":"","sources":["../src/conflicts.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,6EAA6E;AAC7E,uEAAuE;AACvE,aAAa;AACb,EAAE;AACF,oEAAoE;AACpE,2EAA2E;AAC3E,yEAAyE;AACzE,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,oEAAoE;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,yGAAyG;AACzG,MAAM,MAAM,GAAG,iCAAiC,CAAC;AAEjD,qEAAqE;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE/E,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAiB,EAAW,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAEpG;;;;GAIG;AACH,MA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AE,IAAI,CAAC,CAAC,CAAC;QACxC,IAAI,kBAAkB,CAAC,IAAI,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC"}
|
package/dist/consumers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Context } from './context.ts';
|
|
2
|
+
import { type Answers } from './copier.ts';
|
|
2
3
|
import { type Directory } from './model.ts';
|
|
3
4
|
export interface Site {
|
|
4
5
|
path: string;
|
|
@@ -29,4 +30,23 @@ export declare function expectedBranch(repo: Directory): Consumer['expected'];
|
|
|
29
30
|
* a repo without an origin has nowhere to clone from and is skipped.
|
|
30
31
|
*/
|
|
31
32
|
export declare function findConsumers(ctx: Context, root: Directory, templates: readonly string[]): Promise<Consumer[]>;
|
|
33
|
+
/** A site of a tree read from git: its directory relative to the repo (`.` for the root), and its answers. */
|
|
34
|
+
export interface TreeSite {
|
|
35
|
+
dir: string;
|
|
36
|
+
/** Undefined when the answers file does not parse (a conflict in the answers themselves). */
|
|
37
|
+
answers?: Answers;
|
|
38
|
+
/** The template it is generated from; undefined with the answers. */
|
|
39
|
+
template?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The sites of a commit's tree (a branch's tip, origin's branch), by the
|
|
43
|
+
* walk's rule (`answersDirs`): every answers file the walk would reach that
|
|
44
|
+
* names one of the templates, read from git, root first; and the tree's
|
|
45
|
+
* paths. An answers file that does not parse is a site all the same: one
|
|
46
|
+
* whose version cannot be read.
|
|
47
|
+
*/
|
|
48
|
+
export declare function sitesOfTree(ctx: Context, repo: string, commit: string): Promise<{
|
|
49
|
+
files: string[];
|
|
50
|
+
sites: TreeSite[];
|
|
51
|
+
}>;
|
|
32
52
|
//# sourceMappingURL=consumers.d.ts.map
|
package/dist/consumers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumers.d.ts","sourceRoot":"","sources":["../src/consumers.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"consumers.d.ts","sourceRoot":"","sources":["../src/consumers.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAgB,KAAK,OAAO,EAAgB,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,YAAY,CAAC;AAI1D,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,2GAA2G;IAC3G,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC,CAIpE;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAsCpH;AAED,8GAA8G;AAC9G,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,6FAA6F;IAC7F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC,CAoBjD"}
|
package/dist/consumers.js
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
// repo (its root answers say `publishes_packages`) is trunk-based on main
|
|
7
7
|
// (§ 5 PLX-Delivery). A repo without a marker is taken on the branch its
|
|
8
8
|
// checkout is on.
|
|
9
|
-
import { relative } from 'node:path';
|
|
9
|
+
import { join, relative } from 'node:path';
|
|
10
|
+
import { ANSWERS_FILE, parseAnswers } from "./copier.js";
|
|
10
11
|
import { isOperations } from "./model.js";
|
|
11
|
-
import {
|
|
12
|
+
import { answersDirs } from "./overview.js";
|
|
13
|
+
import { TEMPLATES, templateOf } from "./templates.js";
|
|
12
14
|
/** The branch a consumer is updated on; undefined for a repo without a marker. */
|
|
13
15
|
export function expectedBranch(repo) {
|
|
14
16
|
if (!repo.declaration)
|
|
@@ -65,4 +67,34 @@ export async function findConsumers(ctx, root, templates) {
|
|
|
65
67
|
}
|
|
66
68
|
return [...consumers.values()];
|
|
67
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* The sites of a commit's tree (a branch's tip, origin's branch), by the
|
|
72
|
+
* walk's rule (`answersDirs`): every answers file the walk would reach that
|
|
73
|
+
* names one of the templates, read from git, root first; and the tree's
|
|
74
|
+
* paths. An answers file that does not parse is a site all the same: one
|
|
75
|
+
* whose version cannot be read.
|
|
76
|
+
*/
|
|
77
|
+
export async function sitesOfTree(ctx, repo, commit) {
|
|
78
|
+
const files = (await ctx.read('git', ['ls-tree', '-r', '-z', '--name-only', commit], { cwd: repo }))
|
|
79
|
+
.split('\0')
|
|
80
|
+
.filter(Boolean);
|
|
81
|
+
const sites = [];
|
|
82
|
+
for (const dir of answersDirs(files)) {
|
|
83
|
+
const text = await ctx.read('git', ['cat-file', 'blob', `${commit}:${join(dir, ANSWERS_FILE)}`], { cwd: repo });
|
|
84
|
+
let answers;
|
|
85
|
+
try {
|
|
86
|
+
answers = parseAnswers(text);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
sites.push({ dir });
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const template = answers.src ? templateOf(answers.src, TEMPLATES) : undefined;
|
|
93
|
+
if (template)
|
|
94
|
+
sites.push({ dir, answers, template });
|
|
95
|
+
}
|
|
96
|
+
// The root before its apps, as the walk yields them.
|
|
97
|
+
sites.sort((a, b) => Number(b.dir === '.') - Number(a.dir === '.'));
|
|
98
|
+
return { files, sites };
|
|
99
|
+
}
|
|
68
100
|
//# sourceMappingURL=consumers.js.map
|
package/dist/consumers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumers.js","sourceRoot":"","sources":["../src/consumers.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,uEAAuE;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,yEAAyE;AACzE,kBAAkB;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"consumers.js","sourceRoot":"","sources":["../src/consumers.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,uEAAuE;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,yEAAyE;AACzE,kBAAkB;AAClB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAgB,YAAY,EAAE,MAAM,aAAa,CAAC;AAC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OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9E,IAAI,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,qDAAqD;IACrD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IACpE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC"}
|
package/dist/copier.d.ts
CHANGED
|
@@ -12,4 +12,6 @@ export interface Answers {
|
|
|
12
12
|
answers: Record<string, unknown>;
|
|
13
13
|
}
|
|
14
14
|
export declare function parseAnswers(text: string): Answers;
|
|
15
|
+
/** The answers file with one top-level key set, everything else (comments, order, the other answers) kept. */
|
|
16
|
+
export declare function setAnswer(text: string, key: string, value: string): string;
|
|
15
17
|
//# sourceMappingURL=copier.d.ts.map
|
package/dist/copier.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copier.d.ts","sourceRoot":"","sources":["../src/copier.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,wBAAwB,CAAC;AAClD,eAAO,MAAM,cAAc,UAAgC,CAAC;AAO5D,eAAO,MAAM,cAAc,WAAW,CAAC;AAEvC,qEAAqE;AACrE,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAG,MAAM,EAAmE,CAAC;AAErH,MAAM,WAAW,OAAO;IACtB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUlD"}
|
|
1
|
+
{"version":3,"file":"copier.d.ts","sourceRoot":"","sources":["../src/copier.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,wBAAwB,CAAC;AAClD,eAAO,MAAM,cAAc,UAAgC,CAAC;AAO5D,eAAO,MAAM,cAAc,WAAW,CAAC;AAEvC,qEAAqE;AACrE,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAG,MAAM,EAAmE,CAAC;AAErH,MAAM,WAAW,OAAO;IACtB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUlD;AAED,8GAA8G;AAC9G,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1E"}
|
package/dist/copier.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copier's bookkeeping in a generated project (§ 3 PLX-Updates): the answers
|
|
2
2
|
// file records the template (`_src_path`) and the version it was last synced
|
|
3
3
|
// to (`_commit`), plus the answers given. A template is a directory carrying a
|
|
4
|
-
// `copier.yml`.
|
|
5
|
-
import { parse } from 'yaml';
|
|
4
|
+
// `copier.yml`. The file is read and written as YAML, never as lines of text.
|
|
5
|
+
import { parse, parseDocument } from 'yaml';
|
|
6
6
|
export const ANSWERS_FILE = '.copier-answers.yml';
|
|
7
7
|
export const TEMPLATE_FILES = ['copier.yml', 'copier.yaml'];
|
|
8
8
|
// The copier every propagation runs, pinned here so that it travels with plx:
|
|
@@ -24,4 +24,12 @@ export function parseAnswers(text) {
|
|
|
24
24
|
answers,
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
/** The answers file with one top-level key set, everything else (comments, order, the other answers) kept. */
|
|
28
|
+
export function setAnswer(text, key, value) {
|
|
29
|
+
const doc = parseDocument(text);
|
|
30
|
+
if (doc.errors.length > 0)
|
|
31
|
+
throw new Error(`answers file is not YAML: ${doc.errors[0]?.message}`);
|
|
32
|
+
doc.set(key, value);
|
|
33
|
+
return doc.toString();
|
|
34
|
+
}
|
|
27
35
|
//# sourceMappingURL=copier.js.map
|
package/dist/copier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copier.js","sourceRoot":"","sources":["../src/copier.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,
|
|
1
|
+
{"version":3,"file":"copier.js","sourceRoot":"","sources":["../src/copier.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAE5D,8EAA8E;AAC9E,+EAA+E;AAC/E,+EAA+E;AAC/E,mEAAmE;AACnE,2CAA2C;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEvC,qEAAqE;AACrE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAc,EAAY,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC;AAWrH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,IAAI,GAAY,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,GAAG,IAA+B,CAAC;IAC3E,OAAO;QACL,MAAM,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;QAC3D,GAAG,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;QAC5D,OAAO;KACR,CAAC;AACJ,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,GAAW,EAAE,KAAa;IAChE,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAClG,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpB,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC"}
|
package/dist/deployTargets.d.ts
CHANGED
|
@@ -32,16 +32,33 @@ export interface DeployLeg {
|
|
|
32
32
|
app: string;
|
|
33
33
|
host: string;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* App → the files that hold its record in the environment and name no
|
|
37
|
+
* target, for the apps that have no target there from any other file.
|
|
38
|
+
*/
|
|
39
|
+
export declare function recordsWithoutTarget(files: InventoryFile[], environment: string): Record<string, string[]>;
|
|
40
|
+
/** An app a repo holds whose record in the environment names no target, and the files that hold the record. */
|
|
41
|
+
export interface Untargeted {
|
|
42
|
+
app: string;
|
|
43
|
+
files: string[];
|
|
44
|
+
}
|
|
35
45
|
/**
|
|
36
46
|
* The deploys of the apps a repo holds itself, in one environment: a leg per
|
|
37
|
-
* app with a target there
|
|
38
|
-
*
|
|
39
|
-
*
|
|
47
|
+
* app with a target there; `untargeted`, the apps with a record there whose
|
|
48
|
+
* file names no target, which the caller refuses; and `without`, the apps
|
|
49
|
+
* with no record there at all, which have no deployment in it. A platform
|
|
50
|
+
* repo fans its deploy over the legs, so that the inventory's records of
|
|
51
|
+
* apps built elsewhere start nothing here.
|
|
40
52
|
*/
|
|
41
|
-
export declare function deployLegs(targets: EnvironmentTargets, apps: string[]): {
|
|
53
|
+
export declare function deployLegs(targets: EnvironmentTargets, apps: string[], recordsWithout?: Record<string, string[]>): {
|
|
42
54
|
legs: DeployLeg[];
|
|
55
|
+
untargeted: Untargeted[];
|
|
43
56
|
without: string[];
|
|
44
57
|
};
|
|
45
|
-
/**
|
|
58
|
+
/** The error of a repo whose own apps have a record in the environment and no target: every app, with its file. */
|
|
59
|
+
export declare function untargetedError(untargeted: Untargeted[], environment: string): Error;
|
|
60
|
+
/** Read every group_vars and host_vars file under the inventory directory. */
|
|
61
|
+
export declare function readInventory(ctx: Context, inventory: string): Promise<InventoryFile[]>;
|
|
62
|
+
/** Read the inventory directory and map the deployments. */
|
|
46
63
|
export declare function readDeployTargets(ctx: Context, inventory: string): Promise<DeployTargets>;
|
|
47
64
|
//# sourceMappingURL=deployTargets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployTargets.d.ts","sourceRoot":"","sources":["../src/deployTargets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deployTargets.d.ts","sourceRoot":"","sources":["../src/deployTargets.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C,kDAAk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C;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,MAAM,EAAE,EACd,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAM,GAC5C;IAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAAC,UAAU,EAAE,UAAU,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAYpE;AAED,mHAAmH;AACnH,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,KAAK,CAMpF;AAED,8EAA8E;AAC9E,wBAAsB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAiB7F;AAED,4DAA4D;AAC5D,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAE/F"}
|
package/dist/deployTargets.js
CHANGED
|
@@ -7,8 +7,12 @@
|
|
|
7
7
|
// `environment` (`production` when absent). The verb maps every deployment,
|
|
8
8
|
// an app in an environment, of a file that names a target to that target. A
|
|
9
9
|
// deployment whose file carries no target is left out of the map, so the app
|
|
10
|
-
// has no target in that environment
|
|
11
|
-
//
|
|
10
|
+
// has no target in that environment, and `plx-ci plan` deploys nothing for
|
|
11
|
+
// it. `--apps` asks for the apps a platform repo holds itself and is
|
|
12
|
+
// stricter: an app under <dir> whose record in the environment sits in a
|
|
13
|
+
// file without a target is an error that names the app and the file, since
|
|
14
|
+
// the repo means to deploy it and nothing would; an app under <dir> with no
|
|
15
|
+
// record in the environment at all is named in one line and gets no leg. The
|
|
12
16
|
// same app may have one record per environment, on the same VM or on two;
|
|
13
17
|
// the same app in the same environment declared in two files that both name
|
|
14
18
|
// a target has no one place to deploy to, and that is an error, never a pick.
|
|
@@ -77,26 +81,58 @@ export function targetsIn(targets, environment) {
|
|
|
77
81
|
}
|
|
78
82
|
return flat;
|
|
79
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* App → the files that hold its record in the environment and name no
|
|
86
|
+
* target, for the apps that have no target there from any other file.
|
|
87
|
+
*/
|
|
88
|
+
export function recordsWithoutTarget(files, environment) {
|
|
89
|
+
const targeted = targetsIn(selectDeployTargets(files), environment);
|
|
90
|
+
const found = {};
|
|
91
|
+
for (const file of [...files].sort((a, b) => a.path.localeCompare(b.path))) {
|
|
92
|
+
if (file.target !== undefined)
|
|
93
|
+
continue;
|
|
94
|
+
for (const d of file.apps) {
|
|
95
|
+
if (d.environment !== environment || d.app in targeted)
|
|
96
|
+
continue;
|
|
97
|
+
const paths = found[d.app] ?? [];
|
|
98
|
+
if (!paths.includes(file.path))
|
|
99
|
+
paths.push(file.path);
|
|
100
|
+
found[d.app] = paths;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return found;
|
|
104
|
+
}
|
|
80
105
|
/**
|
|
81
106
|
* The deploys of the apps a repo holds itself, in one environment: a leg per
|
|
82
|
-
* app with a target there
|
|
83
|
-
*
|
|
84
|
-
*
|
|
107
|
+
* app with a target there; `untargeted`, the apps with a record there whose
|
|
108
|
+
* file names no target, which the caller refuses; and `without`, the apps
|
|
109
|
+
* with no record there at all, which have no deployment in it. A platform
|
|
110
|
+
* repo fans its deploy over the legs, so that the inventory's records of
|
|
111
|
+
* apps built elsewhere start nothing here.
|
|
85
112
|
*/
|
|
86
|
-
export function deployLegs(targets, apps) {
|
|
113
|
+
export function deployLegs(targets, apps, recordsWithout = {}) {
|
|
87
114
|
const legs = [];
|
|
115
|
+
const untargeted = [];
|
|
88
116
|
const without = [];
|
|
89
117
|
for (const app of [...apps].sort()) {
|
|
90
118
|
const host = targets[app];
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
else
|
|
119
|
+
const files = recordsWithout[app];
|
|
120
|
+
if (host !== undefined)
|
|
94
121
|
legs.push({ app, host });
|
|
122
|
+
else if (files !== undefined)
|
|
123
|
+
untargeted.push({ app, files });
|
|
124
|
+
else
|
|
125
|
+
without.push(app);
|
|
95
126
|
}
|
|
96
|
-
return { legs, without };
|
|
127
|
+
return { legs, untargeted, without };
|
|
97
128
|
}
|
|
98
|
-
/**
|
|
99
|
-
export
|
|
129
|
+
/** The error of a repo whose own apps have a record in the environment and no target: every app, with its file. */
|
|
130
|
+
export function untargetedError(untargeted, environment) {
|
|
131
|
+
const lines = untargeted.map(({ app, files }) => `${app} has a record in ${environment} in ${files.join(' and ')}, which names no plexus_deploy_target`);
|
|
132
|
+
return new Error(lines.join('\n'));
|
|
133
|
+
}
|
|
134
|
+
/** Read every group_vars and host_vars file under the inventory directory. */
|
|
135
|
+
export async function readInventory(ctx, inventory) {
|
|
100
136
|
const files = [];
|
|
101
137
|
let found = false;
|
|
102
138
|
for (const sub of VARS_DIRS) {
|
|
@@ -114,6 +150,10 @@ export async function readDeployTargets(ctx, inventory) {
|
|
|
114
150
|
}
|
|
115
151
|
if (!found && (await ctx.readDir(inventory).catch(() => undefined)) === undefined)
|
|
116
152
|
throw new UsageError(`no inventory directory at ${inventory}`);
|
|
117
|
-
return
|
|
153
|
+
return files;
|
|
154
|
+
}
|
|
155
|
+
/** Read the inventory directory and map the deployments. */
|
|
156
|
+
export async function readDeployTargets(ctx, inventory) {
|
|
157
|
+
return selectDeployTargets(await readInventory(ctx, inventory));
|
|
118
158
|
}
|
|
119
159
|
//# sourceMappingURL=deployTargets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployTargets.js","sourceRoot":"","sources":["../src/deployTargets.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,+DAA+D;AAC/D,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,qEAAqE;AACrE,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"deployTargets.js","sourceRoot":"","sources":["../src/deploy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AAG,IAAI,CAAC;QACb,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;gBAAE,SAAS;YACtD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IACD,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,SAAS;QAC/E,MAAM,IAAI,UAAU,CAAC,6BAA6B,SAAS,EAAE,CAAC,CAAC;IACjE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAY,EAAE,SAAiB;IACrE,OAAO,mBAAmB,CAAC,MAAM,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
package/dist/doctor.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface RepoFacts {
|
|
|
23
23
|
};
|
|
24
24
|
/** The files git tracks, relative to the repo; undefined outside a git checkout. */
|
|
25
25
|
tracked?: string[];
|
|
26
|
+
/** The tracked files that hold a conflict marker, relative to the repo. */
|
|
27
|
+
conflicted?: string[];
|
|
26
28
|
/** Its apps' directories, relative to the repo (`apps/<name>`). */
|
|
27
29
|
apps: string[];
|
|
28
30
|
}
|
|
@@ -66,8 +68,8 @@ interface AppCheck {
|
|
|
66
68
|
/** Every requirement doctor checks, by name: what the contract pages list, in their order. */
|
|
67
69
|
export declare const CHECKS: Readonly<Record<string, RepoCheck | AppCheck | UnitCheck>>;
|
|
68
70
|
export interface Finding {
|
|
69
|
-
/** The requirement's name, e.g. `PLX-App/LoopbackPort
|
|
70
|
-
requirement
|
|
71
|
+
/** The requirement's name, e.g. `PLX-App/LoopbackPort`; none for a conflict marker, which belongs to no requirement. */
|
|
72
|
+
requirement?: string;
|
|
71
73
|
problem: string;
|
|
72
74
|
}
|
|
73
75
|
export interface UnitReport {
|
package/dist/doctor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AA4BA,OAAO,EAEL,KAAK,OAAO,EAKZ,KAAK,OAAO,EAIb,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAE,KAAK,WAAW,EAA4B,MAAM,aAAa,CAAC;AACzE,OAAO,EAA2C,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAIhF,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC;AAE/C,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,kCAAkC;AAClC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;IAC5B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,4DAA4D;IAC5D,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,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C,WAAW,CAAC,CAiC7E"}
|
package/dist/doctor.js
CHANGED
|
@@ -17,11 +17,17 @@
|
|
|
17
17
|
// its check; a deviation without a reason in the marker's body, or naming no
|
|
18
18
|
// requirement, is a finding of its own. Findings are reported, never fixed.
|
|
19
19
|
//
|
|
20
|
+
// Beside the checks, and part of none of them: a tracked file of a repo that
|
|
21
|
+
// holds a conflict marker (conflicts.ts) is a failing finding of the repo,
|
|
22
|
+
// one per file, whatever the marker lists; it names no requirement, and
|
|
23
|
+
// nothing excludes a file from it.
|
|
24
|
+
//
|
|
20
25
|
// plx doctor # this repo and its apps, from anywhere inside it
|
|
21
26
|
// plx doctor ~/dev # every Plexus repo beneath, and its apps
|
|
22
27
|
import { realpath } from 'node:fs/promises';
|
|
23
28
|
import { dirname, join, relative, resolve } from 'node:path';
|
|
24
29
|
import { APP_SERVICE, declaresHealthcheck, healthcheckOf, isMapping, labelsOf, normalImage, parseCompose, truthy, } from "./compose.js";
|
|
30
|
+
import { filesWithConflictMarkers } from "./conflicts.js";
|
|
25
31
|
import { ExecError } from "./io.js";
|
|
26
32
|
import { REQUIREMENT_NAME } from "./lints.js";
|
|
27
33
|
import { MARKER_FILE, reasonGiven } from "./marker.js";
|
|
@@ -246,6 +252,9 @@ function diagnoseUnit(unit, known) {
|
|
|
246
252
|
for (const problem of run(c, unit, profile))
|
|
247
253
|
findings.push({ requirement: name, problem });
|
|
248
254
|
}
|
|
255
|
+
if (unit.kind !== 'app')
|
|
256
|
+
for (const file of unit.conflicted ?? [])
|
|
257
|
+
findings.push({ problem: `\`${file}\` holds a conflict marker` });
|
|
249
258
|
const obsolete = (declaration?.obsolete ?? []).map((k) => `\`${k}\``).join(' and ');
|
|
250
259
|
const hints = [];
|
|
251
260
|
if (obsolete)
|
|
@@ -365,7 +374,16 @@ async function readRepo(ctx, dir, path, kind) {
|
|
|
365
374
|
return undefined;
|
|
366
375
|
throw error;
|
|
367
376
|
});
|
|
368
|
-
|
|
377
|
+
const conflicted = tracked === undefined ? undefined : await filesWithConflictMarkers(ctx, dir.path);
|
|
378
|
+
return {
|
|
379
|
+
kind,
|
|
380
|
+
path,
|
|
381
|
+
...(marker ? { marker } : {}),
|
|
382
|
+
tasks: await rootTasks(ctx, dir.path),
|
|
383
|
+
tracked,
|
|
384
|
+
...(conflicted?.length ? { conflicted } : {}),
|
|
385
|
+
apps: [],
|
|
386
|
+
};
|
|
369
387
|
}
|
|
370
388
|
/**
|
|
371
389
|
* The repo's root mise tasks, hidden ones included, as mise lists them, so
|