chore: shave ~1-2s off pnpm test:types#2458
Conversation
`pnpm test:types` runs `nuxt prepare` before `vue-tsc`. In this repo, `nuxt prepare` does not just generate `.nuxt` files, it loads `nuxt.config.ts`, installs modules, and runs each module's `setup()`. The `blog` module's `setup()` calls `loadBlogPosts()`, which calls `fetchBlueskyAvatars()`, which hits the Bluesky API to fetch user avatars and writes those to disk. None of that is needed for type gen or type checking. The blog already gracefully handles missing avatars. We already had a pattern to conditionally skip expensive work during prepare. This uses the same pattern here. This does not break the actual blog build, because nuxt runs modules' `setup()` during build.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔗 Linked issue
N/A
🧭 Context
pnpm test:typesrunsnuxt preparebeforevue-tsc. In this repo,nuxt preparedoes not just generate.nuxtfiles, it loadsnuxt.config.ts, installs modules, and runs each module'ssetup().The
blogmodule'ssetup()callsloadBlogPosts(), which callsfetchBlueskyAvatars(), which hits the Bluesky API to fetch user avatars and writes those to disk. None of that is needed for type gen or type checking. The blog already gracefully handles missing avatars.📚 Description
We already had a pattern to conditionally skip expensive work during prepare. This uses the same pattern here.
This does not break the actual blog build, because nuxt runs modules'
setup()during build.Benchmark
(on an Apple M1 Pro)
pnpm test:typesdurationsYes, 20+ seconds for typechecking is egregious. This is just a start.