Repository navigation
build: run knip in production mode too - #546
Queued
botandbang wants to merge 6 commits into
Queued
botandbang wants to merge 6 commits into
botandbang wants to merge 6 commits into
Conversation
isSpaceType had no caller but its own test, so it goes, with the two assertions on it. CALENDAR_RSVP was only read by the OAuth tests, which check that sign-in doesn't ask to write RSVPs; the constant moves into that test file. Badge, BrowserFrame and SelectField in the design system had no page using them, only their stories and tests, which go with them. The homepage proposals' hero preview story keeps its project page without the browser frame around it, and the Tag stories drop "and badge" from their title.
`pnpm knip` now runs knip twice: over everything, as before, then with --production over only the code that ships. knip.jsonc marks the shipped entry files and project globs with `!`: the web app's routes (through the SvelteKit plugin), its #lexicon-files target and scripts/db-backup.ts, which the Docker image ships, and localtoolbox's content script, classic scripts and content.css. Tests, scripts, test and story helpers, the root's tools/ and Bombadil stay out of the production run. Exports that only tests, stories or scripts use are tagged @internal, which the production run skips: HOSTS, CLAIMED and VARIABLE_NAMES in localtoolbox, and epkFormDefaults, riddenReport, publishLexicons, HAPPYVIEW_PERMISSIONS and silentLogger in the web app.
Coverage Report for apps/localtoolbox
File Coverage
SizeCompared with main. KiB are 1,024 bytes.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Coverage Report for apps/web
File Coverage
SizeCompared with main. KiB are 1,024 bytes.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bnb
previously approved these changes
Nov 10, 2026
main brought in overdue() (flags/catalog.ts), which only tests call so a passing date never breaks a build. The production knip run skips exports tagged @internal.
bnb
approved these changes
Nov 11, 2026
botandbang
added this pull request to the merge queue
Nov 11, 2026
Any commits made after this event will not be merged.
This branch has not been deployed
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.
Fixes #544. Stacked on #545.
pnpm knipnow runs knip twice: over everything, as #545 set up, then with--production, which counts only the code that ships. That run finds what the first can't: exports and files that only tests, stories or scripts use. Each app's CI and the repo-checks knip job callpnpm knip, so they run both.Added
!is production code; one wrapped in!…!is left out of the production run only, and the default run ignores it.!on the#lexicon-filesentry and on scripts/db-backup.ts, which the Docker image ships for restores. Knip's default run calls the second redundant (a configuration hint, not an error) because package.json'sdb:scripts reach it, but the production run only readsstart. The project keeps knip's default extensions with!and leaves out scripts/, tests/, .storybook/, lighthouserc.cjs, src/lib/testing and src/lib/server/testing,*fixtures.ts, and FormActionsHarness.svelte and CardPreview.svelte (both story-only).!on content.ts, downloaded-store.ts, state-transfer.ts and content.css, which vite.config.ts builds or copies as they are. The project leaves out test/, scripts/ and stryker-load-time.mjs.!, so their tooling stays out of the production run and the default run still covers it.@internalon exports that only tests, stories or scripts use, which the production run skips:HOSTS(sites/index.ts), which test/consistency.test.ts checks the manifest'shost_permissionsagainst, andCLAIMED(the same file) andVARIABLE_NAMES(search-sites.ts), which only their own tests read.epkFormDefaults(epk.ts) andriddenReport(mix/sample.ts), for stories and tests;publishLexicons(server/atproto/lexicons.ts) andHAPPYVIEW_PERMISSIONS(server/happyview/client.ts), for the dev network's scripts;silentLogger(server/logger.ts), for tests and scripts;overdue(server/flags/catalog.ts), which only tests call so that a passing date never breaks a build.Changed
knipscript runsknip && knip --production.@internal, and marking a new app's shipped entry files with!.Removed
isSpaceTypein apps/web/src/lib/server/atproto/spaces.ts: nothing called it but its test. The two assertions on it in spaces.test.ts go with it.CALENDAR_RSVPfrom apps/web/src/lib/nsid.ts: only oauth.test.ts read it, to check that sign-in doesn't ask to write RSVPs. The constant moves into that test.--strictstays off. It reportssvelte,@sveltejs/kitand the other devDependencies the apps import, which is how SvelteKit apps list what Vite bundles.To check:
pnpm knipat the root exits 0. With an export only a test imports in apps/web/src/lib/format.ts, an unused export in tools/budgets/budgets.ts, and an unimported file in apps/localtoolbox/src/lib, the default run failed on the last two and the production run on the first and last.