@theholocron/astromech 5.0.0-alpha.11 → 5.0.0-alpha.111

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,44 @@
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
+ async function loadTasksConfig(cwd) {
20
+ const dedicated = await loadConfigFile({
21
+ cwd,
22
+ name: "astromech"
23
+ });
24
+ return mergeTasksLayers((await loadConfigFile({
25
+ cwd,
26
+ name: "holocron"
27
+ }))?.config.tasks, dedicated?.config);
28
+ }
29
+ /**
30
+ * The merge step of {@link loadTasksConfig}, for callers that load the two
31
+ * sources some other way (Sentinel reads them from the GitHub API, not
32
+ * from disk, holocron#916): `holocron.config.*`'s `tasks` value first,
33
+ * then a dedicated `astromech.config.*`'s default export merged on top.
34
+ * Either may be `undefined` (source absent); returns `{}` when both are.
35
+ */
36
+ function mergeTasksLayers(parentTasks, dedicated) {
37
+ return [coerce(parentTasks), coerce(dedicated)].filter((layer) => layer !== void 0).reduce((acc, layer) => mergeConfig(acc, layer), {});
38
+ }
39
+ function coerce(value) {
40
+ if (value == null) return void 0;
41
+ return Array.isArray(value) ? { tasks: value } : value;
42
+ }
43
+ //#endregion
44
+ 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.11",
3
+ "version": "5.0.0-alpha.111",
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.11"
40
+ "@theholocron/datapad": "5.0.0-alpha.111"
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.6.0",
44
+ "@theholocron/tsconfig": "^8.4.5",
45
+ "@theholocron/tsdown-config": "^8.4.5",
46
+ "@theholocron/vitest-config": "^8.4.5",
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.11"
56
+ "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.111"
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 };