@theholocron/astromech 5.0.0-alpha.12 → 5.0.0-alpha.121

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.
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/astromech",
3
- "version": "5.0.0-alpha.12",
3
+ "version": "5.0.0-alpha.121",
4
4
  "description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron ci`, the CI workflows, package.json scripts, linters, and required checks.",
5
5
  "keywords": [
6
6
  "ci",
@@ -37,13 +37,13 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@theholocron/datapad": "5.0.0-alpha.12"
40
+ "@theholocron/datapad": "5.0.0-alpha.121"
41
41
  },
42
42
  "devDependencies": {
43
- "@theholocron/eslint-config": "^8.0.0",
44
- "@theholocron/tsconfig": "^8.0.0",
45
- "@theholocron/tsdown-config": "^8.0.0",
46
- "@theholocron/vitest-config": "^8.0.0",
43
+ "@theholocron/eslint-config": "^8.7.0",
44
+ "@theholocron/tsconfig": "^8.7.0",
45
+ "@theholocron/tsdown-config": "^8.7.0",
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.12"
56
+ "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.121"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=22"
@@ -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 };