Skip to content

feat(build): support custom framework preview/deploy commands#4293

Open
danielroe wants to merge 2 commits into
mainfrom
feat/framework-commands
Open

feat(build): support custom framework preview/deploy commands#4293
danielroe wants to merge 2 commits into
mainfrom
feat/framework-commands

Conversation

@danielroe
Copy link
Copy Markdown
Member

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

testing vite environment api with nuxt, I was surprised to see this printed out at the end of the build:

ℹ Generated playground/.output/nitro.json
✔ You can preview this build using npx vite preview
│
└  ✨ Build complete!

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, or nitro deploy.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe requested a review from pi0 as a code owner May 30, 2026 07:48
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

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

Project Deployment Actions Updated (UTC)
nitro.build Ready Ready Preview, Comment May 31, 2026 8:22am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

Review Change Stack

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: b9a703ef-4b82-4bbf-a59a-ec584ed60a69

📥 Commits

Reviewing files that changed from the base of the PR and between 98b0ed6 and c83b68c.

📒 Files selected for processing (1)
  • src/build/vite/prod.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/build/vite/prod.ts

📝 Walkthrough

Walkthrough

This PR extends the Nitro framework information type with optional previewCommand and deployCommand fields, then updates build output success messages in both rolldown and vite to use these framework-configurable commands instead of hardcoded Nitro defaults.

Changes

Framework-aware build command hints

Layer / File(s) Summary
Framework command configuration contract
src/types/nitro.ts
NitroFrameworkInfo interface now includes optional previewCommand and deployCommand string properties for framework-specific build output guidance, with Nitro commands as defaults when not provided.
Build output preview and deploy commands
src/build/rolldown/prod.ts, src/build/vite/prod.ts
Success messages in both rolldown and vite build systems now resolve preview and deploy commands from nitro.options.framework with fallbacks to the original hardcoded npx nitro preview and npx nitro deploy --prebuilt strings; deploy output in rolldown still runs through rewriteRelativePaths(...).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • nitrojs/nitro#4024: The main PR updates the same production success-log “preview/deploy” hint code in src/build/rolldown/prod.ts and src/build/vite/prod.ts to use framework-configurable previewCommand/deployCommand instead of the fixed npx ... preview/deploy strings introduced by the retrieved PR.
  • nitrojs/nitro#3921: Both PRs revolve around framework-provided preview command strings: the main PR switches build success logging to use nitro.options.framework.previewCommand, while the retrieved PR updates the Vercel preset’s preview command to align configured preview commands that this PR surfaces.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format with 'feat' scope and descriptor, clearly describing the main feature being added.
Description check ✅ Passed The description provides context for the change by explaining the issue observed and the rationale for supporting custom framework commands.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/framework-commands

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 30, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4293

commit: c83b68c

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 255b254 and 98b0ed6.

📒 Files selected for processing (3)
  • src/build/rolldown/prod.ts
  • src/build/vite/prod.ts
  • src/types/nitro.ts

Comment thread src/build/vite/prod.ts Outdated
Comment thread src/build/vite/prod.ts Outdated
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.

1 participant