Skip to content

Commit

Permalink
fix: Pages router template (#4423)
Browse files Browse the repository at this point in the history
* fixes

* fix

* Create tall-waves-marry.md
  • Loading branch information
siddhsuresh authored Feb 14, 2025
1 parent 2661bcd commit 0a257e9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/tall-waves-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blitzjs/generator": patch
---

fix: Pages router blitz rpc api not generated in the correct format
16 changes: 13 additions & 3 deletions packages/generator/src/generators/app-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,28 @@ export class AppGenerator extends Generator<AppGeneratorOptions> {
this.destinationPath("package.json"),
)

const rpcEndpointPath = `src/app/api/rpc/blitzrpcroute/route.${
const appRpcEndpointPath = `src/app/api/rpc/blitzrpcroute/route.${
this.options.useTs ? "ts" : "js"
}`
if (this.fs.exists(rpcEndpointPath)) {
if (this.fs.exists(appRpcEndpointPath)) {
this.fs.move(
this.destinationPath(rpcEndpointPath),
this.destinationPath(appRpcEndpointPath),
this.destinationPath(
`src/app/api/rpc/[[...blitz]]/route.${this.options.useTs ? "ts" : "js"}`,
),
)
}

const pagesRpcEndpointPath = `src/pages/api/rpc/blitzrpcroute.${
this.options.useTs ? "ts" : "js"
}`
if (this.fs.exists(pagesRpcEndpointPath)) {
this.fs.move(
this.destinationPath(pagesRpcEndpointPath),
this.destinationPath(`src/pages/api/rpc/[[...blitz]].${this.options.useTs ? "ts" : "js"}`),
)
}

if (this.options.template.path === "app") {
const pathsToMove = [
"src/app/auth/components/LoginForm.tsx",
Expand Down
6 changes: 3 additions & 3 deletions packages/generator/templates/pages/package.js.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "6.1.0",
"blitz": "latest",
"next": "14.2.15",
"next": "15.0.1",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"secure-password": "4.0.0",
"zod": "3.23.8"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/generator/templates/pages/package.ts.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "6.1.0",
"blitz": "latest",
"next": "14.2.15",
"next": "15.0.1",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"secure-password": "4.0.0",
"zod": "3.23.8"
},
Expand Down

0 comments on commit 0a257e9

Please sign in to comment.