From c858b136a1960cb4eecbc22337e8b3e074963313 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Tue, 15 Oct 2024 22:01:44 +0200 Subject: [PATCH] next-upgrade: Update all Next.js packages This is basically acting like when you'd have Syncpack installed. Some of these packages probably don't make sense to have installed but ~this is america~ why be opinionated about it when we only bump the dependency is already declared. --- packages/next-codemod/bin/upgrade.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/next-codemod/bin/upgrade.ts b/packages/next-codemod/bin/upgrade.ts index c27d4f4fbeb56..3305462157b1b 100644 --- a/packages/next-codemod/bin/upgrade.ts +++ b/packages/next-codemod/bin/upgrade.ts @@ -16,6 +16,23 @@ import { BadInput } from './shared' type PackageManager = 'pnpm' | 'npm' | 'yarn' | 'bun' +const optionalNextjsPackages = [ + 'create-next-app', + 'eslint-config-next', + '@next/bundle-analyzer', + '@next/codemod', + '@next/env', + '@next/eslint-plugin-next', + '@next/font', + '@next/mdx', + '@next/plugin-storybook', + '@next/polyfill-module', + '@next/polyfill-nomodule', + '@next/swc', + '@next/react-refresh-utils', + '@next/third-parties', +] + /** * @param query * @example loadHighestNPMVersionMatching("react@^18.3.0 || ^19.0.0") === Promise<"19.0.0"> @@ -191,6 +208,12 @@ export async function runUpgrade( 'react-dom': { version: targetReactVersion, required: true }, 'react-is': { version: targetReactVersion, required: false }, } + for (const optionalNextjsPackage of optionalNextjsPackages) { + versionMapping[optionalNextjsPackage] = { + version: targetNextVersion, + required: false, + } + } if ( targetReactVersion.startsWith('19.0.0-canary') ||