Files
com.pearcal/scripts
Your NameandClaude Opus 5 3d15740b59 fix(build): make bundle:ui build what actually ships, and stop verify clobbering it
Closes #132.

`npm run bundle:ui` bundled src/ui/App.jsx with --global-name=PearCalApp and a
manual JSX factory. Everything that actually ships - the CLAUDE.md Android and
iOS commands, release.sh, and therefore the committed assets/app-ui.bundle -
bundles src/ui/main.jsx as a plain IIFE with automatic JSX. Both wrote to the
same path, so running the documented command replaced the shipping bundle with
a different artifact that has no entry point wired, and git status said only
"modified". It bit twice on 2026-07-23.

Measured before and after rather than assumed:

  old bundle:ui       784,534 bytes   (App.jsx + global name, no entry point)
  what ships        1,414,532 bytes
  new bundle:ui     1,414,532 bytes   md5 5484d83d… - identical, git sees no change

The quoting is the part worth not repeating. Writing the define as
--define:process.env.NODE_ENV=\"production\" inside a package.json script does
NOT survive: npm hands the line to sh, sh strips the bare double quotes, and
esbuild receives the identifier `production` rather than the string. That
produced a third distinct artifact - correct entrypoint, wrong output. Single
quotes around the escaped pair are what make it reach esbuild intact.

Also split the verify gate off the shipped artifact entirely. `npm run verify`
now builds the UI to node_modules/.cache (gitignored, so it can never surface
in git status) purely to prove it compiles. A gate that rewrites a tracked
build output is the other half of what made this bug invisible.

Deleted assets/index.html, the only consumer of window.PearCalApp and the one
thing that made the old form look load-bearing. It is dead: the mobile WebView
builds its own HTML inline in app/index.tsx and injects the bundle, which
self-mounts via main.jsx's createRoot; the Electron renderer has its own
index.html that never mentions PearCalApp; and nothing in the repo, any build
script or app.json references the file. It had not been touched since the
initial commit.

release.sh keeps its inlined bundle commands - what a release builds should be
visible where it runs - but its comment claiming bundle:ui differs is no longer
true, so it now says what is actually the case. No release command changed.

Verified: `npm run bundle:ui` reproduces the committed bundle byte-for-byte,
and `npm run verify` leaves assets/ untouched. 266 tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NEd2k9F1HgR3JHdB8spury
2026-07-26 15:13:13 -05:00
..