@theholocron/astromech 5.0.0-alpha.13 → 5.0.0-alpha.134
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 +57 -31
- package/dist/config/index.d.mts +21 -2
- package/dist/config/index.mjs +3 -25
- package/dist/index.d.mts +335 -336
- package/dist/index.mjs +2004 -1400
- package/dist/load-ytspboBj.mjs +50 -0
- package/dist/{schema-D01VYg43.d.mts → schema-BDld3xq1.d.mts} +5 -5
- package/package.json +8 -8
- package/dist/schema-Cf5dfaDO.mjs +0 -11
|
@@ -0,0 +1,50 @@
|
|
|
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 };
|
|
@@ -12,7 +12,7 @@ interface TaskEntry {
|
|
|
12
12
|
name: string;
|
|
13
13
|
/**
|
|
14
14
|
* Emit a `.github/workflows/<name>.yml` thin caller and include the task
|
|
15
|
-
* in `holocron ci`. Default `true`.
|
|
15
|
+
* in `holocron run ci`. Default `true`.
|
|
16
16
|
*/
|
|
17
17
|
ci?: boolean;
|
|
18
18
|
/**
|
|
@@ -24,7 +24,7 @@ interface TaskEntry {
|
|
|
24
24
|
/**
|
|
25
25
|
* The task's CI check context (from `WORKFLOW_CHECK_CONTEXTS`) is a
|
|
26
26
|
* required status check in branch protection (`astromech.requiredChecks()`)
|
|
27
|
-
* and part of `holocron ci`'s default run.
|
|
27
|
+
* and part of `holocron run ci`'s default run.
|
|
28
28
|
*/
|
|
29
29
|
required?: boolean;
|
|
30
30
|
/** Per-repo overrides on the same channel the reusable workflow reads. */
|
|
@@ -58,12 +58,12 @@ interface TasksConfig {
|
|
|
58
58
|
/**
|
|
59
59
|
* Required status-check contexts not backed by a task — codecov gates,
|
|
60
60
|
* a bundle-build check, … Appended to `astromech.requiredChecks()` after the
|
|
61
|
-
* `required`-task contexts. (`DCO` is prepended by `holocron setup` itself.)
|
|
61
|
+
* `required`-task contexts. (`DCO` is prepended by `holocron repo setup` itself.)
|
|
62
62
|
*/
|
|
63
63
|
extraRequiredChecks?: string[];
|
|
64
64
|
/**
|
|
65
|
-
* Git hooks `holocron setup` installs. `true` / `{ prePush: true }` writes
|
|
66
|
-
* `.husky/pre-push` (runs `holocron ci`); `false` / `{ prePush: false }`
|
|
65
|
+
* Git hooks `holocron repo setup` installs. `true` / `{ prePush: true }` writes
|
|
66
|
+
* `.husky/pre-push` (runs `holocron run ci`); `false` / `{ prePush: false }`
|
|
67
67
|
* opts out. Omitted → on for `protection: "strict"` repos, off otherwise.
|
|
68
68
|
* When enabled, `packageScripts()` also emits `prepare: "husky"`.
|
|
69
69
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/astromech",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
4
|
-
"description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron ci`, the CI workflows, package.json scripts, linters, and required checks.",
|
|
3
|
+
"version": "5.0.0-alpha.134",
|
|
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",
|
|
7
7
|
"holocron",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@theholocron/datapad": "5.0.0-alpha.
|
|
40
|
+
"@theholocron/datapad": "5.0.0-alpha.134"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@theholocron/eslint-config": "^8.
|
|
44
|
-
"@theholocron/tsconfig": "^8.
|
|
45
|
-
"@theholocron/tsdown-config": "^8.
|
|
46
|
-
"@theholocron/vitest-config": "^8.
|
|
43
|
+
"@theholocron/eslint-config": "^8.7.1",
|
|
44
|
+
"@theholocron/tsconfig": "^8.7.1",
|
|
45
|
+
"@theholocron/tsdown-config": "^8.7.1",
|
|
46
|
+
"@theholocron/vitest-config": "^8.7.0",
|
|
47
47
|
"@types/node": "^26",
|
|
48
48
|
"@vitest/coverage-v8": "^4.1.11",
|
|
49
49
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"tsdown": "^0.22.14",
|
|
54
54
|
"typescript": "^5.9.3",
|
|
55
55
|
"vitest": "^4.1.11",
|
|
56
|
-
"@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.
|
|
56
|
+
"@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.134"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=22"
|
package/dist/schema-Cf5dfaDO.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/config/schema.ts
|
|
2
|
-
/** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
|
|
3
|
-
function normalizeTaskEntry(item) {
|
|
4
|
-
return {
|
|
5
|
-
ci: true,
|
|
6
|
-
local: true,
|
|
7
|
-
...typeof item === "string" ? { name: item } : item
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { normalizeTaskEntry as t };
|