Skip to content

build: per-file tsc emit and published-package verification #125 #126 - #151

Merged
edloidas merged 12 commits into
masterfrom
claude/issues-125-126-approaches-z111u1
Jul 30, 2026
Merged

build: per-file tsc emit and published-package verification #125 #126#151
edloidas merged 12 commits into
masterfrom
claude/issues-125-126-approaches-z111u1

Conversation

@edloidas

@edloidas edloidas commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Replaces the Bun-bundled dist/ with a per-file tsc emit under nodenext and closes the remaining publish-path verification gaps.

Build (#125): one tsc -p tsconfig.build.json pass now emits JS, .d.ts, and both map kinds; bin moved to dist/cli/index.js, killing the CLI double-bundle (dist shrank ~1020 KB to ~760 KB). The testing.ts const-alias workaround for the Bun re-export bug is deleted (no bundler in the package path), src/version.ts is generated from package.json and gated by check:version plus a drift test, and library neutrality is enforced three ways: Biome noNodejsModules, types: [] in the build config, and the new browser-smoke job. The manifest drops node10-era main/types, gains unpkg/jsdelivr fields and discovery keywords, and the demo site now imports the built package through the self-reference.

CI (#126): node-smoke installs the real npm pack tarball in a scratch project and exercises both entry points, require(esm), and the installed bin across Node 22.12.0, 22.x, 24.x, and lts/*; browser-smoke bundles both entries from the tarball with esbuild --platform=browser (hard-errors on Node builtins, unlike Bun's silent stubbing), greps the minified bundle for runtime globals, and executes it.

Notable trade-offs: TypeScript consumers now need moduleResolution bundler/node16/nodenext (documented in README); site:dev no longer hot-reloads library sources (documented in CLAUDE.md and CONTRIBUTING). The issue's "strip workspaces from the manifest" task was dropped — publint is verifiably green with it present. Issue #125's claims that the const-alias workaround "strips TSDoc" and "loses the error type export" were stale — both lived in the tsc-generated .d.ts; only the tree-shaking cost was real.

Closes #125

Closes #126

claude added 12 commits July 30, 2026 14:02
Added `scripts/generate-version.ts` and the committed `src/version.ts`
Rewrote `src/index.ts` to import the generated constant
Rewrote the `src/index.test.ts` manifest import with a JSON attribute, keeping it as the drift guard
Extended `scripts/check-version.ts` to gate `src/version.ts` sync in both modes
Added the `generate:version` script

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Swapped the drift-guard comment prefix to `// ?` per comments.md
Hardened `check-version.ts` against CRLF and a missing `src/version.ts`
Preferred `undefined` and a single `Bun.file` handle in the generator
Restored the `check:*` script grouping in package.json

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Switched tsconfig to `nodenext` and removed the dead `@/*` paths alias
Replaced the four build steps with a single `tsc -p tsconfig.build.json` emit
Dropped Node/Bun type packages from the build program via `types: []`
Declared the CLI entry's minimal `process` surface module-locally
Restored plain re-exports in `testing.ts`, moving TSDoc to `rng/mock.ts`
Pointed `bin` at `dist/cli/index.js` and set its executable bit in `build`
Updated `package-smoke.test.ts` and the CI cli job for the new layout

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Asserted the `chmod +x` build-script contract in the CLI smoke test
Executed the built CLI directly to exercise shebang and mode together
Added a `types: []` build-config pass to `typecheck` so neutrality errors surface in `check`
Dropped dead Bun setup steps from the CI cli job

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Dropped the redundant node10-era `main` and `types` fields (`exports` is the source of truth)
Added `unpkg`/`jsdelivr` fields pointing at `dist/index.js`
Extended keywords with discovery terms for dice, ESM, and browser use

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replaced `../../src` imports in `site/src` with the `roll-parser` self-reference
Made `typecheck` build the library so the site project resolves `dist` types
Prepended the library build to `site:build` and `site:dev`

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Stopped `clean` from deleting `coverage/` during the `check` iteration loop
Kept Bun ambient globals out of the browser-only site typecheck via `types: []`

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rewrote `node-smoke` to npm-pack the tarball, install it in a scratch project, and exercise both entry points and the bin across Node 22.12.0, 22.x, and lts/*
Added a `browser-smoke` job: esbuild `--platform=browser` bundle of both entries from the tarball install, hard-failing on Node builtins, grepped for runtime globals, then executed
Asserted dist library files carry no `node:`/`bun:`/`require` specifiers
Enabled Biome `noNodejsModules` for library sources, exempting `src/cli`
Pinned `esbuild` as an explicit devDependency for the browser-smoke bundle

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Documented the per-file emit, neutrality enforcement, and `src/version.ts` in CLAUDE.md constraints
Added the `generate:version` step to the release-commit convention
Noted the site consumes built `dist/` and library edits need a rebuild
Replaced dead `@/` path-alias import examples in rules with `.js`-suffixed relative imports
Added README notes for CDN usage and the minimum TypeScript `moduleResolution`

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Added an explicit `24.x` matrix leg so LTS drift cannot silently drop it
Broadened the dist grep to catch side-effect and dynamic builtin imports
Guarded both grep assertions against missing paths passing silently

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Corrected CONTRIBUTING's bundler claim, `.js`-extension rationale, and release steps
Scoped CLAUDE.md's npm exception to all smoke jobs and the publish step
Completed the `validate` description and noted `check`'s dist rebuild side effect
Pinned the raw unpkg example to the `@next` tag
Struck the resolved #22 items in GAPS.md, noting `src/` shipping is now deliberate

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bumped checkout, cache, download-artifact, and setup-node SHAs in the
rebased smoke jobs to the majors master upgraded in #149

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@edloidas edloidas self-assigned this Jul 30, 2026
@edloidas
edloidas merged commit 142fc93 into master Jul 30, 2026
13 checks passed
@edloidas
edloidas deleted the claude/issues-125-126-approaches-z111u1 branch July 30, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: verify the published package end-to-end and harden workflows build: emit environment-neutral library output for browser and CDN use

2 participants