Repository navigation
refactor(web): collect lexicons from their files instead of a hand-kept list - #296
Merged
Merged
Conversation
…pt list lexicons.ts imported each file in lexicons/ by hand and listed it in LEXICON_DOCS, REFERENCED_DOCS or WRITTEN_DOCS, so every branch that added a lexicon edited the same lines. It now takes every document in lexicons/ and splits them by authority: computer.localnetwork.* is ours, the rest are referenced. `#lexicon-files` supplies the documents. Under Vite (the app, its tests and the build) an eager import.meta.glob bundles them, since the production image doesn't ship lexicons/. Under tsx (the dev network, publish-lexicons) Node resolves it through package.json to a loader that reads the folder, because tsx has no import.meta.glob. publish-lexicons now uses LEXICON_DOCS instead of its own copy of that loader. Two lexicons change lists. computer.localnetwork.locallibraryPublishing, which the list missed, is now validated and published by the dev network, as lexicons:publish already did. app.userinput.discussion joins REFERENCED_DOCS: WRITTEN_DOCS only kept it out of HappyView's lookup, and no script indexes it.
Coverage Report for apps/web
File Coverage
SizeCompared with main. KiB are 1,024 bytes.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bnb
approved these changes
Oct 30, 2026
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 and why
apps/web/src/lib/server/atproto/lexicons.tsimported every file inlexicons/by hand and listed it inLEXICON_DOCS,REFERENCED_DOCSorWRITTEN_DOCS, so every branch that added a lexicon edited the same lines. It now takes every document inlexicons/and splits them by authority:computer.localnetwork.*is ours, everything else is referenced. All exports keep their names.A
#lexicon-filespackage import supplies the documents. Under Vite (the app, all Vitest projects, the build) aresolve.aliaspoints it at an eagerimport.meta.glob, which bundles the JSON, since the production image doesn't shiplexicons/. Under tsx (the dev network,publish-lexicons) Node resolves it throughpackage.jsonto a loader that reads the folder, since tsx has noimport.meta.glob.publish-lexiconsdrops its own copy of that loader.Two lexicons change lists.
computer.localnetwork.locallibraryPublishingwas missing from the old list; the dev network now validates and publishes it, aslexicons:publishalready did (52 lexicons instead of 51).app.userinput.discussionmoves toREFERENCED_DOCS:WRITTEN_DOCSonly kept it out of HappyView's lookup, and no script indexes it.How it was tested
lexicons.test.ts: the loaded ids equal every JSON file on disk (read with the fs loader, so the two loaders agree), and the authority split holds. It fails when either loader drops a file.format:check,lint,check,knip,test(723),test:storybook(159),test:build(3),test:coveragewith integration (911 passed, lines 94.63%).readdirSync.Checklist
docs/and--helpstill say what the code does (README no longer says to add lexicons to a list)