Skip to content

Commit

Permalink
fix Next.js bun pages:deploy script (#4276)
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz authored Oct 25, 2023
1 parent d1a4107 commit 3f605cc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/create-cloudflare/src/frameworks/next/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
};
Expand Down

0 comments on commit 3f605cc

Please sign in to comment.