@antelopejs/tooling-configs 0.3.4 → 0.3.6
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/README.md +20 -2
- package/dist/bin/checks.mjs +348 -8
- package/dist/bin/garden.mjs +1 -1
- package/dist/bin/lease.mjs +1 -50
- package/dist/bin/sync.mjs +488 -15
- package/dist/bin/verify.mjs +1257 -345
- package/dist/{ci-workflow-C4mQ8QSp.mjs → ci-workflow-37qJa9LX.mjs} +33 -10
- package/dist/env-DT0UJNeL.mjs +79 -0
- package/dist/{map-mT2iQzit.mjs → map-CiFEGFRz.mjs} +83 -9
- package/dist/verify/index.d.mts +36 -2
- package/package.json +3 -2
|
@@ -352,14 +352,36 @@ function skipRenovateSync(document, job) {
|
|
|
352
352
|
else job.set("with", document.createNode({ "renovate-sync": false }));
|
|
353
353
|
return true;
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function setTestJob(document, job, placeholderTests) {
|
|
356
356
|
const inputs = job.get("with", true);
|
|
357
357
|
if (isMap(inputs)) {
|
|
358
|
-
if (inputs.has("test-job"))
|
|
359
|
-
|
|
360
|
-
|
|
358
|
+
if (!inputs.has("test-job")) {
|
|
359
|
+
inputs.set("test-job", !placeholderTests);
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
if (!placeholderTests || inputs.get("test-job") === false) return false;
|
|
363
|
+
inputs.set("test-job", false);
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
job.set("with", document.createNode({ "test-job": !placeholderTests }));
|
|
361
367
|
return true;
|
|
362
368
|
}
|
|
369
|
+
/** The caller sync writes into a repository without one, its test job off when the `test` script is a placeholder. */
|
|
370
|
+
function newCaller(placeholderTests) {
|
|
371
|
+
return placeholderTests ? CI_CALLER.replace("test-job: true", "test-job: false") : CI_CALLER;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Whether a `test` script only stands in for tests: made only of `echo` and
|
|
375
|
+
* `exit 0` commands, such as `echo 'No tests defined'`. A missing script is
|
|
376
|
+
* not a placeholder, since the shared test job may run tests another way. Such a
|
|
377
|
+
* repository gets `test-job: false`, since a test job would only spend runner
|
|
378
|
+
* time printing it.
|
|
379
|
+
*/
|
|
380
|
+
function placeholderTestScript(script) {
|
|
381
|
+
if (script === void 0) return false;
|
|
382
|
+
const commands = script.split(/&&|\|\||;/).map((command) => command.trim()).filter(Boolean);
|
|
383
|
+
return commands.length > 0 && commands.every((command) => /^echo(\s|$)/.test(command) || /^exit\s+0$/.test(command));
|
|
384
|
+
}
|
|
363
385
|
function lines(text) {
|
|
364
386
|
return text.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
365
387
|
}
|
|
@@ -426,8 +448,9 @@ function dropRedundantAggregator(jobs, syncCallers) {
|
|
|
426
448
|
* Keeps the shared CI caller on the job id `ci` with no `name`, so the shared workflow reports `ci / checks`,
|
|
427
449
|
* dispatchable and read-only, with the Renovate sync it would otherwise run turned off. The write permissions the sync
|
|
428
450
|
* needs to push and dispatch the caller live on a separate job calling ci-renovate-sync.yml, which is added when missing.
|
|
429
|
-
* A caller without a `test-job` input gets `test-job: true`, which runs the tests in their own job
|
|
430
|
-
*
|
|
451
|
+
* A caller without a `test-job` input gets `test-job: true`, which runs the tests in their own job, or `false` when
|
|
452
|
+
* `placeholderTests` says the `test` script only stands in for tests; that case also turns an existing `true` off. Any
|
|
453
|
+
* other explicit value is left as the repository set it.
|
|
431
454
|
* A `checks` job that only re-aggregates the caller (`needs: [ci]`, steps that `exit` on `needs` results) is removed
|
|
432
455
|
* when the workflow has no other job besides the caller and the Renovate sync, since the shared workflow already
|
|
433
456
|
* reports `ci / checks` and each `needs` hop adds to the critical path. A gate that also covers repository-specific
|
|
@@ -436,8 +459,8 @@ function dropRedundantAggregator(jobs, syncCallers) {
|
|
|
436
459
|
* When `docsFiles` computes paths, every caller's `docs-files` input lists them first, then keeps its hand-listed paths
|
|
437
460
|
* that still exist, so sync never drops coverage.
|
|
438
461
|
*/
|
|
439
|
-
function ciWorkflow(current, callers, syncCallers, docsFiles) {
|
|
440
|
-
if (current === void 0) return
|
|
462
|
+
function ciWorkflow(current, callers, syncCallers, docsFiles, placeholderTests = false) {
|
|
463
|
+
if (current === void 0) return newCaller(placeholderTests);
|
|
441
464
|
if (!callers.length) return current;
|
|
442
465
|
const document = parseDocument(current);
|
|
443
466
|
if (document.errors.length) throw new Error(`${CI_PATH}: ${document.errors.map(({ message }) => message).join("; ")}`);
|
|
@@ -460,7 +483,7 @@ function ciWorkflow(current, callers, syncCallers, docsFiles) {
|
|
|
460
483
|
}
|
|
461
484
|
changed = grant(document, pair.value, { contents: "read" }) || changed;
|
|
462
485
|
changed = skipRenovateSync(document, pair.value) || changed;
|
|
463
|
-
changed =
|
|
486
|
+
changed = setTestJob(document, pair.value, placeholderTests) || changed;
|
|
464
487
|
changed = ensureSyncJob(document, jobs, syncCallers) || changed;
|
|
465
488
|
const removed = dropRedundantAggregator(jobs, syncCallers);
|
|
466
489
|
changed = removed.length > 0 || changed;
|
|
@@ -478,4 +501,4 @@ function ciWorkflow(current, callers, syncCallers, docsFiles) {
|
|
|
478
501
|
});
|
|
479
502
|
}
|
|
480
503
|
//#endregion
|
|
481
|
-
export { ciWorkflow as a,
|
|
504
|
+
export { ciWorkflow as a, ciNodeCallers as c, RENOVATE_CONFIGS as d, RENOVATE_PRESET as f, CI_RENOVATE_SYNC_REF as i, ciRenovateSyncCallers as l, CI_NODE_REF as n, placeholderTestScript as o, renovateArtifacts as p, CI_PATH as r, MISSING_CHECKS_WORKFLOW as s, CI_CONTEXT as t, hasChecksWorkflow as u };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
//#region src/lease/env.ts
|
|
3
|
+
/** The variable whose presence marks a command as running under `antelopejs-lease run`; `down --stop` finds a lease's processes by it. */
|
|
4
|
+
const LEASE_MARKER = "ANTELOPEJS_LEASE";
|
|
5
|
+
/**
|
|
6
|
+
* The `environ` entry that `run` hands its command and every descendant inherits, which marks a
|
|
7
|
+
* process as the work of lease `id`.
|
|
8
|
+
*/
|
|
9
|
+
function leaseMarker(id) {
|
|
10
|
+
return `${LEASE_MARKER}=${id}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* `env` without the lease marker, for a process that outlives the command that started it and
|
|
14
|
+
* belongs to no lease's `down --stop`, such as a lease's mongod started from inside another lease's
|
|
15
|
+
* `run`.
|
|
16
|
+
*/
|
|
17
|
+
function unmarked(env) {
|
|
18
|
+
const { [LEASE_MARKER]: _marker, ...rest } = env;
|
|
19
|
+
return rest;
|
|
20
|
+
}
|
|
21
|
+
function isServerRole(value) {
|
|
22
|
+
return value === "api" || value === "web";
|
|
23
|
+
}
|
|
24
|
+
/** The variables `run` exports for a DMS dev stack, besides the `ANTELOPEJS_LEASE*` ones. */
|
|
25
|
+
const DEV_STACK_VARIABLES = [
|
|
26
|
+
"DMS_BACK_PORT",
|
|
27
|
+
"DMS_FRONT_PORT",
|
|
28
|
+
"DMS_INSPECT_PORT",
|
|
29
|
+
"DMS_SMTP_PORT",
|
|
30
|
+
"DMS_CLIENT_BASE_URL",
|
|
31
|
+
"MONGO_URL",
|
|
32
|
+
"MONGO_DATABASE",
|
|
33
|
+
"DMS_BACK_LOG",
|
|
34
|
+
"DMS_FRONT_LOG",
|
|
35
|
+
"TMPDIR",
|
|
36
|
+
"PORT"
|
|
37
|
+
];
|
|
38
|
+
/** The variable that carries the lease's directory; a command is under a lease only when this and `LEASE_MARKER` are both non-empty. */
|
|
39
|
+
const LEASE_DIR = "ANTELOPEJS_LEASE_DIR";
|
|
40
|
+
/** The variable that carries the caller's own `TMPDIR` past the lease's override; empty when the caller had none, absent from a lease an older pack opened. */
|
|
41
|
+
const PARENT_TMPDIR = "ANTELOPEJS_LEASE_PARENT_TMPDIR";
|
|
42
|
+
/** The lease's own tmp folder, which `run` exports as `TMPDIR`. */
|
|
43
|
+
function leaseTmpDir(dir) {
|
|
44
|
+
return join(dir, "tmp");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The environment `run` hands its command: `parent` without `PORT`, plus the lease's variables.
|
|
48
|
+
* `PARENT_TMPDIR` keeps the caller's own `TMPDIR`, or the one an outer lease recorded.
|
|
49
|
+
* `PORT` comes back only for `as`, because one shell-wide `PORT` makes the backend and the
|
|
50
|
+
* dashboard bind the same port. `DMS_MONGO_URL` in `parent` replaces the lease's own mongod.
|
|
51
|
+
* `DMS_API_BASE_URL` stays unset. A backend whose config hard-codes its port falls back to a free
|
|
52
|
+
* one and records it in `.antelope/dev.json`, and `ajs dms dev` reads that file only without it.
|
|
53
|
+
*/
|
|
54
|
+
function leaseEnv(lease, parent, as) {
|
|
55
|
+
const { record, dir } = lease;
|
|
56
|
+
const { ports } = record;
|
|
57
|
+
const { PORT: _inherited, ...env } = parent;
|
|
58
|
+
const devStack = {
|
|
59
|
+
DMS_BACK_PORT: String(ports.api),
|
|
60
|
+
DMS_FRONT_PORT: String(ports.web),
|
|
61
|
+
DMS_INSPECT_PORT: String(ports.inspect),
|
|
62
|
+
DMS_SMTP_PORT: String(ports.smtp),
|
|
63
|
+
DMS_CLIENT_BASE_URL: `http://localhost:${ports.web}`,
|
|
64
|
+
MONGO_URL: parent.DMS_MONGO_URL || `mongodb://127.0.0.1:${ports.mongo}`,
|
|
65
|
+
MONGO_DATABASE: `dms_${record.id}`,
|
|
66
|
+
DMS_BACK_LOG: join(dir, "logs", "back.log"),
|
|
67
|
+
DMS_FRONT_LOG: join(dir, "logs", "front.log"),
|
|
68
|
+
TMPDIR: leaseTmpDir(dir)
|
|
69
|
+
};
|
|
70
|
+
Object.assign(env, devStack, {
|
|
71
|
+
[LEASE_MARKER]: record.id,
|
|
72
|
+
[LEASE_DIR]: dir,
|
|
73
|
+
[PARENT_TMPDIR]: parent["ANTELOPEJS_LEASE_PARENT_TMPDIR"] ?? parent.TMPDIR ?? ""
|
|
74
|
+
});
|
|
75
|
+
if (as !== void 0) env.PORT = String(ports[as]);
|
|
76
|
+
return env;
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { isServerRole as a, leaseTmpDir as c, PARENT_TMPDIR as i, unmarked as l, LEASE_DIR as n, leaseEnv as o, LEASE_MARKER as r, leaseMarker as s, DEV_STACK_VARIABLES as t };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { l as skillFolder } from "./shared-igPpEDpS.mjs";
|
|
2
2
|
import { f as parseJson, i as isObject } from "./json-CG2L7YFl.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { c as leaseTmpDir, i as PARENT_TMPDIR, n as LEASE_DIR, r as LEASE_MARKER, t as DEV_STACK_VARIABLES } from "./env-DT0UJNeL.mjs";
|
|
4
|
+
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, utimesSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { basename, delimiter, dirname, join, matchesGlob, relative, resolve } from "node:path";
|
|
5
6
|
import { execFileSync } from "node:child_process";
|
|
6
7
|
import { pathToFileURL } from "node:url";
|
|
7
8
|
import { randomBytes } from "node:crypto";
|
|
@@ -12,8 +13,19 @@ import { homedir, tmpdir } from "node:os";
|
|
|
12
13
|
* published packages. Nothing a journey asserts on lives here.
|
|
13
14
|
*/
|
|
14
15
|
const CACHE_DIR = join(process.env.XDG_CACHE_HOME ?? join(homedir(), ".cache"), "antelopejs-verify");
|
|
16
|
+
/**
|
|
17
|
+
* The temp folder the operator would have outside a lease: the `TMPDIR` of
|
|
18
|
+
* `operatorEnv()`, else the platform default, so a lease's own tmp never
|
|
19
|
+
* holds a run.
|
|
20
|
+
*/
|
|
21
|
+
function operatorTmpdir() {
|
|
22
|
+
const { TMPDIR: tmp, TMP, TEMP } = operatorEnv();
|
|
23
|
+
if (tmp) return tmp;
|
|
24
|
+
if (process.platform === "win32") return tmpdir();
|
|
25
|
+
return TMP || TEMP || "/tmp";
|
|
26
|
+
}
|
|
15
27
|
/** The folder that holds every run, one subfolder per repository. */
|
|
16
|
-
const RUNS_DIR = join(
|
|
28
|
+
const RUNS_DIR = join(operatorTmpdir(), "antelopejs-verify");
|
|
17
29
|
function makeWritable(folder) {
|
|
18
30
|
chmodSync(folder, lstatSync(folder).mode | 448);
|
|
19
31
|
for (const entry of readdirSync(folder, { withFileTypes: true })) if (entry.isDirectory()) makeWritable(join(folder, entry.name));
|
|
@@ -79,6 +91,7 @@ function loadRun(dir) {
|
|
|
79
91
|
const stored = JSON.parse(readFileSync(file, "utf8"));
|
|
80
92
|
return {
|
|
81
93
|
...stored,
|
|
94
|
+
timings: stored.timings ?? [],
|
|
82
95
|
all: stored.all === true
|
|
83
96
|
};
|
|
84
97
|
}
|
|
@@ -108,7 +121,8 @@ function allocateRun(workspace, baseRef, title, all) {
|
|
|
108
121
|
pack: "",
|
|
109
122
|
manifestUrl: "",
|
|
110
123
|
templateName: "",
|
|
111
|
-
missingKeys: (workspace.config.saas?.env ?? []).filter((key) => !process.env[key])
|
|
124
|
+
missingKeys: (workspace.config.saas?.env ?? []).filter((key) => !process.env[key]),
|
|
125
|
+
timings: []
|
|
112
126
|
};
|
|
113
127
|
}
|
|
114
128
|
const INHERITED_PREFIXES = [
|
|
@@ -117,13 +131,55 @@ const INHERITED_PREFIXES = [
|
|
|
117
131
|
"PNPM_",
|
|
118
132
|
"XDG_"
|
|
119
133
|
];
|
|
134
|
+
/** The real path of `path`, resolved through its nearest existing ancestor when the path itself is gone. */
|
|
135
|
+
function canonical(path) {
|
|
136
|
+
const full = resolve(path);
|
|
137
|
+
try {
|
|
138
|
+
return realpathSync(full);
|
|
139
|
+
} catch {
|
|
140
|
+
const parent = dirname(full);
|
|
141
|
+
return parent === full ? full : join(canonical(parent), basename(full));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function isLeaseTmp(tmp, leaseDir) {
|
|
145
|
+
return !!tmp && canonical(tmp) === canonical(leaseTmpDir(leaseDir));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The environment the operator would have outside `antelopejs-lease run`. A
|
|
149
|
+
* lease is active only when `ANTELOPEJS_LEASE` and `ANTELOPEJS_LEASE_DIR` are
|
|
150
|
+
* both non-empty. Under one, the lease's dev-stack variables and its own
|
|
151
|
+
* `ANTELOPEJS_LEASE*` variables are dropped. `TMPDIR` is replaced only when
|
|
152
|
+
* it is the lease's own tmp: by the value the lease recorded, or removed when
|
|
153
|
+
* the operator had none, and kept as it is when the lease recorded nothing
|
|
154
|
+
* (an older pack). A `TMPDIR` set for the command is honoured. Outside a
|
|
155
|
+
* lease it is `process.env` unchanged, so the operator's own `PORT` or
|
|
156
|
+
* `MONGO_URL` still counts.
|
|
157
|
+
*/
|
|
158
|
+
function operatorEnv() {
|
|
159
|
+
const leaseDir = process.env[LEASE_DIR];
|
|
160
|
+
if (!process.env["ANTELOPEJS_LEASE"] || !leaseDir) return process.env;
|
|
161
|
+
const dropped = /* @__PURE__ */ new Set([
|
|
162
|
+
...DEV_STACK_VARIABLES.filter((name) => name !== "TMPDIR"),
|
|
163
|
+
LEASE_MARKER,
|
|
164
|
+
LEASE_DIR,
|
|
165
|
+
PARENT_TMPDIR
|
|
166
|
+
]);
|
|
167
|
+
const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !dropped.has(key)));
|
|
168
|
+
const recorded = process.env[PARENT_TMPDIR];
|
|
169
|
+
if (recorded !== void 0 && isLeaseTmp(env.TMPDIR, leaseDir)) {
|
|
170
|
+
if (recorded) env.TMPDIR = recorded;
|
|
171
|
+
else delete env.TMPDIR;
|
|
172
|
+
}
|
|
173
|
+
return env;
|
|
174
|
+
}
|
|
120
175
|
/**
|
|
121
176
|
* The environment every driven command gets: the journey's HOME, CI=1, no
|
|
122
177
|
* update check, no colors and the shared caches. Variables that could leak
|
|
123
|
-
* the operator's own settings
|
|
178
|
+
* the operator's own settings or the lease's dev stack into the run are
|
|
179
|
+
* dropped; npm and pnpm settings in any case, since both also read their upper and lowercase spellings. `NPM_TOKEN` and other uppercase variables a `.npmrc` interpolates are kept. The config `env` can set any of them back on purpose.
|
|
124
180
|
*/
|
|
125
181
|
function isolatedEnv(workspace, home, extra = {}) {
|
|
126
|
-
const kept = Object.entries(
|
|
182
|
+
const kept = Object.entries(operatorEnv()).filter(([key]) => !INHERITED_PREFIXES.some((prefix) => key.startsWith(prefix)) && !/^p?npm_config_/i.test(key));
|
|
127
183
|
return {
|
|
128
184
|
...Object.fromEntries(kept),
|
|
129
185
|
HOME: home,
|
|
@@ -142,6 +198,20 @@ function isolatedEnv(workspace, home, extra = {}) {
|
|
|
142
198
|
...extra
|
|
143
199
|
};
|
|
144
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* `path` with the repository's `node_modules/.bin` first, as `pnpm exec`
|
|
203
|
+
* puts it, so setup commands, journeys and formal checks find the
|
|
204
|
+
* repository's own bins whether the CLI was started through `pnpm exec` or
|
|
205
|
+
* through `node_modules/.bin/antelopejs-verify`. A `path` that already lists
|
|
206
|
+
* that folder, as `pnpm exec` from a package of a workspace does after the
|
|
207
|
+
* package's own, is kept as it is, and so is an unset or empty one, which
|
|
208
|
+
* leaves children the system's default search path.
|
|
209
|
+
*/
|
|
210
|
+
function withLocalBins(root, path) {
|
|
211
|
+
if (!path) return path;
|
|
212
|
+
const bins = resolve(root, "node_modules", ".bin");
|
|
213
|
+
return path.split(delimiter).some((entry) => entry !== "" && resolve(root, entry) === bins) ? path : `${bins}${delimiter}${path}`;
|
|
214
|
+
}
|
|
145
215
|
//#endregion
|
|
146
216
|
//#region src/verify/map.ts
|
|
147
217
|
/** The feature that always runs, whatever the diff touches. */
|
|
@@ -180,10 +250,14 @@ const SHARED_BY_ALL = [
|
|
|
180
250
|
"tsconfig.*.json",
|
|
181
251
|
"antelope-lock/**"
|
|
182
252
|
];
|
|
183
|
-
/** The files whose change can break any feature, so a diff touching one runs them all. */
|
|
253
|
+
/** The files whose change can break any feature, so a diff touching one runs them all. A module declares its interfaces under `src/interfaces/` or, with a single one, `src/interface/`. */
|
|
184
254
|
const DEFAULT_SHARED = {
|
|
185
255
|
interface: SHARED_BY_ALL,
|
|
186
|
-
module: [
|
|
256
|
+
module: [
|
|
257
|
+
...SHARED_BY_ALL,
|
|
258
|
+
"src/interfaces/**",
|
|
259
|
+
"src/interface/**"
|
|
260
|
+
],
|
|
187
261
|
template: [
|
|
188
262
|
...SHARED_BY_ALL,
|
|
189
263
|
"antelope.config.*",
|
|
@@ -338,4 +412,4 @@ function planFor(workspace, baseRef, all = false) {
|
|
|
338
412
|
};
|
|
339
413
|
}
|
|
340
414
|
//#endregion
|
|
341
|
-
export { readFeatures as a, allocateRun as c, loadRun as d, openWorkspace as f, planFor as i, git as l,
|
|
415
|
+
export { withLocalBins as _, readFeatures as a, allocateRun as c, loadRun as d, openWorkspace as f, saveRun as g, removeTree as h, planFor as i, git as l, operatorTmpdir as m, SMOKE_FEATURE as n, CACHE_DIR as o, operatorEnv as p, checkMap as r, RUNS_DIR as s, DEFAULT_SHARED as t, isolatedEnv as u };
|
package/dist/verify/index.d.mts
CHANGED
|
@@ -39,6 +39,7 @@ interface FormalCheck {
|
|
|
39
39
|
files?: string[];
|
|
40
40
|
/** Runs from the repository root; exits 0 while every finding breaks as recorded. */
|
|
41
41
|
command: string[];
|
|
42
|
+
/** The first capture group names a rule the output reports as broken, and an optional group named `states`, after it, gives its counterexample length in decimal digits; a `states` group that is the first group, that captures anything but digits, or whose number is above `Number.MAX_SAFE_INTEGER` gives no length; a covered behaviour change keeps the base's findings as known only when every one has the same length at HEAD as on the base. Without `violation`, a non-zero exit is the one rule `property` broken. */
|
|
42
43
|
violation: RegExp | null;
|
|
43
44
|
/** The first capture group names a rule the output reports as holding; a base finding counts as fixed only when HEAD reports it so. Without `passing` and `violation`, a zero exit is the one rule `property` holding. */
|
|
44
45
|
passing?: RegExp | null;
|
|
@@ -174,7 +175,10 @@ interface JourneyContext {
|
|
|
174
175
|
service(name: string): ServiceEndpoint;
|
|
175
176
|
/** Runs a command inside a service's container: the read-back through the native client. */
|
|
176
177
|
native(name: string, service: string, args: string[]): Promise<CommandResult>;
|
|
177
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Writes the fixture project of the interface or module kind and returns its folder. Each call writes a fresh project, so a journey can hold several.
|
|
180
|
+
* The project's `.antelope/cache` starts as a copy of a cache of registry modules an earlier passing journey of the run left exactly as a fresh `ajs` install leaves it, none installed from a lock record, so `ajs` installs a registry module once per run.
|
|
181
|
+
*/
|
|
178
182
|
fixture(options?: {
|
|
179
183
|
moduleConfig?: JsonObject;
|
|
180
184
|
}): string;
|
|
@@ -183,8 +187,38 @@ interface JourneyContext {
|
|
|
183
187
|
call(name: string, app: App, request: CallRequest): Promise<CallResult>;
|
|
184
188
|
/** Stops an app with SIGINT by recorded PID. */
|
|
185
189
|
stop(name: string, app: App): Promise<StopResult>;
|
|
186
|
-
/**
|
|
190
|
+
/**
|
|
191
|
+
* Creates a project from the template under verification with `ajs project init`.
|
|
192
|
+
* Once init succeeds, the project's `.antelope/cache` starts as a copy of a cache of registry modules an earlier passing journey of the run left exactly as a fresh `ajs` install leaves it, none installed from a lock record.
|
|
193
|
+
*/
|
|
187
194
|
scaffold(name: string, project: string, flags?: string[]): Promise<CommandResult>;
|
|
195
|
+
/**
|
|
196
|
+
* Builds a folder once per run and gives every journey its own copy, for
|
|
197
|
+
* the preparation many journeys repeat, such as a scaffolded and installed
|
|
198
|
+
* project. Returns `<work>/<key>`. The first journey of the run that asks
|
|
199
|
+
* for `key` runs `build` on that empty folder with its usual recorded
|
|
200
|
+
* steps, after a step `prepared <key>` that marks them as the build and says
|
|
201
|
+
* whether the run kept it. The run keeps a copy of the folder and of the
|
|
202
|
+
* build's step evidence only when `build` returns, recorded at least one
|
|
203
|
+
* check, passed every check, and left nothing in the folder but files,
|
|
204
|
+
* directories and symlinks. A later journey of the run, in this `journey`
|
|
205
|
+
* command or a later one, gets a fresh copy of the kept folder and one
|
|
206
|
+
* step, `prepared <key>`, that names the journey that built it and holds
|
|
207
|
+
* that build's evidence under `build/`. A build that is not kept is built
|
|
208
|
+
* again by the next journey. Rerunning the journey that built builds again.
|
|
209
|
+
* In a copy, an absolute symlink into the built folder points to the same
|
|
210
|
+
* path in the copy; every other symlink keeps its target. `build` writes
|
|
211
|
+
* only inside the folder it is given: what it writes elsewhere, such as a
|
|
212
|
+
* sibling in the journey's work folder or the repository, stays with the
|
|
213
|
+
* journey that built. Two journeys that ask for the same key at once, in
|
|
214
|
+
* concurrent `journey` commands, both build, and the first to finish is
|
|
215
|
+
* kept. The commands `build` runs get a HOME of their own, deleted when
|
|
216
|
+
* `build` ends, so what they write there (`ajs config set git`, caches) is
|
|
217
|
+
* never kept and every journey continues with its own HOME. Every journey
|
|
218
|
+
* passes the same `build` for a key. `key` is lowercase letters and digits
|
|
219
|
+
* joined by dashes. `clean` deletes what the run kept.
|
|
220
|
+
*/
|
|
221
|
+
prepared(key: string, build: (folder: string) => Promise<void>): Promise<string>;
|
|
188
222
|
}
|
|
189
223
|
/** A repo-owned journey of `verify.config.ts`, named by id in a feature file. */
|
|
190
224
|
interface Journey {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/tooling-configs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and an interface range check",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"lint:fix": "oxlint --fix",
|
|
62
62
|
"format": "oxfmt .",
|
|
63
63
|
"prepack": "pnpm run build",
|
|
64
|
-
"release": "pnpm run lint && pnpm run prepack && release-it",
|
|
64
|
+
"release": "pnpm run lint && pnpm run typecheck && pnpm run prepack && release-it",
|
|
65
65
|
"typecheck": "tsc --noEmit",
|
|
66
66
|
"test": "node --test \"src/**/*.test.ts\"",
|
|
67
67
|
"checks": "node src/bin/checks.ts",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@nuxt/eslint-config": "^1.17.0",
|
|
88
88
|
"@types/node": "^24.13.3",
|
|
89
|
+
"@types/semver": "^7.8.0",
|
|
89
90
|
"eslint-plugin-perfectionist": "^5.11.0",
|
|
90
91
|
"knip": "^6.34.0",
|
|
91
92
|
"lefthook": "^2.2.2",
|