Repository navigation
fix(extension): generate wxt types during install so the documented checks work - #499
Merged
Merged
Conversation
apps/extension/tsconfig.json (tracked) extends ./.wxt/tsconfig.json, which is gitignored and only produced by `wxt prepare`. Nothing generates it on install, so a fresh checkout cannot typecheck or run the extension tests: $ pnpm --filter @browser-skill/extension compile error TS2318: Cannot find global type 'AsyncIterableIterator'. (exit 2) $ pnpm ext:test [TSCONFIG_ERROR] Failed to load tsconfig for 'src/vitest-setup.ts': Tsconfig not found Test Files 212 failed (212) (exit 1) `wxt build` and `wxt dev` happen to generate the types as a side effect, and CI works around the gap with an explicit prepare step, but the commands README lists for checks (`pnpm ext:test`) do not. Running `wxt prepare` from the extension's postinstall script makes `pnpm install` leave the repository in a state where the documented checks work, which is the layout WXT projects use. Verified: rm -rf apps/extension/.wxt && pnpm install --frozen-lockfile regenerates the types (exit 0), then compile exits 0 and the extension test suite runs (2972 tests passed).
iuyo5678
approved these changes
Oct 27, 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.
Problem
A fresh checkout cannot typecheck or test the extension.
apps/extension/tsconfig.json(tracked) extends./.wxt/tsconfig.json, which is gitignored and only produced bywxt prepare. Nothing generates it during install, so the commands README lists for checks fail immediately:Root cause
The generated
.wxt/tree is a build input that install never produces:wxt buildandwxt devgenerate it as a side effect, so the order "install, build, test" happens to work;.github/workflows/ci.ymltherefore needs a dedicated workaround step (pnpm --filter @browser-skill/extension exec wxt prepare) beforecompile/ext:test;git clean -xdfin the extension) gets 212 failing test files and a brokentsc, which looks like a broken branch rather than missing generated types.Fix
Run the generator from the extension package's
postinstallscript:This is the layout WXT projects use, and it makes
pnpm installleave the working tree in a state where the documented checks work. No dependency, lockfile, CI, or product code is touched; CI's explicit prepare step stays valid (now redundant) and I left it alone.Reproduction and verification
The 212 type-less failures are gone: 2972 tests now run. The single remaining failure is not caused by this change and is not fixed here:
src/long-screenshot/png.test.ts > encodes 120,000 exact scanlines across tile and compression boundariesexceeded vitest's default 5000 ms timeout (6065ms) under full-suite parallelism. In three full-suite runs I got 2972 passing tests each time and exactly one default-timeout failure, on a different heavy test each run (png.test.tstwice; oncehuman-loop.test.ts > bounds dangerous URL regex checks in a child process, whose ownspawnSyncbudget is 10 s but which vitest kills at 5 s). Both pass in isolation (png.test.ts: 12/12 in 2.8 s). I kept this patch single-purpose instead of also raisingtestTimeout— happy to send that as a separate PR if you want it.Impact and risk
wxt prepare(~1 s) perpnpm installfor the workspace package.pnpm install --frozen-lockfilestill passes).wxt prepare(orpnpm ext:build) beforepnpm ext:test; that is strictly a documentation fix and leaves the trap in place for reviewers andgit clean -xdf.AI assistance: this patch was prepared with AI assistance; I reproduced the failure and verified the fix with the commands above.