Skip to content

fix(nitro): report the Nitro version a project actually runs - #1680

Merged
danielroe merged 1 commit into
mainfrom
nitro-major-banner
Nov 16, 2026
Merged

danielroe merged 1 commit into
mainfrom
nitro-major-banner

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

projects using Nuxt 4.7 will soon be able to build their server with Nitro v3 by depending on nitro, but the CLI still would report the Nitro 2 it installs by default:

Nuxt 4.6.4 (with Nitro 2.13.6, Vite 8.3.8 and Vue 3.5.45)

so instead we report the package matching nuxt.options._nitroMajor if it exists, or an explicit user install if nuxt v4.7 is detected, and if not fall back to the previous behaviour

@github-actions

Copy link
Copy Markdown
Contributor

CLI benchmark

@nuxt/cli v4.1.0-alpha.0 (baseline) vs v4.1.0-alpha.0 (this PR)

Metric baseline v4.1.0-alpha.0 head v4.1.0-alpha.0 Delta
nuxt --version wall time (median) 68 ms 69 ms +0.5%
nuxt --help wall time (median) 145 ms 147 ms +0.8%
nuxt dev --help wall time (median) 108 ms 110 ms +1.2%
nuxt --version modules loaded 35 35 0.0%
nuxt --version built-ins loaded 29 29 0.0%
nuxt --help modules loaded 136 137 +0.7%
nuxt --help built-ins loaded 93 93 0.0%
nuxt dev --help modules loaded 65 65 0.0%
nuxt dev --help built-ins loaded 90 90 0.0%
Installed node_modules 2.56 MB 2.56 MB +0.1%
Published tarball (packed) 247.8 kB 248.9 kB +0.5%
Full report

@nuxt/cli v4.1.0-alpha.0 (baseline) vs v4.1.0-alpha.0 (head)

Setting Value
Baseline ref:caa2ec18d90a2ba4973d9fd515f9c9438c3fa496 (v4.1.0-alpha.0)
Head local packages/nuxt-cli at 1f04b37 (v4.1.0-alpha.0)
Node v24.22.3
OS Linux 7.0.0 (kernel 7.0.0-1019-azure)
CPU AMD EPYC 7763 64-Core Processor x 4
Memory 15.6 GB
Load average at start 1.89, 0.57, 0.20
Run started 2026-11-16T14:14:04.106Z

Cold CLI startup

Median of 15 interleaved runs per command, one warmup discarded.

Command baseline v4.1.0-alpha.0 median head v4.1.0-alpha.0 median Delta baseline v4.1.0-alpha.0 min / p95 head v4.1.0-alpha.0 min / p95
nuxt --version 68 ms 69 ms +0.5% 64 ms / 71 ms 65 ms / 71 ms
nuxt --version (first output byte) 64 ms 64 ms +0.7% 59 ms / 66 ms 60 ms / 66 ms
nuxt --help 145 ms 147 ms +0.8% 143 ms / 149 ms 142 ms / 150 ms
nuxt --help (first output byte) 139 ms 140 ms +0.2% 137 ms / 143 ms 137 ms / 143 ms
nuxt dev --help 108 ms 110 ms +1.2% 105 ms / 112 ms 106 ms / 112 ms
nuxt dev --help (first output byte) 103 ms 104 ms +0.8% 100 ms / 106 ms 100 ms / 107 ms
nuxt <unknown-command> (no-op) 157 ms 157 ms +0.2% 151 ms / 163 ms 151 ms / 164 ms
nuxt <unknown-command> (no-op) (first output byte) 150 ms 150 ms -0.2% 145 ms / 156 ms 144 ms / 158 ms

Module load cost

Counted with a module.registerHooks load hook, compile cache disabled. Counts every JS module actually evaluated on that code path (native addons excluded). Built-ins loaded after bootstrap are counted separately, including the internal modules they load.

Command baseline v4.1.0-alpha.0 modules head v4.1.0-alpha.0 modules Delta baseline v4.1.0-alpha.0 source bytes head v4.1.0-alpha.0 source bytes Delta baseline v4.1.0-alpha.0 built-ins head v4.1.0-alpha.0 built-ins Delta
nuxt --version 35 35 0.0% 301.2 kB 301.2 kB 0.0% 29 29 0.0%
nuxt --help 136 137 +0.7% 866.4 kB 870.1 kB +0.4% 93 93 0.0%
nuxt dev --help 65 65 0.0% 464.1 kB 464.1 kB 0.0% 90 90 0.0%

Install footprint and published tarball

Each version installed on its own into an empty project with nothing but @nuxt/cli as a dependency, so the tree is exactly the CLI and its transitive dependencies. npm cache is warm and the registry is only consulted for metadata, so install wall time is indicative, not a network benchmark.

