Skip to content

Commit c3223c4

Browse files
spearwolfclaude
andcommitted
build: renew toolchain (turbo + biome + vitest 4 + esbuild + tsc 6)
Replace nx 19 with turborepo 2.9, eslint+prettier with biome 2.4, @web/test-runner with vitest 4 (browser mode + Playwright provider), and unify shadow-objects build into a single build.mjs (esbuild transpile + tsc emit-only declarations + esbuild inline-worker bundle). Introduce pnpm catalog: as version single-source-of-truth across all workspace packages. Bump TypeScript to 6, esbuild to 0.28, Playwright to 1.59, happy-dom to 20. Bump shadow-objects to 0.31.0-dev. dist/ of @spearwolf/shadow-objects stays byte-compatible (file list + dist/package.json identical to prior release). Side-effect: the ./bundle.js export now actually contains the bundled worker and element registrations — previous releases shipped a 790-byte stub because src-side sideEffects markers no longer matched the new entry path. Verification snapshots and the design doc live under docs/superpowers/specs/. Full clean+build+test cycle: ~7.6s cold, ~70ms warm (FULL TURBO). See CHANGELOG.md (root) for build-system details and packages/shadow-objects/CHANGELOG.md for the package-level [Unreleased] entry. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0b01124 commit c3223c4

66 files changed

Lines changed: 2969 additions & 11365 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 76 deletions
This file was deleted.

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ tsconfig.*.tsbuildinfo
4545
/blob-report/
4646
/playwright/.cache/
4747

48-
.nx/cache
49-
.nx/workspace-data
48+
# turborepo
49+
.turbo
50+
51+
# packaged-for-publish output
52+
.npm-pkg
5053

5154
# git worktrees
5255
.worktrees

.prettierignore

Lines changed: 0 additions & 18 deletions
This file was deleted.

.prettierrc

Lines changed: 0 additions & 16 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
{
2-
"cSpell.words": [
3-
"ents",
4-
"plah",
5-
"Shae",
6-
"testresult",
7-
"transferables"
8-
],
9-
"editor.formatOnSave": true,
10-
"editor.codeActionsOnSave": {
11-
"source.organizeImports": "always",
12-
"source.formatDocument": "always"
13-
}
2+
"cSpell.words": ["ents", "plah", "Shae", "testresult", "transferables"],
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.organizeImports": "always",
6+
"source.formatDocument": "always"
7+
}
148
}

AGENTS.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,22 @@ Uses Signals and Effects (via `@spearwolf/signalize`).
7777
- Check `packages/shadow-objects-e2e/` for end-to-end tests.
7878
- Public API changes must be tested in E2E if possible.
7979

80-
<!-- nx configuration start-->
81-
<!-- Leave the start & end comments to automatically receive updates. -->
82-
83-
# General Guidelines for working with Nx
84-
85-
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through `nx` (i.e. `nx run`, `nx run-many`, `nx affected`) instead of using the underlying tooling directly
86-
- You have access to the Nx MCP server and its tools, use them to help the user
87-
- When answering questions about the repository, use the `nx_workspace` tool first to gain an understanding of the workspace architecture where applicable.
88-
- When working in individual projects, use the `nx_project_details` mcp tool to analyze and understand the specific project structure and dependencies
89-
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
90-
- If the user needs help with an Nx configuration or project graph error, use the `nx_workspace` tool to get any errors
91-
92-
<!-- nx configuration end-->
80+
# Toolchain (post-2026-renewal)
81+
82+
| Concern | Tool |
83+
|---|---|
84+
| Package manager | `pnpm` (workspaces + `catalog:` for dependency-version SSOT) |
85+
| Monorepo orchestrator | `turborepo` — pipeline in `turbo.json` |
86+
| TypeScript | `tsc` 6 — only emits `.d.ts` (declaration-only) |
87+
| Bundler / transpiler | `esbuild` 0.28 (lib transpile + single-file inline-worker bundle) |
88+
| Unit / integration tests | `vitest` 4 (happy-dom for unit, `@vitest/browser` + Playwright provider for DOM-integration) |
89+
| E2E | `@playwright/test` 1.59 |
90+
| Lint + format | `biome` 2.4 (replaces eslint + prettier) |
91+
| Dev server | `vite` (only `shae-offscreen-canvas` demo and `shadow-objects-e2e`) |
92+
93+
**Dependency versions:** never write a plain version range in a per-package `package.json`. Add the version to the `catalog:` block of `pnpm-workspace.yaml` and reference it from each package as `"<dep>": "catalog:"`.
94+
95+
**Run tasks via turbo (`pnpm build`, `pnpm test`, …) instead of invoking the underlying tools directly** — the cache and the cross-package dependency graph are defined there. See `CLAUDE.md` for the full command reference.
9396

