Generate the static mirror at deploy time instead of committing it - #121
Conversation
The mirror was committed to the repo, which made it possible for the generated HTML to disagree with config/*.js. Everything built to close that gap — the --check drift guard, its tests, the CI step, and the open question about a cron to re-sync — existed only because derived files were being tracked as sources. Make the mirror a build artifact instead: - npm run build now assembles dist/ from scratch and Netlify publishes that, so config/*.js reaches the static pages on deploy and there is nothing left that can go stale - index.html in the repo root is a template; the build injects the JSON-LD and <noscript> blocks into dist/index.html - the pure-data configs carry a guarded module.exports footer, so build-pages.js can require() them and the vm sandbox is gone. They still load as classic browser scripts in the bundle and welcome.htm - dropped findDrift/checkPages, build:pages:check, and the drift tests Also removes the previously committed build output (js/app.bundle.js, the vendor copies, the source maps) for the same reason. Publishing dist/ rather than "." means scripts/, tests/, package.json, and netlify.toml are no longer served from root.vc. config/*.js still ships: welcome.htm loads it with raw <script src> tags.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
How to validate this against real Netlify. GitHub Worth clicking on that preview:
If the preview build fails on Netlify for a reason that doesn't reproduce locally, the likely culprit is the build command already set in the site UI — the toml now overrides it, so a mismatch would show up as a missing asset rather than a hard failure. The Vercel check failing on this PR is pre-existing: it fails identically on #120 and is unrelated to these changes. Separate question whether that integration should still be connected at all. |
|
Pushed Root cause: the Vercel project is connected at the repo level, so it attempted a build on every branch. Only
Two notes:
The remaining |
The Vercel project is connected at the repo level, so it attempted a build on every branch. Only ai-incarnations carries a vercel.json, so builds on this line had nothing to read and failed — posting a red check on this PR, which has nothing to do with Vercel. root.vc is served by Netlify. Set git.deploymentEnabled: false so branches carrying this file don't trigger a Vercel deployment. Byte-identical to the copy on #122, which lands the same file on main along with the README rationale. The two merge cleanly in either order. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
245d64b to
b8b64dc
Compare
|
Force-pushed Reason: both branches adding a Net effect here is unchanged: this branch still carries |
Records that Netlify serves root.vc from dist/, that the Vercel project belongs to the parked ai-incarnations branch, and why the two vercel.json files deliberately differ — so nobody reconciles them and breaks that branch's deploys. Folded in from #122 so this line carries the whole change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
3950651
into
claude/root-vc-seo-llm-discovery-fb2218
Proposal on top of #120 — merge this into
claude/root-vc-seo-llm-discovery-fb2218and #120 updates in place. Nothing here is force-pushed over your work; it's one commit on top offaf71b5.The argument
The mirror is generated from
config/*.jsand then committed. That's what makes drift possible, and everything built to close the gap —findDrift,checkPages,build:pages:check, four drift tests, the CI step blocked onworkflowscope, and the open question about a cron — exists only because derived files are tracked as sources.So don't sync it. Stop committing it.
This makes
npm run buildassembledist/from scratch and points Netlify at that. A config edit reaches the static pages on the next deploy because that is the only way the pages come into existence. There is no committed copy to go stale, so there is nothing to check and nothing to re-sync.What changed
98 files, +202 / −10,463.
build:pages:check+ drift tests/package.json,/scripts/,/tests/servednetlify.toml—command = "npm run build",publish = "dist"scripts/build-assets.js— wipes and rebuildsdist/, copies the static assets, then callswritePages()scripts/build-pages.js— writes intodist/, reads sources from the repo;findDrift/checkPagesremovedindex.htmlis now a template — the sentinel regions are empty and the build injects intodist/index.htmlconfig/{firm,portfolio,team,jobs}.js— guardedmodule.exportsfooter, sobuild-pages.jscanrequire()them and thevmsandbox is gone. They still load as classic browser scripts in the bundle and inwelcome.htmabout/,jobs/,portfolio/,team/,sitemap.xml,llms*.txt,robots.txt, plus the previously committedjs/app.bundle.js, vendor copies, and source mapsYour canonical /
og:url/og:imagefixes and theconfig/firm.jsextraction are untouched — they were real bugs and they carry over as-is.On the two blockers in your description
The Netlify build command doesn't need to be read from the UI.
.gitignoreignorescss/xterm.css,js/xterm*.js*, andjs/aalib.js*, andindex.htmlreferences all three. The site works today, so a build already runs, andnpm run buildis the only script that produces them. Setting it in the toml captures existing config.The
workflow-scope CI step is moot. There's nothing to check..github/workflows/test.ymlalready runsnpm run build; if a config edit breaks the generator, CI fails there.Verification
npm test— 230/230npm run build— 79 mirror files, 212 files indist/src/hrefacross all 76 built HTML files resolves insidedist/. The only things that stopped being served are bundled sources and vendor source mapsdist/and loaded it: terminal boots with no console errors;firm/portfolio(63) /team(7) are live globals andmoduleisundefined, so the dual-mode guard is load-bearing in a real browser;welcome.htmrenders its config-driven tables;/portfolio/zed/rendersconfig/portfolio.jsand rebuilt — it propagated to 12 files (bundle,index.html, both llms files, Zed's page, the portfolio index, and 5 sibling "More from the portfolio" sections). No commit involvedTrade-off worth naming
Under
publish = "."a failed build still served the committed HTML. Now a failed build fails the deploy. I think that's the right direction — Netlify keeps the last good deploy live rather than shipping stale pages — but it is a real change from "the output is committed, so it survives a failed build," and it's your call.🤖 Generated with Claude Code