@theholocron/astromech 5.0.0-alpha.280 → 5.0.0-alpha.281

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.
Files changed (2) hide show
  1. package/dist/index.mjs +32 -9
  2. package/package.json +11 -11
package/dist/index.mjs CHANGED
@@ -7,6 +7,29 @@ import { stringifyJson } from "@theholocron/json-utils";
7
7
  import { spawnSync } from "node:child_process";
8
8
  import { join, relative } from "node:path";
9
9
  import { findExecutableSync } from "@theholocron/fs-utils";
10
+ /**
11
+ * Where generated workflows call the hosted files today. No change from the templates' own spelling until the files
12
+ * move (#1475, #1480); the target is `theholocron/holocron/.github/workflows` and `theholocron/holocron/ci/actions` at
13
+ * `ci-v1`.
14
+ */
15
+ const CI_HOME = {
16
+ workflows: "theholocron/.github/.github/workflows",
17
+ actions: "theholocron/.github/.github/actions",
18
+ ref: "main"
19
+ };
20
+ const REFERENCE = /theholocron\/\.github\/\.github\/(workflows|actions)\/([\w.-]+)@main/g;
21
+ /** `text` with every hosted-workflow and hosted-action reference moved from the templates' spelling to `home`. */
22
+ function rehome(text, home = CI_HOME) {
23
+ return text.replace(REFERENCE, (_all, kind, name) => `${home[kind]}/${name}@${home.ref}`);
24
+ }
25
+ /** {@link rehome} applied to every value of a map of templates. */
26
+ function rehomeAll(templates, home = CI_HOME) {
27
+ return Object.fromEntries(Object.entries(templates).map(([name, text]) => [name, rehome(text, home)]));
28
+ }
29
+ /** A `uses:` value for a hosted reusable workflow, for generated YAML that is not written in a template. */
30
+ function reusableWorkflowRef(file, home = CI_HOME) {
31
+ return `${home.workflows}/${file}@${home.ref}`;
32
+ }
10
33
  // src/templates/codecov/codecov.yml
11
34
  var codecov_default = "codecov:\n require_ci_to_pass: true\n\ncoverage:\n precision: 2\n round: down\n status:\n project:\n default:\n target: auto\n threshold: 2%\n # Infra-only PRs (dep bumps, config, lockfile) touch no coverable code,\n # so codecov produces no report to compare. Pass instead of blocking\n # forever on a required check that will never post.\n if_not_found: success\n patch:\n default:\n target: 80%\n if_not_found: success\n\ncomment:\n layout: \"reach,diff,flags\"\n behavior: default\n require_changes: true\n\ncomponent_management:\n default_rules:\n statuses:\n - type: patch\n target: 80%\n if_not_found: success\n informational: true\n individual_components:\n";
12
35
  // src/generators/codecov/codecov.ts
@@ -579,7 +602,7 @@ function groupedPublishCaller(base, groups, shared, ungrouped = false) {
579
602
  })
580
603
  ];
581
604
  const matrixJson = JSON.stringify(entries).replaceAll("'", "''");