9497
# General Context Information for the AI assistant
9598

Backlog.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ ComponentContext│ ─ Destroy
8787

8888
### 2.3 Verwendete Technologien
8989

90-
- **TypeScript** (strict, aber **`strictNullChecks: false`** — Achtung: das ist eine bewusste Lockerung, die Typen-Sicherheit signifikant einschränkt).
90+
- **TypeScript 6** (strict, aber **`strictNullChecks: false`** — Achtung: das ist eine bewusste Lockerung, die Typen-Sicherheit signifikant einschränkt).
9191
- **`@spearwolf/signalize` 0.28.0** — Signals/Effects.
9292
- **`@spearwolf/eventize` 4.3.1** — Event-Emitter.
93-
- **esbuild 0.27.3** — Bundling, mit `esbuild-plugin-inline-worker` für den Worker-Inline.
94-
- **vitest 1.6.1** für Unit-Tests, **`@web/test-runner`** für browser-basierte Funktionstests, **Playwright** für E2E.
95-
- **nx 19.8.14** als Monorepo-Orchestrator, **pnpm 9.1.2**, Node ≥ 24.13.0.
93+
- **esbuild 0.28** — Bundling, mit `esbuild-plugin-inline-worker` für den Worker-Inline.
94+
- **vitest 4** für Unit-Tests (happy-dom) und Integrationstests (browser-mode + Playwright-Provider). **Playwright** für E2E.
95+
- **turborepo 2.9** als Monorepo-Orchestrator, **biome 2.4** für Lint/Format, **pnpm 9.15** mit `catalog:`-SSOT, Node ≥ 24.13.0.
9696

9797
### 2.4 Lebenszyklus einer Entity (vereinfacht)
9898

@@ -262,38 +262,39 @@ Wenn ein `<shae-ent>`-Vater aus dem DOM entfernt wird, das Kind aber selbst noch
262262

263263
## 5. Build & Tooling
264264

265+
> **2026-05-09 — Build-System wurde grundlegend erneuert.** Details: [`CHANGELOG.md`](CHANGELOG.md) (Top-Level), Design-Doku: [`docs/superpowers/specs/2026-05-09-build-system-renewal-design.md`](docs/superpowers/specs/2026-05-09-build-system-renewal-design.md). Die folgenden Abschnitte spiegeln den neuen Stand und nur noch die offenen Punkte.
266+
265267
### 5.1 Pipeline (`packages/shadow-objects`)
266268

267-
Vier Stufen: `compile:lib` (TS → `dist/`) → `compile:bundle` (TS `build/`, JS für esbuild) → `bundle.mjs` (Worker zuerst inline-bundeln, dann Hauptbundle mit `esbuild-plugin-inline-worker`) → `makePackageJson.mjs` (überschreibt Pfade, resolvt `workspace:*`, wendet `package.override.json` an).
269+
Ein Skript: `node build.mjs`. Drei Stages — esbuild-Transpile (`src/**` `dist/src/**`, preserved layout) + tsc emit-only Declarations (`tsconfig.lib.json`) + esbuild Inline-Worker-Bundle (`dist/src/bundle.js``dist/bundle.js`). Anschließend `scripts/makePackageJson.mjs` für `dist/package.json` (resolvt `workspace:*` + `catalog:`, wendet `package.override.json` an).
268270

