Skip to content

Commit 0a257e9

Browse files
authored
fix: Pages router template (#4423)
* fixes * fix * Create tall-waves-marry.md
1 parent 2661bcd commit 0a257e9

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

.changeset/tall-waves-marry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@blitzjs/generator": patch
3+
---
4+
5+
fix: Pages router blitz rpc api not generated in the correct format

packages/generator/src/generators/app-generator.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,28 @@ export class AppGenerator extends Generator<AppGeneratorOptions> {
6868
this.destinationPath("package.json"),
6969
)
7070

71-
const rpcEndpointPath = `src/app/api/rpc/blitzrpcroute/route.${
71+
const appRpcEndpointPath = `src/app/api/rpc/blitzrpcroute/route.${
7272
this.options.useTs ? "ts" : "js"
7373
}`
74-
if (this.fs.exists(rpcEndpointPath)) {
74+
if (this.fs.exists(appRpcEndpointPath)) {
7575
this.fs.move(
76-
this.destinationPath(rpcEndpointPath),
76+
this.destinationPath(appRpcEndpointPath),
7777
this.destinationPath(
7878
`src/app/api/rpc/[[...blitz]]/route.${this.options.useTs ? "ts" : "js"}`,
7979
),
8080
)
8181
}
8282

83+
const pagesRpcEndpointPath = `src/pages/api/rpc/blitzrpcroute.${
84+
this.options.useTs ? "ts" : "js"
85+
}`
86+
if (this.fs.exists(pagesRpcEndpointPath)) {
87+
this.fs.move(
88+
this.destinationPath(pagesRpcEndpointPath),
89+
this.destinationPath(`src/pages/api/rpc/[[...blitz]].${this.options.useTs ? "ts" : "js"}`),
90+
)
91+
}
92+
8393
if (this.options.template.path === "app") {
8494
const pathsToMove = [
8595
"src/app/auth/components/LoginForm.tsx",

packages/generator/templates/pages/package.js.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"@blitzjs/rpc": "latest",
2828
"@prisma/client": "6.1.0",
2929
"blitz": "latest",
30-
"next": "14.2.15",
30+
"next": "15.0.1",
3131
"prisma": "6.1.0",
32-
"react": "18.2.0",
33-
"react-dom": "18.2.0",
32+
"react": "19.0.0",
33+
"react-dom": "19.0.0",
3434
"secure-password": "4.0.0",
3535
"zod": "3.23.8"
3636
},

packages/generator/templates/pages/package.ts.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"@blitzjs/rpc": "latest",
2828
"@prisma/client": "6.1.0",
2929
"blitz": "latest",
30-
"next": "14.2.15",
30+
"next": "15.0.1",
3131
"prisma": "6.1.0",
32-
"react": "18.2.0",
33-
"react-dom": "18.2.0",
32+
"react": "19.0.0",
33+
"react-dom": "19.0.0",
3434
"secure-password": "4.0.0",
3535
"zod": "3.23.8"
3636
},

0 commit comments

Comments
 (0)