Repository navigation
refactor: rename content to posts, and give each post one folder - #37
Merged
Merged
Conversation
A post's files were spread over three trees: prose and data in
src/content/<slug>/, stage art and 3D models in src/assets/<slug>/, and the
logic its figures read in src/lib/ mixed in with the site-wide modules.
Nothing said which lib file belonged to which post.
Now one folder holds all of it:
src/posts/bitcoin/
index.mdx
assets/ bg.webp, coin.glb (was src/assets/bitcoin/)
data/ bars.json, epochs.json, ...
diagrams/ BitcoinTimeline.tsx, ...
lib/ bitcoin-timeline.ts, flag-rate.ts, flagged-blocks.ts,
offchain-revenue.ts, pool-flag-rate.ts, pool-flag-sample.ts,
sha256.ts and their tests
src/lib/ keeps only what the whole site uses: fan.ts, posts.ts, stage.ts.
src/assets/ is gone.
The import rule follows from the layout: a post's own files are relative
(../lib/bitcoin-timeline, ../data/bars.json, ../assets/coin.glb?url), and @/
is only for site-wide modules. HeroStage.astro still reaches into the post
folder for the coin and the timeline, now as @/posts/bitcoin/diagrams/.
Two things outside the move had to follow it:
generate-art.mjs mirrored art-src/ into src/assets/, but the slug folder now
sits before assets/, so a plain prefix swap would not do. It maps
art-src/<slug>/x.png to src/posts/<slug>/assets/x.webp, and a master with no
slug folder is an error rather than a file written somewhere no post reads.
The test glob src/**/*.test.ts was unquoted, so sh expanded it to one level
and matched src/lib/ only. The tests now sit four levels deep. Quoting it
hands the glob to node, which walks the tree.
Verified: 39/39 tests pass, astro check reports 0 errors, the build emits all
three pages with the fingerprinted coin.glb and bg.webp, and the dev server
renders the homepage art, the coin and all five figures.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What changed
A post's files were spread over three trees. Now one folder holds all of it.
src/content/→src/posts/, and everything a post owns moved inside its own folder:src/assets/is gone.src/lib/keeps only what the whole site uses:posts.tsandstage.ts.Two smaller moves in the same pass:
src/components/ui/{Button,Panel,Tag}.tsxmoved up intosrc/components/. Nothing imported them, so this was a rename plus one doc line.src/lib/fan.tswas inlined intoPostsFan.tsx, which now exportsCURATED_ORDER,sortCuratedandcardNo.index.astroandHeroStage.astroimport them from there.Why
Nothing in the old layout said which
src/lib/file belonged to which post —flag-rate.tsandstage.tssat side by side, one owned by the bitcoin post and one owned by the site. The folder now answers that, and the import style follows from it: a post's own files are relative (../lib/bitcoin-timeline,../data/bars.json,../assets/coin.glb?url), and@/means site-wide.Things a reviewer should know
generate-art.mjsneeded real logic, not a path swap. It mirroredart-src/intosrc/assets/, but the slug folder now sits beforeassets/, so the mapping isart-src/<slug>/x.png→src/posts/<slug>/assets/x.webp. A master with no slug folder is now an error rather than a file written where no post reads it.The test glob was silently under-matching.
tsx --test src/**/*.test.tswas unquoted, soshexpanded**to one level and matchedsrc/lib/only. The tests now sit four levels deep, so this would have started passing vacuously. Quoting it hands the glob to node, which walks the tree. Same 39 tests before and after.stage.tsdeliberately stayed insrc/lib/. Moving it intoHeroStage.astrowas tried and does not work: an.astromodule exports only its component, soPostsFan.tsxcannot importgetStage/setStagefrom it ([MISSING_EXPORT]at build). It also has three consumers across the hydration line, andHeroStage's import graph includes the 1 MBBitcoinCoin3Dchunk thatPostsFancurrently does not pull in.The fan/caption numbering was the one behavioural risk in inlining
fan.ts, since the static caption and the hydrated panel number posts off the same array positions. Checked in the browser: prologue000, bitcoin001, and the caption's001 · 2026-07-28matches the bitcoin card.Verification
npm run verifyclean — Prettier,astro check0 errors, build emits all 3 pages with the fingerprintedcoin.glbandbg.webp, 39/39 tests. Dev server renders the homepage art, the coin and all five bitcoin figures with no new console errors.🤖 Generated with Claude Code