File tree 2 files changed +19
-6
lines changed
packages/create-cloudflare/src/frameworks/next
2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " create-cloudflare " : patch
3
+ ---
4
+
5
+ fix the generation of invalid/incorrect scripts for Next.js applications
Original file line number Diff line number Diff line change @@ -141,12 +141,20 @@ const config: FrameworkConfig = {
141
141
generate,
142
142
configure,
143
143
displayName : "Next" ,
144
- getPackageScripts : async ( ) => ( {
145
- "pages:build" : `${ dlx } @cloudflare/next-on-pages@1` ,
146
- "pages:deploy" : `${ npm } run pages:build && wrangler pages deploy .vercel/output/static` ,
147
- "pages:watch" : `${ npx } @cloudflare/next-on-pages@1 --watch` ,
148
- "pages:dev" : `${ npx } wrangler pages dev .vercel/output/static ${ await compatDateFlag ( ) } --compatibility-flag=nodejs_compat` ,
149
- } ) ,
144
+ getPackageScripts : async ( ) => {
145
+ const isNpmOrBun = [ "npm" , "bun" ] . includes ( npm ) ;
146
+ const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "" ;
147
+ const nextOnPagesCommand = `${ nextOnPagesScope } next-on-pages` ;
148
+ const pmCommand = isNpmOrBun ? npx : npm ;
149
+ return {
150
+ "pages:build" : `${ pmCommand } ${ nextOnPagesCommand } ` ,
151
+ "pages:deploy" : `${
152
+ npm === "npm" ? "npm run" : pmCommand
153
+ } pages:build && wrangler pages deploy .vercel/output/static`,
154
+ "pages:watch" : `${ pmCommand } ${ nextOnPagesCommand } --watch` ,
155
+ "pages:dev" : `${ pmCommand } wrangler pages dev .vercel/output/static ${ await compatDateFlag ( ) } --compatibility-flag=nodejs_compat` ,
156
+ } ;
157
+ } ,
150
158
testFlags : [
151
159
"--typescript" ,
152
160
"--no-install" ,
You can’t perform that action at this time.
0 commit comments