Skip to content

Commit

Permalink
Remove lint-staged from root and update script.
Browse files Browse the repository at this point in the history
- remove lint-staged that was accidentally installed on root instead of coral.
- add lint-staged package to coral
- add script to package.json
- update pre-commit script to always change to git-root/coral
- use variable for frontend-root to make it easier to change that later
- remove echo
- use --prefix instead of changing directory
  • Loading branch information
programmiri committed Oct 21, 2022
1 parent a8f7e56 commit 3b55942
Show file tree
Hide file tree
Showing 5 changed files with 295 additions and 506 deletions.
12 changes: 6 additions & 6 deletions coral/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

FRONTEND_ROOT="coral"
GIT_ROOT=$(git rev-parse --show-toplevel)
STAGED_FILES=$(git diff --staged --name-only)

if echo "$STAGED_FILES" | grep -q coral;
if echo "$STAGED_FILES" | grep -q "$FRONTEND_ROOT";
then
echo 'Files on coral staged'
cd coral || return
pnpm lint-staged
pnpm test --bail
fi
pnpm --prefix="$GIT_ROOT"/"$FRONTEND_ROOT" lint-staged
pnpm --prefix="$GIT_ROOT"/"$FRONTEND_ROOT" test --bail
fi
4 changes: 3 additions & 1 deletion coral/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"preview": "vite preview",
"reformat": "prettier --write src",
"test": "jest",
"test-dev": "jest --watch"
"test-dev": "jest --watch",
"lint-staged": "lint-staged"
},
"lint-staged": {
"**/*.{ts,tsx}": [
Expand Down Expand Up @@ -46,6 +47,7 @@
"husky": "^8.0.1",
"jest": "^29.2.1",
"jest-environment-jsdom": "^29.2.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
Expand Down
Loading

0 comments on commit 3b55942

Please sign in to comment.