582
- const uses = " uses: theholocron/.github/.github/workflows/delivery.publish.yml@main";
605
+ const uses = ` uses: ${reusableWorkflowRef("delivery.publish.yml")}`;
583
606
  const ungroupedJob = ungroupedInputs ? [
584
607
  " release:",
585
608
  " name: Release",
@@ -648,7 +671,7 @@ function groupedPublishCaller(base, groups, shared, ungrouped = false) {
648
671
  * into the thin caller `holocron repo setup` / `holocron repo sync` write locally.
649
672
  */
650
673
  /** The reusable-workflow thin-caller templates, by task name. */
651
- const WORKFLOW_TEMPLATES = {
674
+ const WORKFLOW_TEMPLATES = rehomeAll({
652
675
  "verification.unitTests": verification_unitTests_default,
653
676
  "verification.visualRegression": verification_visualRegression_default,
654
677
  "verification.typeSafety": verification_typeSafety_default,
@@ -678,7 +701,7 @@ const WORKFLOW_TEMPLATES = {
678
701
  greetings: greetings_default,
679
702
  dependencies: dependencies_default,
680
703
  bookkeeping: bookkeeping_default
681
- };
704
+ });
682
705
  /** The task names that have a thin-caller workflow template. */
683
706
  const KNOWN_WORKFLOWS = new Set(Object.keys(WORKFLOW_TEMPLATES));
684
707
  /**
@@ -888,14 +911,14 @@ function generateCombinedDeployContent(deployWith, paths, preview) {
888
911
  ` deploy:`,
889
912
  ` name: Deploy`,
890
913
  ` if: \${{ github.event_name != 'pull_request' }}`,
891
- ` uses: theholocron/.github/.github/workflows/delivery.deploy.yml@main`,
914
+ ` uses: ${reusableWorkflowRef("delivery.deploy.yml")}`,
892
915
  ...deployWithBlock ? [deployWithBlock.trimEnd()] : [],
893
916
  ` secrets: inherit`,
894
917
  ``,
895
918
  ` preview:`,
896
919
  ` name: Preview`,
897
920
  ` if: \${{ github.event_name == 'pull_request' }}`,
898
- ` uses: theholocron/.github/.github/workflows/preview.yml@main`,
921
+ ` uses: ${reusableWorkflowRef("preview.yml")}`,
899
922
  previewWithBlock.trimEnd(),
900
923
  ` secrets: inherit`,
901
924
  ``
@@ -977,7 +1000,7 @@ function deriveDeployPaths(raw) {
977
1000
  * the *thin-caller bases* written into each consumer repo's `.github/workflows/`.
978
1001
  */
979
1002
  /** `workflow_call` implementations → `.github/workflows/<name>.yml`. */
980
- const REUSABLE_WORKFLOWS = {
1003
+ const REUSABLE_WORKFLOWS = rehomeAll({
981
1004
  "verification.unitTests": verification_unitTests_default$1,
982
1005
  "verification.visualRegression": verification_visualRegression_default$1,
983
1006
  "verification.typeSafety": verification_typeSafety_default$1,
@@ -1011,9 +1034,9 @@ const REUSABLE_WORKFLOWS = {
1011
1034
  "sync-dispatch": sync_dispatch_default,
1012
1035
  tag: tag_default,
1013
1036
  "sync-github": sync_github_default
1014
- };
1037
+ });
1015
1038
  /** Composite actions → `.github/actions/<name>/action.yml` (key includes `/action`). */
1016
- const REUSABLE_ACTIONS = {
1039
+ const REUSABLE_ACTIONS = rehomeAll({
1017
1040
  "auto-commit/action": auto_commit_default,
1018
1041
  "codecov-upload/action": codecov_upload_default,
1019
1042
  "holocron/action": holocron_default,
@@ -1021,7 +1044,7 @@ const REUSABLE_ACTIONS = {
1021
1044
  "notify/action": notify_default,
1022
1045
  "setup/action": setup_default,
1023
1046
  "setup-node/action": setup_node_default
1024
- };
1047
+ });
1025
1048
  /** GitHub starter-workflow metadata → `workflow-templates/<name>.properties.json`. */
1026
1049
  const WORKFLOW_TEMPLATE_PROPERTIES = { bookkeeping: JSON.stringify({
1027
1050
  name: "Bookkeeping",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/astromech",
3
- "version": "5.0.0-alpha.280",
3
+ "version": "5.0.0-alpha.281",
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",
@@ -50,10 +50,10 @@
50
50
  "@commitlint/lint": "^21.2.3",
51
51
  "@commitlint/load": "^21.2.3",
52
52
  "@commitlint/types": "^21.2.3",
53
- "@theholocron/fs-utils": "^1.16.1-alpha.3",
53
+ "@theholocron/datapad": "5.0.0-alpha.281",
54
54
  "@theholocron/json-utils": "^1.16.1-alpha.3",
55
- "@theholocron/datapad": "5.0.0-alpha.280",
56
- "@theholocron/pkg-utils": "^1.16.1-alpha.3"
55
+ "@theholocron/pkg-utils": "^1.16.1-alpha.3",
56
+ "@theholocron/fs-utils": "^1.16.1-alpha.3"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@commitlint/config-conventional": "^21.2.3",
@@ -69,13 +69,13 @@
69
69
  "tsdown": "^0.23.3",
70
70
  "typescript": "^5.9.3",
71
71
  "vitest": "^5.0.5",
72
- "@theholocron/commitlint-config": "^8.9.0-alpha.4",
73
- "@theholocron/eslint-config": "^8.9.0-alpha.4",
74
- "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.4",
75
- "@theholocron/semantic-release-config": "^8.9.0-alpha.4",
76
- "@theholocron/tsconfig": "^8.9.0-alpha.4",
77
- "@theholocron/tsdown-config": "^8.9.0-alpha.4",
78
- "@theholocron/vitest-config": "^8.9.0-alpha.4"
72
+ "@theholocron/commitlint-config": "^8.9.0-alpha.5",
73
+ "@theholocron/eslint-config": "^8.9.0-alpha.5",
74
+ "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.5",
75
+ "@theholocron/tsconfig": "^8.9.0-alpha.5",
76
+ "@theholocron/semantic-release-config": "^8.9.0-alpha.5",
77
+ "@theholocron/tsdown-config": "^8.9.0-alpha.5",
78
+ "@theholocron/vitest-config": "^8.9.0-alpha.5"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "@semantic-release/commit-analyzer": "^13",