@theholocron/astromech 5.0.0-alpha.147 → 5.0.0-alpha.149
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/config/index.d.mts +32 -4
- package/dist/config/index.mjs +14 -2
- package/dist/index.d.mts +140 -201
- package/dist/index.mjs +295 -239
- package/dist/load-ToVjaKPr.mjs +55 -0
- package/dist/{schema-BDld3xq1.d.mts → schema.type-BUiSrwS5.d.mts} +2 -12
- package/package.json +6 -4
- package/dist/load-ytspboBj.mjs +0 -50
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { loadLayered } from "@theholocron/datapad";
|
|
2
|
+
//#region src/config/schema.ts
|
|
3
|
+
/**
|
|
4
|
+
* The `tasks` config shape — the single manifest of what a repo runs.
|
|
5
|
+
* Read from a dedicated `astromech.config.*` file or the `tasks` key of
|
|
6
|
+
* `holocron.config.*` (see {@link loadTasksConfig}).
|
|
7
|
+
*
|
|
8
|
+
* Runtime validation is the loader's job, not this type's — the type only
|
|
9
|
+
* describes what an author writes.
|
|
10
|
+
*/
|
|
11
|
+
/** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
|
|
12
|
+
function normalizeTaskEntry(item) {
|
|
13
|
+
return {
|
|
14
|
+
ci: true,
|
|
15
|
+
local: true,
|
|
16
|
+
...typeof item === "string" ? { name: item } : item
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/config/coerce-tasks.ts
|
|
21
|
+
/** A bare item array is shorthand for `{ tasks: [...] }`. */
|
|
22
|
+
function coerceTasks(value) {
|
|
23
|
+
if (value == null) return void 0;
|
|
24
|
+
return Array.isArray(value) ? { tasks: value } : value;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/config/load.ts
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the task manifest for a repo: the `tasks` key of
|
|
30
|
+
* `holocron.config.*`, then a dedicated `astromech.config.*` merged on
|
|
31
|
+
* top (dedicated wins; item arrays concatenate). Returns `{}` when
|
|
32
|
+
* neither source is present.
|
|
33
|
+
*
|
|
34
|
+
* `walkUp: true` — `holocron run`/`ci` are usable from any subdirectory of
|
|
35
|
+
* a repo, not only its exact root (datapad walks up to the nearest `.git`
|
|
36
|
+
* boundary; see `@theholocron/datapad`'s own doc comment).
|
|
37
|
+
*
|
|
38
|
+
* A caller that has already loaded `holocron.config.*` passes it as
|
|
39
|
+
* `options.holocron` so it is not found and loaded again.
|
|
40
|
+
*/
|
|
41
|
+
async function loadTasksConfig(cwd, options = {}) {
|
|
42
|
+
return (await loadLayered({
|
|
43
|
+
cwd,
|
|
44
|
+
name: "astromech",
|
|
45
|
+
walkUp: true,
|
|
46
|
+
fallback: {
|
|
47
|
+
file: "holocron",
|
|
48
|
+
key: "tasks",
|
|
49
|
+
preloaded: options.holocron
|
|
50
|
+
},
|
|
51
|
+
coerce: (raw) => coerceTasks(raw)
|
|
52
|
+
}))?.config ?? {};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { coerceTasks as n, normalizeTaskEntry as r, loadTasksConfig as t };
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
//#region src/config/schema.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* The `tasks` config shape — the single manifest of what a repo runs.
|
|
4
|
-
* Read from a dedicated `astromech.config.*` file or the `tasks` key of
|
|
5
|
-
* `holocron.config.*` (see {@link loadTasksConfig}).
|
|
6
|
-
*
|
|
7
|
-
* Runtime validation is the loader's job, not this type's — the type only
|
|
8
|
-
* describes what an author writes.
|
|
9
|
-
*/
|
|
1
|
+
//#region src/config/schema.type.d.ts
|
|
10
2
|
interface TaskEntry {
|
|
11
3
|
/** Registry task name — `verification.unitTests`, `sourceQuality.staticAnalysis`, `delivery.build`, … */
|
|
12
4
|
name: string;
|
|
@@ -71,7 +63,5 @@ interface TasksConfig {
|
|
|
71
63
|
prePush?: boolean;
|
|
72
64
|
};
|
|
73
65
|
}
|
|
74
|
-
/** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
|
|
75
|
-
declare function normalizeTaskEntry(item: TaskConfigItem): Required<Pick<TaskEntry, "name" | "ci" | "local">> & TaskEntry;
|
|
76
66
|
//#endregion
|
|
77
|
-
export {
|
|
67
|
+
export { TaskEntry as n, TasksConfig as r, TaskConfigItem as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/astromech",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.149",
|
|
4
4
|
"description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron run ci`, the CI workflows, package.json scripts, linters, and required checks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -37,8 +37,10 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@theholocron/
|
|
41
|
-
"@theholocron/
|
|
40
|
+
"@theholocron/fs-utils": "^1.12.0",
|
|
41
|
+
"@theholocron/json-utils": "^1.12.0",
|
|
42
|
+
"@theholocron/pkg-utils": "^1.12.0",
|
|
43
|
+
"@theholocron/datapad": "5.0.0-alpha.149"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@theholocron/eslint-config": "^8.7.1",
|
|
@@ -54,7 +56,7 @@
|
|
|
54
56
|
"tsdown": "^0.22.14",
|
|
55
57
|
"typescript": "^5.9.3",
|
|
56
58
|
"vitest": "^4.1.11",
|
|
57
|
-
"@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.
|
|
59
|
+
"@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.149"
|
|
58
60
|
},
|
|
59
61
|
"engines": {
|
|
60
62
|
"node": ">=22"
|
package/dist/load-ytspboBj.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { loadConfigFile, mergeConfig } from "@theholocron/datapad";
|
|
2
|
-
//#region src/config/schema.ts
|
|
3
|
-
/** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
|
|
4
|
-
function normalizeTaskEntry(item) {
|
|
5
|
-
return {
|
|
6
|
-
ci: true,
|
|
7
|
-
local: true,
|
|
8
|
-
...typeof item === "string" ? { name: item } : item
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/config/load.ts
|
|
13
|
-
/**
|
|
14
|
-
* Resolve the task manifest for a repo: the `tasks` key of
|
|
15
|
-
* `holocron.config.*`, then a dedicated `astromech.config.*` merged on
|
|
16
|
-
* top (dedicated wins; item arrays concatenate). Returns `{}` when
|
|
17
|
-
* neither source is present.
|
|
18
|
-
*
|
|
19
|
-
* `walkUp: true` — `holocron run`/`ci` are usable from any subdirectory of
|
|
20
|
-
* a repo, not only its exact root (datapad walks up to the nearest `.git`
|
|
21
|
-
* boundary; see `@theholocron/datapad`'s own doc comment).
|
|
22
|
-
*/
|
|
23
|
-
async function loadTasksConfig(cwd) {
|
|
24
|
-
const dedicated = await loadConfigFile({
|
|
25
|
-
cwd,
|
|
26
|
-
name: "astromech",
|
|
27
|
-
walkUp: true
|
|
28
|
-
});
|
|
29
|
-
return mergeTasksLayers((await loadConfigFile({
|
|
30
|
-
cwd,
|
|
31
|
-
name: "holocron",
|
|
32
|
-
walkUp: true
|
|
33
|
-
}))?.config.tasks, dedicated?.config);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The merge step of {@link loadTasksConfig}, for callers that load the two
|
|
37
|
-
* sources some other way (Sentinel reads them from the GitHub API, not
|
|
38
|
-
* from disk, holocron#916): `holocron.config.*`'s `tasks` value first,
|
|
39
|
-
* then a dedicated `astromech.config.*`'s default export merged on top.
|
|
40
|
-
* Either may be `undefined` (source absent); returns `{}` when both are.
|
|
41
|
-
*/
|
|
42
|
-
function mergeTasksLayers(parentTasks, dedicated) {
|
|
43
|
-
return [coerce(parentTasks), coerce(dedicated)].filter((layer) => layer !== void 0).reduce((acc, layer) => mergeConfig(acc, layer), {});
|
|
44
|
-
}
|
|
45
|
-
function coerce(value) {
|
|
46
|
-
if (value == null) return void 0;
|
|
47
|
-
return Array.isArray(value) ? { tasks: value } : value;
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
export { mergeTasksLayers as n, normalizeTaskEntry as r, loadTasksConfig as t };
|