Skip to content

Commit

Permalink
Add Husky to enforce pre-push yarn fmt-check (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
judeallred authored Oct 10, 2023
1 parent e7469eb commit 09d1f25
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .config/husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh
set -e

. "$(dirname -- "$0")/_/husky.sh"

echo "************************************************************************"
echo "** Running sim-core's 'yarn fmt-check' **"
echo "** If this fails, run 'yarn fmt' and commit your fixes. **"
echo "** (Output is stored in .config/husky/husky.log) **"
echo "** This takes about 10 seconds... **"
echo "************************************************************************"

cd apps/sim-core || exit 1
yarn fmt-check > ../../.config/husky/husky.log 2>&1;

echo "** Formatting check success. **"
echo "************************************************************************"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
.next
.old/
.vscode/
.config/**/*.log
dist/
node_modules/
target/
test_artifacts/
test_artifacts/
2 changes: 2 additions & 0 deletions apps/sim-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"// 02": "",
"preinstall": "node scripts/preinstall.js",
"postinstall": "yarn build:utils && yarn build:engine-web",
"prepare": "cd ../.. && husky install .config/husky",
"all": "npx npm-run-all",
"fmt:scripts": "prettier \"scripts/**/*.{ts,tsx,js,json}\" --write",
"fmt-check:scripts": "prettier \"scripts/**/*.{ts,tsx,js,json}\" --check",
Expand Down Expand Up @@ -110,6 +111,7 @@
"file-loader": "6.2.0",
"fork-ts-checker-webpack-plugin": "6.0.3",
"html-webpack-plugin": "4.5.1",
"husky": "^8.0.0",
"identity-obj-proxy": "3.0.0",
"jest": "26.6.3",
"jest-canvas-mock": "2.3.0",
Expand Down
5 changes: 5 additions & 0 deletions apps/sim-core/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9506,6 +9506,11 @@ human-signals@^1.1.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==

husky@^8.0.0:
version "8.0.3"
resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184"
integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==

hyphenate-style-name@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d"
Expand Down

0 comments on commit 09d1f25

Please sign in to comment.