From 3f605cc830fa989bf1e16e13ad998519a43b14c7 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Wed, 25 Oct 2023 19:05:58 +0100 Subject: [PATCH] fix Next.js bun pages:deploy script (#4276) --- packages/create-cloudflare/src/frameworks/next/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/create-cloudflare/src/frameworks/next/index.ts b/packages/create-cloudflare/src/frameworks/next/index.ts index 1f3c016afd45..f4a31e9a9276 100644 --- a/packages/create-cloudflare/src/frameworks/next/index.ts +++ b/packages/create-cloudflare/src/frameworks/next/index.ts @@ -142,15 +142,16 @@ const config: FrameworkConfig = { configure, displayName: "Next", getPackageScripts: async () => { - const isNpmOrBun = ["npm", "bun"].includes(npm); + const isNpm = npm === "npm"; + const isBun = npm === "bun"; + const isNpmOrBun = isNpm || isBun; const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : ""; const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`; const pmCommand = isNpmOrBun ? npx : npm; + const pagesDeployCommand = isNpm ? "npm run" : isBun ? "bun" : pmCommand; return { "pages:build": `${pmCommand} ${nextOnPagesCommand}`, - "pages:deploy": `${ - npm === "npm" ? "npm run" : pmCommand - } pages:build && wrangler pages deploy .vercel/output/static`, + "pages:deploy": `${pagesDeployCommand} pages:build && wrangler pages deploy .vercel/output/static`, "pages:watch": `${pmCommand} ${nextOnPagesCommand} --watch`, "pages:dev": `${pmCommand} wrangler pages dev .vercel/output/static ${await compatDateFlag()} --compatibility-flag=nodejs_compat`, };