Skip to content

Commit

Permalink
fix(cli): use semver to detect nextjs version
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin committed Oct 23, 2024
1 parent 5a5a7e4 commit 3a472bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/@sanity/cli/src/actions/init-project/initProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ export default async function initSanity(
const packageJson = readPackageJson(`${outputPath}/package.json`)
const reactVersion = packageJson.dependencies?.react
const isUsingReact19 = semver.coerce(reactVersion)?.major === 19
if (
const isUsingNextJs15 =
detectedFramework?.slug === 'nextjs' &&
detectedFramework?.detectedVersion?.startsWith('15') &&
isUsingReact19
) {
semver.coerce(detectedFramework?.detectedVersion)?.major === 15

if (isUsingNextJs15 && isUsingReact19) {
warn('╭────────────────────────────────────────────────────────────╮')
warn('│ │')
warn('│ It looks like you are using Next.js 15 and React 19 │')
Expand Down

0 comments on commit 3a472bf

Please sign in to comment.