269271
Veröffentlicht wird `dist/` mit ESM-only, mehreren Subpath-Exports (`./elements.js`, `./shae-ent.js`, `./shae-prop.js`, `./shae-worker.js`, `./shadow-objects.js`, `./shadow-objects.worker.js`, `./bundle.js`).
270272

271-
**Auffälligkeiten:**
272-
- Zwei parallele TS-Outputs (`dist/` und `build/`) für gleiche Quellen.
273-
- `package.override.json` mit doppelter `sideEffects`-Liste — zwei Wahrheitsquellen, Wartungs-Stolperstein.
273+
**Verbleibende Auffälligkeiten:**
274+
- `package.override.json` und `package.json#sideEffects` enthalten noch tote `build/src/...`-Pfade aus der alten Pipeline. Folgenlos (doppelte Wahrheit), sollte aber konsolidiert werden.
274275
- `exports`-Konditionen: Reihenfolge `import` vor `types`. Unter strikter Node-ESM-Resolution (`moduleResolution: node16/nodenext`) sollte `types` zuerst stehen. Aktuell unter `bundler` toleriert, aber latentes Risiko für Konsumenten.
275276

276277
### 5.2 Dependency-Hygiene
277278

278-
- `@spearwolf/eventize@4.3.1`, `@spearwolf/signalize@0.28.0` konsistent über alle Pakete. ✅
279-
- **Drift bei Tooling:** `sinon` 17/18/19 nebeneinander, `@web/test-runner` 0.18 vs 0.20, `vite` 5 vs 6, Playwright 1.58.1 vs 1.58.2.
280-
- `vitest@1.6.1` (aktuell v3.x), `eslint@8.57.1` (EOL), `@typescript-eslint/*@7` (eines hinten), `nx@19` (mehrere Major hinten).
279+
- Versionen leben jetzt zentral in `pnpm-workspace.yaml#catalog:` — keine Drift mehr möglich. ✅
280+
- Tooling auf modernen Major-Versionen: vitest 4, biome 2.4, turbo 2.9, esbuild 0.28, Playwright 1.59, TypeScript 6, happy-dom 20. ✅
281281
- Kern-Lib hat **keine `peerDependencies`**`@spearwolf/eventize`/`signalize` sind harte Deps; bei Mehrfach-Resolutionen drohen Duplikate.
282282

283283
### 5.3 Lint / TS
284284

285285
- `strict: true` **mit `strictNullChecks: false`** — die größte Typensicherheits-Lücke.
286-
- ESLint-Root deaktiviert global `no-explicit-any`, `ban-ts-comment`, `ban-types`, `no-non-null-assertion`. Bewusste Lockerung, aber in Kombination mit `strictNullChecks: false` riskant.
286+
- Biome-Root deaktiviert (analog zur alten ESLint-Config) `noExplicitAny`, `noTsIgnore`, `noNonNullAssertion`, `noImplicitAnyLet`. Bewusste Lockerung, aber in Kombination mit `strictNullChecks: false` riskant.
287287
- `any`-Hotspots (heuristisch): `ConsoleLogger.ts` (~20), `Kernel.ts` (~11), `ShadowObject.ts` (~4).
288+
- Biome meldet aktuell ~30 Warnings im Source (z. B. `useIterableCallbackReturn`, `noShadowRestrictedNames`, `useNodejsImportProtocol`). Schrittweise abarbeiten oder bewusst weiter unterdrücken.
288289

289290
### 5.4 CI-Gap
290291

