Skip to content

Commit 3a472bf

Browse files
committed
fix(cli): use semver to detect nextjs version
1 parent 5a5a7e4 commit 3a472bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/@sanity/cli/src/actions/init-project/initProject.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,11 @@ export default async function initSanity(
337337
const packageJson = readPackageJson(`${outputPath}/package.json`)
338338
const reactVersion = packageJson.dependencies?.react
339339
const isUsingReact19 = semver.coerce(reactVersion)?.major === 19
340-
if (
340+
const isUsingNextJs15 =
341341
detectedFramework?.slug === 'nextjs' &&
342-
detectedFramework?.detectedVersion?.startsWith('15') &&
343-
isUsingReact19
344-
) {
342+
semver.coerce(detectedFramework?.detectedVersion)?.major === 15
343+
344+
if (isUsingNextJs15 && isUsingReact19) {
345345
warn('╭────────────────────────────────────────────────────────────╮')
346346
warn('│ │')
347347
warn('│ It looks like you are using Next.js 15 and React 19 │')

0 commit comments

Comments
 (0)