From b7066050032286d1a80ebec43169813c28e1d4dd Mon Sep 17 00:00:00 2001 From: OrbisK Date: Fri, 23 Oct 2026 12:43:59 +0200 Subject: [PATCH 1/3] feat: add `nightly-v5` upgrade channel --- docs/upgrade.md | 6 +++--- packages/nuxt-cli/src/commands/upgrade.ts | 11 ++++++----- packages/nuxt-cli/test/unit/help.spec.ts | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/upgrade.md b/docs/upgrade.md index 5595c52b1..0fbe9e4ca 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -10,13 +10,13 @@ links: ```bash [Terminal] -npx nuxt upgrade [ROOTDIR] [--cwd=] [--logLevel=] [--dedupe] [-f, --force] [-ch, --channel=] +npx nuxt upgrade [ROOTDIR] [--cwd=] [--logLevel=] [--dedupe] [-f, --force] [-ch, --channel=] ``` The `upgrade` command upgrades Nuxt to the latest version. It updates the version in your [`package.json`](/docs/directory-structure/package), reinstalls dependencies with your package manager and removes the build cache. -`--channel` picks what to upgrade to: `stable` for the latest release, `v3` or `v4` to stay on a major, and `nightly`, `v3-nightly` or `v4-nightly` for the nightly release channel. +`--channel` picks what to upgrade to: `stable` for the latest release, `v3` or `v4` to stay on a major, and `nightly`, `v4-nightly` or `v5-nightly` for the nightly release channel. `--force` recreates the lockfile and `node_modules` from scratch, and `--dedupe` deduplicates dependencies afterwards where the package manager supports it. @@ -39,5 +39,5 @@ A dependency pinned to a pnpm catalog (`"nuxt": "catalog:"`) is upgraded in `pnp | `--logLevel=` | | Specify build-time log level | | `--dedupe` | | Dedupe dependencies after upgrading | | `-f, --force` | | Force upgrade to recreate lockfile and node_modules | -| `-ch, --channel=` | `stable` | Specify a channel to install from | +| `-ch, --channel=` | `stable` | Specify a channel to install from | diff --git a/packages/nuxt-cli/src/commands/upgrade.ts b/packages/nuxt-cli/src/commands/upgrade.ts index 3ae567c73..e04c1cc34 100644 --- a/packages/nuxt-cli/src/commands/upgrade.ts +++ b/packages/nuxt-cli/src/commands/upgrade.ts @@ -95,7 +95,8 @@ export async function resolveCatalogSpecifier(spec: InstallSpec, current?: strin const nuxtVersionTags = { '3.x': '3x', - '4.x': 'latest', + '4.x': '4x', + '5.x': '5x', } type NuxtVersionTag = keyof typeof nuxtVersionTags @@ -108,8 +109,8 @@ async function getNightlyVersion(packageNames: string[]): Promise<{ npmPackages: const nuxtVersion = await select({ message: 'Which nightly Nuxt release channel do you want to install?', options: [ - { value: '3.x' as const, label: '3.x' }, { value: '4.x' as const, label: '4.x' }, + { value: '5.x' as const, label: '5.x' }, ], initialValue: '4.x' as const, }) @@ -130,12 +131,12 @@ async function getRequiredNewVersion(packageNames: string[], channel: string): P return getNightlyVersion(packageNames) case 'v3': return { npmPackages: packageNames.map(p => `${p}@3`), nuxtVersion: '3.x' } - case 'v3-nightly': - return { npmPackages: packageNames.map(p => getNightlyDependency(p, '3.x')), nuxtVersion: '3.x' } case 'v4': return { npmPackages: packageNames.map(p => `${p}@4`), nuxtVersion: '4.x' } case 'v4-nightly': return { npmPackages: packageNames.map(p => getNightlyDependency(p, '4.x')), nuxtVersion: '4.x' } + case 'v5-nightly': + return { npmPackages: packageNames.map(p => getNightlyDependency(p, '5.x')), nuxtVersion: '5.x' } case 'stable': default: return { npmPackages: packageNames.map(p => `${p}@latest`), nuxtVersion: '4.x' } @@ -164,7 +165,7 @@ export default defineCommand({ alias: 'ch', default: 'stable', description: 'Specify a channel to install from', - options: ['stable', 'nightly', 'v3', 'v4', 'v4-nightly', 'v3-nightly'], + options: ['stable', 'nightly', 'v3', 'v4', 'v4-nightly', 'v5-nightly'], }, }, async run(ctx) { diff --git a/packages/nuxt-cli/test/unit/help.spec.ts b/packages/nuxt-cli/test/unit/help.spec.ts index 5180522c8..ef76b807c 100644 --- a/packages/nuxt-cli/test/unit/help.spec.ts +++ b/packages/nuxt-cli/test/unit/help.spec.ts @@ -471,7 +471,7 @@ describe('help', () => { --logLevel= Specify build-time log level --dedupe Dedupe dependencies after upgrading -f, --force Force upgrade to recreate lockfile and node_modules - -ch, --channel= Specify a channel to install from (Default: stable) + -ch, --channel= Specify a channel to install from (Default: stable) " `) }) From 10a11e01aa51daed89dd36b49b06a5b2d0135c23 Mon Sep 17 00:00:00 2001 From: OrbisK Date: Fri, 23 Oct 2026 12:51:36 +0200 Subject: [PATCH 2/3] chore: soft deprecated v3 channel --- packages/nuxt-cli/src/commands/upgrade.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nuxt-cli/src/commands/upgrade.ts b/packages/nuxt-cli/src/commands/upgrade.ts index e04c1cc34..9a671670e 100644 --- a/packages/nuxt-cli/src/commands/upgrade.ts +++ b/packages/nuxt-cli/src/commands/upgrade.ts @@ -133,6 +133,8 @@ async function getRequiredNewVersion(packageNames: string[], channel: string): P return { npmPackages: packageNames.map(p => `${p}@3`), nuxtVersion: '3.x' } case 'v4': return { npmPackages: packageNames.map(p => `${p}@4`), nuxtVersion: '4.x' } + case 'v3-nightly': + return { npmPackages: packageNames.map(p => getNightlyDependency(p, '3.x')), nuxtVersion: '3.x' } case 'v4-nightly': return { npmPackages: packageNames.map(p => getNightlyDependency(p, '4.x')), nuxtVersion: '4.x' } case 'v5-nightly': @@ -165,7 +167,8 @@ export default defineCommand({ alias: 'ch', default: 'stable', description: 'Specify a channel to install from', - options: ['stable', 'nightly', 'v3', 'v4', 'v4-nightly', 'v5-nightly'], + options: ['stable', 'nightly', 'v3', 'v4', 'v3-nightly', 'v4-nightly', 'v5-nightly'], + valueHint: 'stable|nightly|v4|v4-nightly|v5-nightly', }, }, async run(ctx) { From 664e75ced7f6cdadfc8ebbb67b0078f827c85346 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 26 Oct 2026 19:53:16 +0000 Subject: [PATCH 3/3] test(upgrade): cover nightly dist-tags and drop `v3` from docs --- docs/upgrade.md | 18 ++++++++-------- .../test/unit/commands/upgrade-run.spec.ts | 21 +++++++++++++++++++ packages/nuxt-cli/test/unit/help.spec.ts | 8 +++---- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/docs/upgrade.md b/docs/upgrade.md index 0fbe9e4ca..64f7537fa 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -10,13 +10,13 @@ links: ```bash [Terminal] -npx nuxt upgrade [ROOTDIR] [--cwd=] [--logLevel=] [--dedupe] [-f, --force] [-ch, --channel=] +npx nuxt upgrade [ROOTDIR] [--cwd=] [--logLevel=] [--dedupe] [-f, --force] [-ch, --channel=] ``` The `upgrade` command upgrades Nuxt to the latest version. It updates the version in your [`package.json`](/docs/directory-structure/package), reinstalls dependencies with your package manager and removes the build cache. -`--channel` picks what to upgrade to: `stable` for the latest release, `v3` or `v4` to stay on a major, and `nightly`, `v4-nightly` or `v5-nightly` for the nightly release channel. +`--channel` picks what to upgrade to: `stable` for the latest release, `v4` to stay on a major, and `nightly`, `v4-nightly` or `v5-nightly` for the nightly release channel. `--force` recreates the lockfile and `node_modules` from scratch, and `--dedupe` deduplicates dependencies afterwards where the package manager supports it. @@ -33,11 +33,11 @@ A dependency pinned to a pnpm catalog (`"nuxt": "catalog:"`) is upgraded in `pnp ## Options -| Option | Default | Description | -|--------------------------------------------------------------------|----------|-----------------------------------------------------| -| `--cwd=` | | Specify the root directory of your Nuxt project | -| `--logLevel=` | | Specify build-time log level | -| `--dedupe` | | Dedupe dependencies after upgrading | -| `-f, --force` | | Force upgrade to recreate lockfile and node_modules | -| `-ch, --channel=` | `stable` | Specify a channel to install from | +| Option | Default | Description | +|----------------------------------------------------------------|----------|-----------------------------------------------------| +| `--cwd=` | | Specify the root directory of your Nuxt project | +| `--logLevel=` | | Specify build-time log level | +| `--dedupe` | | Dedupe dependencies after upgrading | +| `-f, --force` | | Force upgrade to recreate lockfile and node_modules | +| `-ch, --channel=` | `stable` | Specify a channel to install from | diff --git a/packages/nuxt-cli/test/unit/commands/upgrade-run.spec.ts b/packages/nuxt-cli/test/unit/commands/upgrade-run.spec.ts index 1463b3e67..5fc6c9b64 100644 --- a/packages/nuxt-cli/test/unit/commands/upgrade-run.spec.ts +++ b/packages/nuxt-cli/test/unit/commands/upgrade-run.spec.ts @@ -142,6 +142,27 @@ describe('upgrade install', () => { expect(runInstall).toHaveBeenCalledWith(expect.objectContaining({ dependencies: ['nuxt@3'] })) }) + it.each([ + ['v3-nightly', '3x'], + ['v4-nightly', '4x'], + ['v5-nightly', '5x'], + ])('should install the %s channel from the %s nightly dist-tag', async (channel, tag) => { + await runUpgrade([`--channel=${channel}`]) + + expect(runInstall).toHaveBeenCalledWith(expect.objectContaining({ dependencies: [`nuxt@npm:nuxt-nightly@${tag}`] })) + }) + + it.each([ + ['4.x', '4x'], + ['5.x', '5x'], + ])('should install the %s nightly picked from the prompt', async (answer, tag) => { + answers.select.push(answer) + + await runUpgrade(['--channel=nightly']) + + expect(runInstall).toHaveBeenCalledWith(expect.objectContaining({ dependencies: [`nuxt@npm:nuxt-nightly@${tag}`] })) + }) + it('should upgrade the core packages the project depends on', async () => { await writeProject({ 'package.json': JSON.stringify({ name: 'app', devDependencies: { 'nuxt': '^4.0.0', '@nuxt/kit': '^4.0.0' } }) }) diff --git a/packages/nuxt-cli/test/unit/help.spec.ts b/packages/nuxt-cli/test/unit/help.spec.ts index ef76b807c..92a463d5b 100644 --- a/packages/nuxt-cli/test/unit/help.spec.ts +++ b/packages/nuxt-cli/test/unit/help.spec.ts @@ -468,10 +468,10 @@ describe('help', () => { OPTIONS - --logLevel= Specify build-time log level - --dedupe Dedupe dependencies after upgrading - -f, --force Force upgrade to recreate lockfile and node_modules - -ch, --channel= Specify a channel to install from (Default: stable) + --logLevel= Specify build-time log level + --dedupe Dedupe dependencies after upgrading + -f, --force Force upgrade to recreate lockfile and node_modules + -ch, --channel= Specify a channel to install from (Default: stable) " `) })