feat(modules): show Nuxt version compatibility on modules page#2331
feat(modules): show Nuxt version compatibility on modules page#2331Ibochkarev wants to merge 3 commits into
Conversation
|
@Ibochkarev is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
9985291 to
9c993ae
Compare
📝 WalkthroughWalkthroughThe change adds shared Nuxt compatibility and module-query utilities, then applies them to API, composable, and MCP module filtering. Module cards, detail pages, generated Markdown, and MCP responses now expose Nuxt 3/4 compatibility badges. The modules page adds version filters for desktop and mobile views and displays filtered counts. Unit and browser tests cover compatibility detection, query normalization, cache keys, and version filtering. Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
test/unit/modules-compatibility.spec.ts (1)
4-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid making live network requests in unit tests.
Fetching live data from an external CDN makes the unit test suite rely on network access, which can lead to flaky tests, increased test duration, and failures in offline or restricted CI environments.
Consider using a local JSON fixture or mocking the
fetchcall to ensure deterministic and fast test execution.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/unit/modules-compatibility.spec.ts` around lines 4 - 13, Replace the live CDN fetch in the “moduleSupportsNuxt against CDN registry” test with deterministic local data, using a fixture or mocked fetch response that represents the required module compatibility cases. Preserve the assertions validating module count and Nuxt 4 compatibility while ensuring the test performs no external network requests.app/pages/modules/index.vue (1)
155-155: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the static
+if displaying dynamic filtered counts.Since the count now reflects
filteredModules.lengthrather than the totalmodules.length, retaining the static+sign may result in awkward wording when filtering or searching yields small or exact numbers (e.g., "Build faster with 1+ Nuxt Modules").Consider removing the
+when displaying exact filtered results, or usemodules.lengthif the intent is to show the total catalog size.♻️ Proposed fix
- Build faster with <span class="text-primary">{{ filteredModules.length }}+</span> Nuxt Modules + Build faster with <span class="text-primary">{{ filteredModules.length }}</span> Nuxt Modules🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/pages/modules/index.vue` at line 155, Update the module count text in the page template to remove the static “+” when displaying filteredModules.length, so the label presents the exact filtered result. Keep the existing filteredModules count and surrounding wording unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/api/v1/modules/index.get.ts`:
- Around line 4-5: Update the query parsing in the cached event handler around
normalizeModulesQuery so Zod validation failures are converted into a 400 Bad
Request instead of propagating as unhandled 500 errors. Reuse getValidatedQuery
if it provides the established validation handling, or use safeParse and
explicitly return the corresponding 400 response while preserving the existing
version and category extraction.
---
Nitpick comments:
In `@app/pages/modules/index.vue`:
- Line 155: Update the module count text in the page template to remove the
static “+” when displaying filteredModules.length, so the label presents the
exact filtered result. Keep the existing filteredModules count and surrounding
wording unchanged.
In `@test/unit/modules-compatibility.spec.ts`:
- Around line 4-13: Replace the live CDN fetch in the “moduleSupportsNuxt
against CDN registry” test with deterministic local data, using a fixture or
mocked fetch response that represents the required module compatibility cases.
Preserve the assertions validating module count and Nuxt 4 compatibility while
ensuring the test performs no external network requests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 46feec60-9357-42ea-958e-954e0f3fd305
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (15)
app/components/module/ModuleItem.vueapp/composables/useModules.tsapp/pages/modules/[slug].vueapp/pages/modules/index.vuecontent/modules.ymlpackage.jsonserver/api/v1/modules/index.get.tsserver/mcp/tools/modules/get-module.tsserver/mcp/tools/modules/list-modules.tsserver/routes/raw/modules.md.get.tsshared/utils/modules-query.tsshared/utils/modules.tstest/browser/modules.spec.tstest/unit/modules-compatibility.spec.tstest/unit/modules-query.spec.ts
Summary
Adds Nuxt 3/4 compatibility badges and a version filter on
/modules, using the existingcompatibility.nuxtmetadata from@nuxt/modules(as suggested in the issue thread).semverhelpers/api/v1/modules?version=version=4.includes('^3')checksFixes #2053
Test plan
/modules— default list matches Nuxt 3–compatible modules; cards show Nuxt 3/4 badgesversion=4; Nuxt 4–only modules appear^3.x || ^4.x— both badges; no false legacy alertpnpm exec vitest run --config/ unit project:test/unit/modules-compatibility.spec.tspasses