Skip to content

Commit

Permalink
fix: update Husky setup for production and CI
Browse files Browse the repository at this point in the history
Add script to skip Husky install in production and CI. Adjust workflow and package.json.
  • Loading branch information
gentlementlegen committed Oct 11, 2024
1 parent ca08e9f commit 9a76d37
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ permissions:
contents: write
pull-requests: write

env:
HUSKY: 0

jobs:
release-please:
runs-on: ubuntu-latest
Expand Down
8 changes: 8 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Skip Husky install in production and CI
// https://typicode.github.io/husky/how-to.html#ci-server-and-docker
if (process.env.NODE_ENV === "production" || process.env.CI === "true") {
console.log("Skipping Husky install because of production environment.");
process.exit(0);
}
const husky = (await import("husky")).default;
console.log(husky());
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"format:lint": "eslint --fix .",
"format:prettier": "prettier --write .",
"format:cspell": "cspell **/*",
"prepare": "husky install",
"prepare": "node .husky/install.mjs",
"deploy-dev": "wrangler deploy --env dev",
"deploy-production": "wrangler deploy --env production",
"worker": "wrangler dev --env dev --port 8787",
Expand Down

0 comments on commit 9a76d37

Please sign in to comment.