# Improve Developer Experience with Husky and lint-staged for pnpm Monorepo ## Summary This PR enhances the developer experience by configuring Husky and lint-staged to work properly with our pnpm monorepo structure. It centralizes Git hooks at the root level and ensures consistent code quality across the project. ## Changes - Centralized Husky and lint-staged configuration at the monorepo root - Added pre-commit hook that runs lint-staged to enforce code quality - Configured lint-staged to: - Format JSON, MD, and YAML files with Prettier - Lint and typecheck TypeScript files before commits - Fixed release script in codex-cli package.json (changed "pmpm" to "npm publish") - Removed duplicate Husky and lint-staged configurations from codex-cli package.json ## Benefits - **Consistent Code Quality**: Ensures all committed code meets project standards - **Automated Formatting**: Automatically formats code during commits - **Early Error Detection**: Catches type errors and lint issues before they're committed - **Centralized Configuration**: Easier to maintain and update in one place - **Improved Collaboration**: Ensures consistent code style across the team ## Future Improvements We could further enhance this setup by **Commit Message Validation**: Add commitlint to enforce conventional commit messages --------- Co-authored-by: Thibault Sottiaux <tibo@openai.com>
46 lines
1.3 KiB
JSON
46 lines
1.3 KiB
JSON
{
|
|
"name": "codex-monorepo",
|
|
"private": true,
|
|
"description": "Tools for repo-wide maintenance.",
|
|
"scripts": {
|
|
"release": "pnpm --filter @openai/codex run release",
|
|
"format": "prettier --check *.json *.md .github/workflows/*.yml",
|
|
"format:fix": "prettier --write *.json *.md .github/workflows/*.yml",
|
|
"build": "pnpm --filter @openai/codex run build",
|
|
"test": "pnpm --filter @openai/codex run test",
|
|
"lint": "pnpm --filter @openai/codex run lint",
|
|
"typecheck": "pnpm --filter @openai/codex run typecheck",
|
|
"changelog": "git-cliff --config cliff.toml --output CHANGELOG.ignore.md $LAST_RELEASE_TAG..HEAD",
|
|
"prepare": "husky",
|
|
"husky:add": "husky add"
|
|
},
|
|
"devDependencies": {
|
|
"git-cliff": "^2.8.0",
|
|
"husky": "^9.1.7",
|
|
"lint-staged": "^15.5.1",
|
|
"prettier": "^3.5.3"
|
|
},
|
|
"resolutions": {
|
|
"braces": "^3.0.3",
|
|
"micromatch": "^4.0.8",
|
|
"semver": "^7.7.1"
|
|
},
|
|
"overrides": {
|
|
"punycode": "^2.3.1"
|
|
},
|
|
"engines": {
|
|
"node": ">=22",
|
|
"pnpm": ">=9.0.0"
|
|
},
|
|
"lint-staged": {
|
|
"*.json": "prettier --write",
|
|
"*.md": "prettier --write",
|
|
".github/workflows/*.yml": "prettier --write",
|
|
"**/*.{js,ts,tsx}": [
|
|
"pnpm --filter @openai/codex run lint",
|
|
"pnpm --filter @openai/codex run typecheck"
|
|
]
|
|
},
|
|
"packageManager": "pnpm@10.8.1"
|
|
}
|