Skip to content

Commit f764b29

Browse files
committed
build: add pre-commit hooks with simple-git-hooks and lint-staged
Replace redundant root-level script aliases (dev, build, test:unit, lint, etc.) that merely wrapped `pnpm -r run <task>`. Each sub-package already defines its own scripts, so the aliases added no value. - Add simple-git-hooks + lint-staged for pre-commit quality gates (oxlint/oxfmt on staged files, then unit tests across all packages) - Keep only `prepare` script to auto-install hooks on `pnpm install` - Update CI workflow to call `pnpm -r run` directly
1 parent 3d0bc10 commit f764b29

3 files changed

Lines changed: 235 additions & 27 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
- name: Install dependencies
2222
run: pnpm install --frozen-lockfile
2323
- name: Check
24-
run: pnpm run check:ci
24+
run: pnpm -r run check:ci
2525
- name: Test
26-
run: pnpm run test:unit
26+
run: pnpm -r run test:unit
2727
- name: Build
2828
run: |
2929
cp apps/webapp/.env.local.example apps/webapp/.env.local
30-
pnpm run build
30+
pnpm -r run build

package.json

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
{
22
"private": true,
3+
"simple-git-hooks": {
4+
"pre-commit": "pnpm exec lint-staged && pnpm -r run test:unit"
5+
},
6+
"lint-staged": {
7+
"*.{ts,tsx,js,jsx,mjs,cjs}": ["oxlint --config oxlintrc.json --fix", "oxfmt --write"]
8+
},
39
"scripts": {
4-
"dev": "pnpm -r run --if-present --parallel dev",
5-
"build": "pnpm -r run --if-present build",
6-
"test:unit": "pnpm -r run --if-present test:unit",
7-
"test:integ": "pnpm -r run --if-present test:integ",
8-
"test:e2e": "pnpm -r run --if-present test:e2e",
9-
"test:watch": "pnpm -r run --if-present --parallel test:watch",
10-
"format": "pnpm -r run --if-present format",
11-
"format:ci": "pnpm -r run --if-present format:ci",
12-
"lint": "pnpm -r run --if-present lint",
13-
"lint:ci": "pnpm -r run --if-present lint:ci",
14-
"check": "pnpm run lint && pnpm run format",
15-
"check:ci": "pnpm run lint:ci && pnpm run format:ci",
16-
"test": "pnpm run check && pnpm run test:unit && pnpm run test:integ && pnpm run test:e2e"
10+
"prepare": "simple-git-hooks"
1711
},
1812
"devDependencies": {
1913
"esbuild": "^0.25.4",
14+
"lint-staged": "^16.4.0",
2015
"oxfmt": "^0",
2116
"oxlint": "^1",
22-
"oxlint-tsgolint": "^0"
17+
"oxlint-tsgolint": "^0",
18+
"simple-git-hooks": "^2.13.1"
2319
},
2420
"packageManager": "pnpm@10.8.1",
2521
"pnpm": {

0 commit comments

Comments
 (0)