Skip to content

chore: shave ~1-2s off pnpm test:types#2458

Merged
ghostdevv merged 1 commit intomainfrom
serhalp/chore-faster-typecheck
Apr 10, 2026
Merged

chore: shave ~1-2s off pnpm test:types#2458
ghostdevv merged 1 commit intomainfrom
serhalp/chore-faster-typecheck

Conversation

@serhalp
Copy link
Copy Markdown
Member

@serhalp serhalp commented Apr 10, 2026

🔗 Linked issue

N/A

🧭 Context

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.

📚 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:types durations Avg
Before 22.6, 22.2, 21.8, 25.0, 23.5 23.0s
After 22.3, 21.3, 21.9, 21.6, 21.5 21.7s

Yes, 20+ seconds for typechecking is egregious. This is just a start.

`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.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Apr 10, 2026 1:37pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Apr 10, 2026 1:37pm
npmx-lunaria Ignored Ignored Apr 10, 2026 1:37pm

Request Review

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@serhalp serhalp marked this pull request as ready for review April 10, 2026 13:44
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 62810c77-6066-4ea4-9acb-a1e1348c837d

📥 Commits

Reviewing files that changed from the base of the PR and between eb2e6bb and 0404f24.

📒 Files selected for processing (1)
  • modules/blog.ts

📝 Walkthrough

Walkthrough

The loadBlogPosts function signature has been refactored to accept an options object containing imagesDir and resolveAvatars properties instead of accepting imagesDir as a direct parameter. Avatar resolution is now conditional: when resolveAvatars is true, Bluesky avatars are batch-fetched; when false, an empty Map is used resulting in null avatar fields. The Nuxt module setup computes resolveAvatars based on whether Nuxt is in prepare mode. Directory creation for avatar images is now conditional on the resolveAvatars flag. The call site has been updated to pass the new options format.

Suggested reviewers

  • danielroe
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the context, rationale, and performance improvements of the changes to skip expensive Bluesky API calls during type checking.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch serhalp/chore-faster-typecheck

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ghostdevv ghostdevv added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit efe01a0 Apr 10, 2026
24 checks passed
@ghostdevv ghostdevv deleted the serhalp/chore-faster-typecheck branch April 10, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants