Skip to content

Commit 7d43809

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

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,10 @@ 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 (
341-
detectedFramework?.slug === 'nextjs' &&
342-
detectedFramework?.detectedVersion?.startsWith('15') &&
343-
isUsingReact19
344-
) {
340+
const isUsingNextJs15 =
341+
detectedFramework?.slug === 'nextjs' && detectedFramework?.detectedVersion?.startsWith('15')
342+
343+
if (isUsingNextJs15 && isUsingReact19) {
345344
warn('╭────────────────────────────────────────────────────────────╮')
346345
warn('│ │')
347346
warn('│ It looks like you are using Next.js 15 and React 19 │')

0 commit comments

Comments
 (0)