291-
Die GitHub-Action ruft `pnpm run ci` = `build + lint + test:ci`. **`test:ci` schließt `shadow-objects-e2e` aus.** Damit wird der gesamte Worker-Roundtrip nicht von CI verifiziert. Da `RemoteWorkerEnv` ohnehin keine Unit-Tests hat, ist das ein doppelt-blinder Punkt.
292+
Die GitHub-Action ruft `pnpm run ci` = `turbo run build typecheck test --filter=!shadow-objects-e2e && pnpm lint`. **`test:ci` schließt `shadow-objects-e2e` weiterhin aus.** Damit wird der gesamte Worker-Roundtrip nicht von CI verifiziert. Da `RemoteWorkerEnv` ohnehin keine Unit-Tests hat, ist das ein doppelt-blinder Punkt.
292293

293294
### 5.5 Sonstige Stolperfallen auf frischer Maschine
294295

295296
- `pnpm install` installiert keine Playwright-Browser — manuelles `pnpm exec playwright install chromium firefox` nötig (wird in CLAUDE.md erwähnt).
296-
- `engines.node: ">=24.13.0"` blockiert Mitwirkende auf Node 22.x.
297+
- `engines.node: ">=24.13.0"` blockiert Mitwirkende auf Node 22.x. Hinweis: Node 24+ ships eine inerte `localStorage`-Stub auf `globalThis`; für Tests gefixt durch `packages/shadow-objects/vitest.setup.ts`.
297298
- `make:todo` ist Honor-System (kein Pre-Commit-Hook, kein CI-Check).
298299
- Manuelles `CHANGELOG.md`-Pflegen ohne Changesets/release-please.
299300

@@ -340,12 +341,12 @@ Ein reines JS-Paket (kein TS), `src/` wird ohne Bundle-Schritt veröffentlicht.
340341
### 7.3 Mittelfristig
341342

342343
14. **`strictNullChecks: true`** schrittweise einschalten — größter Hebel für Typensicherheit.
343-
15. **Tooling-Drift bereinigen:** vitest, ESLint, nx, sinon, vite auf einheitliche Major-Versionen ziehen.
344-
16. **`exports`-Konditionen umsortieren** (`types` vor `import`) für strikte Node-ESM-Konsumenten.
345-
17. **`peerDependencies` für `@spearwolf/eventize`/`signalize`** dokumentiert beschließen.
346-
18. **API-Aufräumen:** `appendRoute` aufteilen, `onDestroy`-Tripel-Bedeutung dokumentieren oder trennen, `IShadowObjectEnvProxy.isDestroyed`/`error`-Surface ergänzen, Worker-Timeouts konfigurierbar machen.
347-
19. **Performance-Knopf:** `disableStructuredClone` als Default für `LocalShadowObjectEnv`; optionales RAF-Coalescing bei hoher Update-Frequenz.
348-
20. **`package.override.json`-Mechanik** in `AGENTS.md`/`CLAUDE.md` dokumentieren, Doppel-`sideEffects` zu einer Wahrheit konsolidieren.
344+
15. **`exports`-Konditionen umsortieren** (`types` vor `import`) für strikte Node-ESM-Konsumenten.
345+
16. **`peerDependencies` für `@spearwolf/eventize`/`signalize`** dokumentiert beschließen.
346+
17. **API-Aufräumen:** `appendRoute` aufteilen, `onDestroy`-Tripel-Bedeutung dokumentieren oder trennen, `IShadowObjectEnvProxy.isDestroyed`/`error`-Surface ergänzen, Worker-Timeouts konfigurierbar machen.
347+
18. **Performance-Knopf:** `disableStructuredClone` als Default für `LocalShadowObjectEnv`; optionales RAF-Coalescing bei hoher Update-Frequenz.
348+
19. **`sideEffects`-Listen konsolidieren:** `package.json` und `package.override.json` haben noch tote `build/src/...`-Einträge aus der alten Build-Pipeline — auf `dist/src/...` reduzieren.
349+
20. **Biome-Warnings abarbeiten** (~30 Stück): `useIterableCallbackReturn`, `noShadowRestrictedNames` etc. — entweder fixen oder Regel bewusst abschalten.
349350

