Skip to content

Commit

Permalink
SQUASHME: update CircleCI script and add Husky hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvogt committed Dec 2, 2024
1 parent cb5a928 commit 5cea0ac
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
10 changes: 9 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
jobs:
build:
docker:
- image: cimg/node:20.9.0 # Updated to Node 20.9.0
- image: cimg/node:20.9.0 # Updated to Node 20.9.0

working_directory: ~/gatsby-theme-chrisvogt

Expand All @@ -26,6 +26,14 @@ jobs:
paths:
- ~/.cache/yarn

- run:
name: Run Prettier Check
command: yarn prettier --check .

- run:
name: Run ESLint Check
command: yarn lint

- run:
name: Unit Tests w/Coverage
command: yarn workspace gatsby-theme-chrisvogt test:coverage --maxWorkers=2
Expand Down
6 changes: 2 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Format staged files with Prettier
# Run Prettier and ESLint on staged files
npx pretty-quick --staged

# Lint staged files with ESLint
npx eslint --fix $(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(js|json)$') || exit 1
npx eslint --fix $(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(js|jsx|ts|tsx)$') || exit 1
3 changes: 3 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Run tests and lint the full codebase
yarn test --passWithNoTests || exit 1
npx eslint . || exit 1
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"develop": "yarn workspace www.chrisvogt.me develop:https",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
"lint": "eslint",
"test": "yarn workspace gatsby-theme-chrisvogt test",
"test:watch": "yarn workspace gatsby-theme-chrisvogt test:watch",
"postinstall": "node index.js",
"prepare": "husky install"
"prepare": "husky install",
"prettier": "prettier",
"test:coverage": "yarn workspace gatsby-theme-chrisvogt test --coverage",
"test:watch": "yarn workspace gatsby-theme-chrisvogt test:watch",
"test": "yarn workspace gatsby-theme-chrisvogt test"
},
"devDependencies": {
"@eslint/compat": "^1.2.3",
Expand Down

0 comments on commit 5cea0ac

Please sign in to comment.