feat(build): support custom framework preview/deploy commands#4293
feat(build): support custom framework preview/deploy commands#4293danielroe wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR extends the Nitro framework information type with optional ChangesFramework-aware build command hints
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/build/vite/prod.ts`:
- Around line 123-124: The current fallback for previewCommand (const
previewCommand) uses "npx nitro preview" and may not work for plain Vite
outputs; verify whether the nitro CLI exposes a compatible preview subcommand
and supports Vite .output, and if it does not, change the fallback used in the
previewCommand assignment (and the nitro.logger.success message) to "npx vite
preview" or implement logic to pick "npx nitro preview" only when nitro supports
preview (e.g., feature-detect the CLI or an option on the build result); update
the previewCommand initialization and the nitro.logger.success call accordingly
so plain Vite users are pointed at a working preview command.
🪄 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: ff81c96a-200e-4324-ab3d-5374fb3fb484
📒 Files selected for processing (3)
src/build/rolldown/prod.tssrc/build/vite/prod.tssrc/types/nitro.ts
| const previewCommand = nitro.options.framework.previewCommand || "npx nitro preview"; | ||
| nitro.logger.success(`You can preview this build using \`${previewCommand}\``); |
There was a problem hiding this comment.
Default preview hint changed from npx vite preview to npx nitro preview for plain Vite users.
Previously this message hardcoded npx vite preview (per the PR description). Now, when a framework does not set previewCommand, the fallback is npx nitro preview. Confirm that npx nitro preview actually works against a Vite-produced .output; otherwise plain Vite users (no framework override) are now pointed at a command that may not run their build.
#!/bin/bash
# Does the nitro CLI expose a `preview` command, and does it support vite builds?
rg -nP -C3 "['\"]preview['\"]" --type=ts -g 'src/cli/**'
fd -t f . src/cli --exec rg -nl 'preview' {}🤖 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 `@src/build/vite/prod.ts` around lines 123 - 124, The current fallback for
previewCommand (const previewCommand) uses "npx nitro preview" and may not work
for plain Vite outputs; verify whether the nitro CLI exposes a compatible
preview subcommand and supports Vite .output, and if it does not, change the
fallback used in the previewCommand assignment (and the nitro.logger.success
message) to "npx vite preview" or implement logic to pick "npx nitro preview"
only when nitro supports preview (e.g., feature-detect the CLI or an option on
the build result); update the previewCommand initialization and the
nitro.logger.success call accordingly so plain Vite users are pointed at a
working preview command.
🔗 Linked issue
❓ Type of change
📚 Description
testing vite environment api with nuxt, I was surprised to see this printed out at the end of the build:
I think it makes sense for frameworks with their own CLI to provide a custom preview/deploy command rather than hard-coding it to
vite preview, ornitro deploy.📝 Checklist