@theholocron/astromech 4.18.2 → 4.18.3

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 CHANGED
@@ -126,14 +126,18 @@ only.
126
126
  ### `codecov.yml`
127
127
 
128
128
  `codecovConfig(existing)` generates this repo's `codecov.yml` — component
129
- `paths` derived from `packages/*`, same manifest-derived category as
130
- `thinCallers()`. Pass the current file's content (or `null`) and it either
131
- merges the `individual_components` list in (preserving everything else in the
132
- file — thresholds, flags, custom rules) or scaffolds a fresh file from the
133
- base template. `holocron setup` writes the result via the `source` capability;
134
- this method never touches the filesystem beyond reading `packages/*` under
135
- `cwd`. Moved here from `@theholocron/cli` (#650) — the coverage setup tracks
136
- the `test` task, the same way required checks track `tasks`.
129
+ `paths` derived from `packages/*` **and** `apps/*` (monorepo templates ship
130
+ user-facing code under `apps/` alongside library code under `packages/`;
131
+ `readWorkspacePackages()` scans both and tags each result with the `dir` it
132
+ came from), same manifest-derived category as `thinCallers()`. Pass the
133
+ current file's content (or `null`) and it either merges the
134
+ `individual_components` list in (preserving everything else in the file —
135
+ thresholds, flags, custom rules) or scaffolds a fresh file from the base
136
+ template. `holocron setup` writes the result via the `source` capability;
137
+ this method never touches the filesystem beyond reading `packages/*` and
138
+ `apps/*` under `cwd`. Moved here from `@theholocron/cli` (#650) — the
139
+ coverage setup tracks the `test` task, the same way required checks track
140
+ `tasks`.
137
141
 
138
142
  ## Lint parity
139
143
 
package/dist/index.d.mts CHANGED
@@ -385,6 +385,8 @@ declare function createAstromech(options: AstromechOptions): Astromech;
385
385
  interface WorkspacePackage {
386
386
  slug: string;
387
387
  name: string;
388
+ /** Which workspace root the package was discovered under. Defaults to `"packages"`. */
389
+ dir?: "packages" | "apps";
388
390
  }
389
391
  declare function codecovComponentBlock(packages: WorkspacePackage[]): string;
390
392
  /**
@@ -399,7 +401,13 @@ declare function codecovComponentBlock(packages: WorkspacePackage[]): string;
399
401
  */
400
402
  declare function ensureIfNotFound(yaml: string): string;
401
403
  declare function mergeCodecovComponents(existing: string, packages: WorkspacePackage[]): string;
402
- /** Every public `packages/*` workspace, sorted by slug. `[]` when there's no `packages/` dir. */
404
+ /**
405
+ * Every public `packages/*` and `apps/*` workspace, sorted by slug. `[]`
406
+ * when neither directory exists. Monorepo templates (Next.js, React, …)
407
+ * ship user-facing code under `apps/` alongside library code under
408
+ * `packages/` — both need a codecov component so `codecov/patch/<slug>`
409
+ * actually posts for each.
410
+ */
403
411
  declare function readWorkspacePackages(repoRoot: string): WorkspacePackage[];
404
412
  /** A brand-new `codecov.yml` — the scaffold header + the base template + this repo's component list. */
405
413
  declare function createCodecovConfig(packages: WorkspacePackage[]): string;
package/dist/index.mjs CHANGED
@@ -953,11 +953,11 @@ function scaffoldHeader() {
953
953
  }
954
954
  function codecovComponentBlock(packages) {
955
955
  if (packages.length === 0) return "\n []\n";
956
- return "\n" + packages.flatMap(({ slug }) => [
956
+ return "\n" + packages.flatMap(({ slug, dir }) => [
957
957
  ` - component_id: ${slug}`,
958
958
  ` name: "${slug}"`,
959
959
  ` paths:`,
960
- ` - packages/${slug}/**`,
960
+ ` - ${dir ?? "packages"}/${slug}/**`,
961
961
  ``
962
962
  ]).join("\n");
963
963
  }
@@ -1001,23 +1001,33 @@ function mergeCodecovComponents(existing, packages) {
1001
1001
  if (idx === -1) return ensureIfNotFound(existing);
1002
1002
  return ensureIfNotFound(existing.slice(0, idx + 24)) + codecovComponentBlock(packages);
1003
1003
  }
1004
- /** Every public `packages/*` workspace, sorted by slug. `[]` when there's no `packages/` dir. */
1005
- function readWorkspacePackages(repoRoot) {
1006
- const packagesDir = join(repoRoot, "packages");
1007
- if (!existsSync(packagesDir)) return [];
1004
+ function readWorkspaceDir(repoRoot, dir) {
1005
+ const dirPath = join(repoRoot, dir);
1006
+ if (!existsSync(dirPath)) return [];
1008
1007
  const packages = [];
1009
- for (const entry of readdirSync(packagesDir, { withFileTypes: true })) {
1008
+ for (const entry of readdirSync(dirPath, { withFileTypes: true })) {
1010
1009
  if (!entry.isDirectory()) continue;
1011
1010
  try {
1012
- const raw = readFileSync(join(packagesDir, entry.name, "package.json"), "utf8");
1011
+ const raw = readFileSync(join(dirPath, entry.name, "package.json"), "utf8");
1013
1012
  const pkg = JSON.parse(raw);
1014
1013
  if (typeof pkg.name === "string") packages.push({
1015
1014
  slug: entry.name,
1016
- name: pkg.name
1015
+ name: pkg.name,
1016
+ dir
1017
1017
  });
1018
1018
  } catch {}
1019
1019
  }
1020
- return packages.sort((a, b) => a.slug.localeCompare(b.slug));
1020
+ return packages;
1021
+ }
1022
+ /**
1023
+ * Every public `packages/*` and `apps/*` workspace, sorted by slug. `[]`
1024
+ * when neither directory exists. Monorepo templates (Next.js, React, …)
1025
+ * ship user-facing code under `apps/` alongside library code under
1026
+ * `packages/` — both need a codecov component so `codecov/patch/<slug>`
1027
+ * actually posts for each.
1028
+ */
1029
+ function readWorkspacePackages(repoRoot) {
1030
+ return [...readWorkspaceDir(repoRoot, "packages"), ...readWorkspaceDir(repoRoot, "apps")].sort((a, b) => a.slug.localeCompare(b.slug));
1021
1031
  }
1022
1032
  /** A brand-new `codecov.yml` — the scaffold header + the base template + this repo's component list. */
1023
1033
  function createCodecovConfig(packages) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/astromech",
3
- "version": "4.18.2",
3
+ "version": "4.18.3",
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,7 +37,7 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@theholocron/datapad": "4.18.2"
40
+ "@theholocron/datapad": "4.18.3"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@theholocron/eslint-config": "^8.0.0",
@@ -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": "4.18.2"
56
+ "@theholocron/rollup-plugin-transform-template": "4.18.3"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=22"