Skip to content

Commit

Permalink
Remove husky prepush hook & update precommit hook to only run prettier (
Browse files Browse the repository at this point in the history
#3984)

* Remove husky prepush hook & update precommit hook to only run prettier for full app & minimal app templates

* pnpmlock
  • Loading branch information
Dillon Raphael authored Dec 20, 2022
1 parent 13c2642 commit 77b7da0
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 123 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-candles-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blitzjs/generator": patch
---

Remove husky prepush hook & update precommit hook to only run prettier
4 changes: 3 additions & 1 deletion packages/blitz/src/utils/enhance-prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export const enhancePrisma = <TPrismaClientCtor extends Constructor>(
const process = spawn(prismaBin, ["migrate", "reset", "--force", "--skip-generate"], {
stdio: "ignore",
})
process.on("exit", (code) => (code === 0 ? res(0) : rej(new Error(`db.$reset() failed with code ${code}`))))
process.on("exit", (code) =>
code === 0 ? res(0) : rej(new Error(`db.$reset() failed with code ${code}`)),
)
})
globalThis._blitz_prismaClient.$disconnect()
}
Expand Down
16 changes: 2 additions & 14 deletions packages/generator/src/generators/app-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,9 @@ export class AppGenerator extends Generator<AppGeneratorOptions> {

filesToIgnore() {
if (!this.options.useTs) {
return [
"tsconfig.json",
"next-env.d.ts",
"jest.config.ts",
"package.ts.json",
"vitest-config.ts",
"pre-push-ts",
"types.ts",
]
return ["tsconfig.json", "next-env.d.ts", "vitest-config.ts", "package.ts.json", "types.ts"]
}
return ["jsconfig.json", "package.js.json", "vitest.config.js", "pre-push-js"]
return ["jsconfig.json", "package.js.json", "vitest.config.js"]
}

async getTemplateValues() {
Expand All @@ -70,10 +62,6 @@ export class AppGenerator extends Generator<AppGeneratorOptions> {
async preCommit() {
this.fs.move(this.destinationPath("gitignore"), this.destinationPath(".gitignore"))
this.fs.move(this.destinationPath("npmrc"), this.destinationPath(".npmrc"))
this.fs.move(
this.destinationPath(this.options.useTs ? ".husky/pre-push-ts" : ".husky/pre-push-js"),
this.destinationPath(".husky/pre-push"),
)
this.fs.move(
this.destinationPath(this.options.useTs ? "package.ts.json" : "package.js.json"),
this.destinationPath("package.json"),
Expand Down
1 change: 0 additions & 1 deletion packages/generator/templates/app/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npx pretty-quick --staged
5 changes: 0 additions & 5 deletions packages/generator/templates/app/.husky/pre-push-js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/generator/templates/app/.husky/pre-push-ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/generator/templates/minimalapp/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npx pretty-quick --staged
5 changes: 0 additions & 5 deletions packages/generator/templates/minimalapp/.husky/pre-push-js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/generator/templates/minimalapp/.husky/pre-push-ts

This file was deleted.

Loading

0 comments on commit 77b7da0

Please sign in to comment.