@theholocron/astromech 5.0.0-alpha.149 → 5.0.0-alpha.150

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 +31 -49
  2. package/package.json +6 -6
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { r as normalizeTaskEntry, t as loadTasksConfig } from "./load-ToVjaKPr.mjs";
2
2
  import { existsSync, readFileSync, readdirSync } from "node:fs";
3
- import { join, relative } from "node:path";
3
+ import { dependencyNames, detectPackageManager, listWorkspacePackagesSync, readPackageJsonSync } from "@theholocron/pkg-utils";
4
4
  import { stringifyJson } from "@theholocron/json-utils";
5
- import { dependencyNames, detectPackageManager, readPackageJsonSync } from "@theholocron/pkg-utils";
5
+ import { join, relative } from "node:path";
6
6
  import { spawnSync } from "node:child_process";
7
7
  import { findExecutableSync } from "@theholocron/fs-utils";
8
8
  //#region src/templates/codecov/codecov.yml
@@ -75,24 +75,6 @@ function mergeCodecovComponents(existing, packages) {
75
75
  if (idx === -1) return ensureIfNotFound(existing);
76
76
  return ensureIfNotFound(existing.slice(0, idx + 24)) + codecovComponentBlock(packages);
77
77
  }
78
- function readWorkspaceDir(repoRoot, dir) {
79
- const dirPath = join(repoRoot, dir);
80
- if (!existsSync(dirPath)) return [];
81
- const packages = [];
82
- for (const entry of readdirSync(dirPath, { withFileTypes: true })) {
83
- if (!entry.isDirectory()) continue;
84
- try {
85
- const raw = readFileSync(join(dirPath, entry.name, "package.json"), "utf8");
86
- const pkg = JSON.parse(raw);
87
- if (typeof pkg.name === "string") packages.push({
88
- slug: entry.name,
89
- name: pkg.name,
90
- dir
91
- });
92
- } catch {}
93
- }
94
- return packages;
95
- }
96
78
  /**
97
79
  * Every public `packages/*`, `apps/*`, and `plugins/*` workspace, sorted by
98
80
  * slug. `[]` when none of the three directories exist. Monorepo templates
@@ -102,11 +84,18 @@ function readWorkspaceDir(repoRoot, dir) {
102
84
  * component so `codecov/patch/<slug>` actually posts for each.
103
85
  */
104
86
  function readWorkspacePackages(repoRoot) {
105
- return [
106
- ...readWorkspaceDir(repoRoot, "packages"),
107
- ...readWorkspaceDir(repoRoot, "apps"),
108
- ...readWorkspaceDir(repoRoot, "plugins")
109
- ].sort((a, b) => a.slug.localeCompare(b.slug));
87
+ return listWorkspacePackagesSync(repoRoot, { roots: [
88
+ "packages",
89
+ "apps",
90
+ "plugins"
91
+ ] }).flatMap(({ name, relativeDir }) => {
92
+ const [dir, slug] = relativeDir.split("/");
93
+ return name ? [{
94
+ slug,
95
+ name,
96
+ dir
97
+ }] : [];
98
+ }).sort((a, b) => a.slug.localeCompare(b.slug));
110
99
  }
111
100
  /** A brand-new `codecov.yml` — the scaffold header + the base template + this repo's component list. */
112
101
  function createCodecovConfig(packages) {
@@ -2194,35 +2183,28 @@ async function waitForPublished({ packages, run, sleep, now, cwd, timeoutMs = WA
2194
2183
  }
2195
2184
  //#endregion
2196
2185
  //#region src/tasks/deploy-on-release/workspace-packages.ts
2197
- function scanWorkspaceDir(dirPath, { readJson, listDirs }) {
2198
- let folders;
2199
- try {
2200
- folders = listDirs(dirPath);
2201
- } catch {
2202
- return [];
2203
- }
2204
- return folders.flatMap((folder) => {
2205
- try {
2206
- const manifest = readJson(join(dirPath, folder, "package.json"));
2207
- if (!manifest.name) return [];
2208
- return [{
2209
- name: manifest.name,
2210
- dir: join(dirPath, folder),
2211
- version: manifest.version,
2212
- dependencies: manifest.dependencies ?? {}
2213
- }];
2214
- } catch {
2215
- return [];
2216
- }
2217
- });
2218
- }
2219
2186
  /**
2220
2187
  * Every package under `<repoRoot>/packages/*` and `<repoRoot>/plugins/*`
2221
2188
  * with a readable, named `package.json` — `holocron`'s own layout splits
2222
2189
  * vendor plugin packages into `plugins/*`, sibling to `packages/*`.
2223
2190
  */
2224
- function workspacePackages(repoRoot, tree) {
2225
- return [...scanWorkspaceDir(join(repoRoot, "packages"), tree), ...scanWorkspaceDir(join(repoRoot, "plugins"), tree)];
2191
+ function workspacePackages(repoRoot, { readJson, listDirs }) {
2192
+ return listWorkspacePackagesSync(repoRoot, {
2193
+ roots: ["packages", "plugins"],
2194
+ readFile: (path) => JSON.stringify(readJson(path)),
2195
+ listDirs: (path) => {
2196
+ try {
2197
+ return listDirs(path);
2198
+ } catch {
2199
+ throw Object.assign(/* @__PURE__ */ new Error(`ENOENT: ${path}`), { code: "ENOENT" });
2200
+ }
2201
+ }
2202
+ }).flatMap(({ name, dir, manifest }) => name ? [{
2203
+ name,
2204
+ dir,
2205
+ version: manifest.version,
2206
+ dependencies: manifest.dependencies ?? {}
2207
+ }] : []);
2226
2208
  }
2227
2209
  //#endregion
2228
2210
  //#region src/tasks/deploy-on-release/deploy-on-release.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/astromech",
3
- "version": "5.0.0-alpha.149",
3
+ "version": "5.0.0-alpha.150",
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,10 +37,10 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
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"
40
+ "@theholocron/fs-utils": "^1.13.0",
41
+ "@theholocron/json-utils": "^1.13.0",
42
+ "@theholocron/pkg-utils": "^1.13.0",
43
+ "@theholocron/datapad": "5.0.0-alpha.150"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@theholocron/eslint-config": "^8.7.1",
@@ -56,7 +56,7 @@
56
56
  "tsdown": "^0.22.14",
57
57
  "typescript": "^5.9.3",
58
58
  "vitest": "^4.1.11",
59
- "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.149"
59
+ "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.150"
60
60
  },
61
61
  "engines": {
62
62
  "node": ">=22"