Skip to content

Commit

Permalink
Use src instead of app folder for blitz generate custom-template (#…
Browse files Browse the repository at this point in the history
…4033)

* Use src instead of app in `customTemplates: "src/templates"`

* Use src instead of app in `cli/commands/generate`

* Add changeset

* remove ignored packages

Co-authored-by: Brandon Bayer <[email protected]>
Co-authored-by: Siddharth Suresh <[email protected]>
  • Loading branch information
3 people authored Jan 11, 2023
1 parent 2703618 commit 989691e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-teachers-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"blitz": patch
---

Use `src` instead of `app` folder for `blitz generate custom-template`
2 changes: 1 addition & 1 deletion apps/toolkit-app/src/blitz-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ const { gSSP, gSP, api } = setupBlitzServer({
export { gSSP, gSP, api }

export const cliConfig: BlitzCliConfig = {
customTemplates: "app/templates",
customTemplates: "src/templates",
}
2 changes: 1 addition & 1 deletion integration-tests/auth-with-rpc/src/blitz-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ const {gSSP, gSP, api} = setupBlitzServer({
export {gSSP, gSP, api}

export const cliConfig: BlitzCliConfig = {
customTemplates: "app/templates",
customTemplates: "src/templates",
}
6 changes: 3 additions & 3 deletions packages/blitz/src/cli/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const createCustomTemplates = async () => {
const continuePrompt = await prompts({
type: "confirm",
name: "value",
message: `This will copy the default templates to your app/templates folder. Do you want to continue?`,
message: `This will copy the default templates to your src/templates folder. Do you want to continue?`,
})
if (!continuePrompt.value) {
process.exit(0)
Expand All @@ -61,12 +61,12 @@ const createCustomTemplates = async () => {
type: "text",
name: "value",
message: `Enter the path to save the custom templates folder`,
initial: "app/templates",
initial: "src/templates",
})
const templatesPathValue: string = templatesPath.value
const isTypeScript = await getIsTypeScript()
await customTemplatesBlitzConfig(isTypeScript, templatesPathValue, true) // to run the codemod
log.success(`🚀 Custom templates path added/updated in app/blitz-server file`)
log.success(`🚀 Custom templates path added/updated in src/blitz-server file`)
const customTemplatesPath = require("path").join(process.cwd(), templatesPathValue)
const fsExtra = await import("fs-extra")
const blitzGeneratorPath = require.resolve("@blitzjs/generator")
Expand Down

0 comments on commit 989691e

Please sign in to comment.