From 60e4adaec291c80c7dba5b73454f469a60b3148b Mon Sep 17 00:00:00 2001 From: Xavier Rutayisire Date: Mon, 30 Oct 2023 10:07:38 +0100 Subject: [PATCH] feat(Next): Support Next.js 14 --- cypress-setup.sh | 2 +- packages/init/src/lib/framework.ts | 12 ++++++------ ...eMachineInitProcess-detectEnvironment.test.ts | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cypress-setup.sh b/cypress-setup.sh index eab1408fcd..c702fc82aa 100755 --- a/cypress-setup.sh +++ b/cypress-setup.sh @@ -26,7 +26,7 @@ else fi rm -rf e2e-projects/cypress-next-app \ -&& yarn dlx --quiet create-next-app@13.5.4 --app --eslint --import-alias '@/*' --no-src-dir --tailwind --typescript --use-npm e2e-projects/cypress-next-app \ +&& yarn dlx --quiet create-next-app@latest --app --eslint --import-alias '@/*' --no-src-dir --tailwind --typescript --use-npm e2e-projects/cypress-next-app \ && yarn dlx --quiet vite-node ./cypress/plugins/addAuth.ts -- ${EMAIL} ${PASSWORD} ${PRISMIC_URL} \ && yarn dlx --quiet vite-node ./cypress/plugins/createRepo.ts -- "${_PRISMIC_REPO}" "${PASSWORD}" "${PRISMIC_URL}" \ && yarn workspaces foreach --include '{@slicemachine/adapter-next,@slicemachine/init,@slicemachine/manager,@slicemachine/plugin-kit,slice-machine-ui,start-slicemachine}' --topological --verbose pack --out "${THIS_DIR}"/e2e-projects/cypress-next-app/%s-%v.tgz \ diff --git a/packages/init/src/lib/framework.ts b/packages/init/src/lib/framework.ts index 892f6604e7..21ba5b0587 100644 --- a/packages/init/src/lib/framework.ts +++ b/packages/init/src/lib/framework.ts @@ -16,7 +16,7 @@ export type Framework = { * Framework 's id sent to Segment from Slice Machine */ sliceMachineTelemetryID: - | "next-11-13" + | "next" | "nuxt-2" | "nuxt-3" | "sveltekit-1" @@ -97,14 +97,14 @@ export const FRAMEWORKS: Record = { "@slicemachine/adapter-nuxt": isPrerelease ? "alpha" : "latest", }, }, - "next-11-13": { - name: "Next.js 11-13", - sliceMachineTelemetryID: "next-11-13", + next: { + name: "Next.js", + sliceMachineTelemetryID: "next", wroomTelemetryID: "next", - prismicDocumentation: "https://prismic.dev/init/next-11-13", + prismicDocumentation: "https://prismic.dev/init/next", adapterName: "@slicemachine/adapter-next", compatibility: { - next: "^11.0.0 || ^12.0.0 || ^13.0.0", + next: ">=11.0.0", }, devDependencies: { ...DEFAULT_DEV_DEPENDENCIES, diff --git a/packages/init/test/SliceMachineInitProcess-detectEnvironment.test.ts b/packages/init/test/SliceMachineInitProcess-detectEnvironment.test.ts index cb283324e8..ae74c71107 100644 --- a/packages/init/test/SliceMachineInitProcess-detectEnvironment.test.ts +++ b/packages/init/test/SliceMachineInitProcess-detectEnvironment.test.ts @@ -35,15 +35,15 @@ it("detects framework, starter and package manager", async () => { "framework": { "adapterName": "@slicemachine/adapter-next", "compatibility": { - "next": "^11.0.0 || ^12.0.0 || ^13.0.0", + "next": ">=14.0.0", }, "devDependencies": { "@slicemachine/adapter-next": "latest", "slice-machine-ui": "latest", }, - "name": "Next.js 11-13", - "prismicDocumentation": "https://prismic.dev/init/next-11-13", - "sliceMachineTelemetryID": "next-11-13", + "name": "Next.js", + "prismicDocumentation": "https://prismic.dev/init/next", + "sliceMachineTelemetryID": "next", "wroomTelemetryID": "next", }, "packageManager": "npm", @@ -82,15 +82,15 @@ it("assumes unconventional tags match semver range when detecting framework", as "framework": { "adapterName": "@slicemachine/adapter-next", "compatibility": { - "next": "^11.0.0 || ^12.0.0 || ^13.0.0", + "next": ">=14.0.0", }, "devDependencies": { "@slicemachine/adapter-next": "latest", "slice-machine-ui": "latest", }, - "name": "Next.js 11-13", - "prismicDocumentation": "https://prismic.dev/init/next-11-13", - "sliceMachineTelemetryID": "next-11-13", + "name": "Next.js", + "prismicDocumentation": "https://prismic.dev/init/next", + "sliceMachineTelemetryID": "next", "wroomTelemetryID": "next", }, "packageManager": "npm",