350351
### 7.4 Beispiel-App / Dokumentation
351352

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Monorepo Changelog
2+
3+
Top-level changes that are not tied to a single published package — build system, monorepo orchestration, lint/format, dev workflow. Per-package runtime and API changes live in each package's own `CHANGELOG.md`.
4+
5+
The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6+
7+
## 2026-05-09 — Build-system renewal
8+
9+
- **Monorepo orchestrator:** replaced `nx` 19 with `turborepo` 2.9. Removed `nx.json` and all per-package `project.json` files. Pipeline now in `turbo.json`.
10+
- **Lint + format:** replaced `eslint` 8 + `prettier` 3 (and 9 plugins) with `biome` 2.4. Single config at `biome.json`. Removed `.eslintrc.json`, `.eslintignore`, `.prettierrc`, `.prettierignore`.
11+
- **Dependency-version SSOT:** introduced pnpm `catalog:` (in `pnpm-workspace.yaml`). All workspace `package.json` files reference shared deps via `"<dep>": "catalog:"`. The `makePackageJson.mjs` publish helper resolves `catalog:` refs alongside `workspace:*`.
12+
- **TypeScript:** bumped to 6.0. Dropped deprecated `baseUrl` and `downlevelIteration` from the root `tsconfig.json`.
13+
- **Build:** unified `packages/shadow-objects` build into a single `build.mjs` (esbuild transpile + tsc emit-only declarations + esbuild inline-worker bundle + makePackageJson). Removed `tsconfig.bundle.json`, `tsconfig.tests.json`, `bundle.mjs`, the `run-s`/`rimraf` script chain, and the intermediate `build/` directory.
14+
- **Test runners:** consolidated on `vitest` 4.
15+
- Core lib (`shadow-objects`): vitest reads `*.spec.ts` directly (no precompile step). Removed the generated `tests/` tree.
16+
- Integration (`shadow-objects-testing`): switched from `@web/test-runner` to `vitest` browser mode with the Playwright provider (real Chromium for accurate Custom Elements semantics). Chai assertion style preserved via `@esm-bundle/chai`.
17+
- Canvas (`shae-offscreen-canvas`): switched from `@web/test-runner` to `vitest` + happy-dom.
18+
- Shared `vitest.setup.ts` patches Node 24+'s inert `localStorage`/`sessionStorage` globals (which shadow happy-dom's working Storage) and shims mocha's `after`/`before` to vitest's `afterAll`/`beforeAll` for migrated specs.
19+
- **Tooling bumps:** `esbuild` 0.27 → 0.28, `@playwright/test` 1.58 → 1.59, `happy-dom` 14 → 20, added `jsdom` 29 as backup env.
20+
- **Dropped devDeps:** `nx`, `@nx/*`, `eslint*`, `@typescript-eslint/*`, `prettier*`, `npm-run-all`, `@rollup/plugin-node-resolve`, `react`, `@types/react`, `@web/test-runner` (workspace-wide).
21+
22+
### Verification
23+
24+
- `dist/` of `@spearwolf/shadow-objects` is byte-compatible with the previous version (file list identical except for the removal of an accidentally-published `tsconfig.lib.tsbuildinfo`; `dist/package.json` byte-identical). Snapshots: `docs/superpowers/specs/dist-snapshot.txt`, `docs/superpowers/specs/dist-package.json.snapshot`.
25+
- Cold full cycle (`pnpm cbt`): ~7.6 s for clean + build + test + e2e (7 turbo tasks, 191 unit/integration + 32 e2e). Warm cache: ~70 ms (FULL TURBO).
26+
- Design doc: `docs/superpowers/specs/2026-05-09-build-system-renewal-design.md`.

0 commit comments

Comments
 (0)