Metric baseline v4.1.0-alpha.0 head v4.1.0-alpha.0 Delta
Direct dependencies of @nuxt/cli 23 23 0.0%
Packages in the installed tree (unique name@version) 38 38 0.0%
Unique package names 38 38 0.0%
Package directories on disk (cross-check) 32 32 0.0%
Installed node_modules on disk 2.56 MB 2.56 MB +0.1%
Installed files 442 443 +0.2%
Install wall time (warm npm cache, median of 3) 1.44 s 1.45 s +0.7%
Published tarball (packed) 247.8 kB 248.9 kB +0.5%
Published tarball (unpacked) 802.0 kB 805.7 kB +0.5%
Files in tarball 104 105 +1.0%

Interleaved runs on a shared runner: trust the deltas, not the absolute timings. The dev, restart and build suites run locally via pnpm bench:cli.

@codspeed

codspeed Bot commented Nov 16, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

2 warnings

⚠️ Upgrade your CodSpeed plugin for Node.js 24

@codspeed/* 5.7.1 is only tested on Node.js 18, 20, and 22, so your Node.js 24 measurements may be inaccurate. Upgrade your @codspeed/* packages to 6.0.0 or later.

See affected benchmarks

⚠️ 2 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 2 untouched benchmarks


Comparing nitro-major-banner (5a99ac9) with main (caa2ec1)

Open in CodSpeed

@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026

Copy link
Copy Markdown
  • nuxt-cli-playground

    npm i https://pkg.pr.new/create-nuxt@1680
    
    npm i https://pkg.pr.new/nuxi@1680
    
    npm i https://pkg.pr.new/@nuxt/cli@1680
    

commit: 5a99ac9

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The CLI now resolves the Nitro major from Nuxt configuration or, when supported, project and pnpm workspace manifests. Version lookup uses that major to select Nitro 2 or Nitro 3 packages. The info command, banner, and development stack now pass or report the resolved major. Tests cover major selection, package lookup, displayed versions, and development stack events.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: Minimal · up to 5a99a

The CLI now reports the Nitro version a project actually runs, and falls back to the previous behavior when the Nitro major cannot be determined. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its scope: the Nitro version reported by the CLI should match the one a project actually runs. The changeset adds Nitro-major selection (nuxt.options._nitroMajor, explicit …
Description check Passed The description states the problem: projects on Nuxt 4.7 can build their server with Nitro v3 via a direct nitro dependency, but the CLI still reports the default Nitro 2. It also states the intended …
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.
Full details: Title check

Explanation

The title names the fix and its scope: the Nitro version reported by the CLI should match the one a project actually runs. The changeset adds Nitro-major selection (nuxt.options._nitroMajor, explicit nitro/nitropack declarations, Nuxt 4.7 support) and threads it through the info command, dev TUI, banner and version resolution, which matches the title's main point. The title uses a conventional commit prefix and is concise.

Full details: Description check

Explanation

The description states the problem: projects on Nuxt 4.7 can build their server with Nitro v3 via a direct nitro dependency, but the CLI still reports the default Nitro 2. It also states the intended behaviour: report the package matching nuxt.options._nitroMajor or an explicit user install on Nuxt 4.7, and otherwise keep the previous behaviour. This directly describes the changes in nitro.ts, banner.ts, info.ts and the related tests. The linked issue section is left as an unfilled template placeholder, which does not affect this lenient check.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cc74e957-91c3-454a-8868-42cd8dfa4782
Commits

Reviewing files that changed from the base of the PR and between caa2ec1 and 5a99ac9.

Files selected for processing: 14

  • packages/nuxt-cli/src/commands/info.ts
  • packages/nuxt-cli/src/dev/tui/index.ts
  • packages/nuxt-cli/src/dev/utils.ts
  • packages/nuxt-cli/src/utils/banner.ts
  • packages/nuxt-cli/src/utils/catalog.ts
  • packages/nuxt-cli/src/utils/nitro.ts
  • packages/nuxt-cli/src/utils/pkg.ts
  • packages/nuxt-cli/src/utils/workspace.ts
  • packages/nuxt-cli/test/unit/commands/info-run.spec.ts
  • packages/nuxt-cli/test/unit/dev-tui.spec.ts
  • packages/nuxt-cli/test/unit/dev/lifecycle.spec.ts
  • packages/nuxt-cli/test/unit/utils/banner.spec.ts
  • packages/nuxt-cli/test/unit/utils/nitro.spec.ts
  • packages/nuxt-cli/test/unit/utils/pkg.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@danielroe
danielroe added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 8553e5f Nov 16, 2026
26 checks passed
@danielroe
danielroe deleted the nitro-major-banner branch November 16, 2026 14:31
@github-actions github-actions Bot mentioned this pull request Nov 16, 2026
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