build(core): ship pre-built worker + SW bundles in dist/#19
Merged
Conversation
Move the SharedWorker and Service Worker bundling from the playground into @tabmesh/core itself, so consumers who install from npm get ready-to-deploy bundles without needing to find the .ts source inside node_modules and run their own bundler. Per ADR-0003 and ADR-0004: - Add `packages/core/scripts/build-bundles.mjs` (esbuild → IIFE). - Wire it into the core build script so `dist/tabmesh-worker.js` and `dist/tabmesh-sw.js` are produced alongside `dist/index.js`. - Add `./worker.js` and `./sw.js` subpath exports in package.json so bundler-aware consumers can `import workerUrl from '@tabmesh/core/worker.js?url'` (Vite/Webpack pattern). - Reduce the playground's build:worker / build:sw scripts to copies from the core dist — single source of truth for the bundle bytes. Existing build pipeline (used by the Playwright webServer in CI) already runs `pnpm --filter "@tabmesh/playground^..." build` first, so the playground copy step finds the freshly-built core dist. Verified: 122 unit tests + 11 Playwright tests pass, biome clean. ADR-0003 (worker bundle distribution) and ADR-0004 (VitePress single site) are also captured in this commit — they were drafted during the grilling pass and codify the release/docs strategy that motivates this build change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First execution PR after the grilling pass. Moves the SharedWorker and Service Worker bundling out of the playground and into `@tabmesh/core` itself, so consumers who install from npm get ready-to-deploy bundles without needing to find the source inside `node_modules` and run their own bundler.
What changes
`packages/core`
`packages/playground`
Documentation
Why this is the right first step
The grilling pass surfaced that publishing to npm without pre-built bundles ships a paperweight — consumers can't trivially get the worker file out of `node_modules`. ADR-0003 settled the choice (pre-built bundles + manual copy + documented in README) and this PR is the implementation. Everything else (npm publish workflow, VitePress site, version bump to `0.1.0-alpha.0`) depends on this being in place.
Test plan