diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d3ff047..23de63a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,12 +2,13 @@ ## Development Workflow -1. Create a feature branch from `main` -2. Make your changes with conventional commits -3. Push and create a Pull Request -4. CI runs tests, linting, and type checking -5. After approval, rebase and merge to `main` -6. Semantic Release automatically creates a new version +1. Run `pnpm install` to install dependencies and set up Git hooks via Husky +2. Create a feature branch from `main` +3. Make your changes with conventional commits +4. Push and create a Pull Request +5. CI runs tests, linting, and type checking +6. After approval, rebase and merge to `main` +7. Semantic Release automatically creates a new version ## Commit Convention @@ -18,6 +19,20 @@ Use conventional commits for automatic versioning: - `feat!:` or `BREAKING CHANGE:` - Breaking change (major version) - `docs:`, `chore:`, `test:` - No version bump +## Husky setup + +This project relies on Husky for Git hooks. Husky is installed as a dev dependency, so +the hooks have to be configured locally: + +- `pnpm install` (or `npm install`) runs the `prepare` lifecycle script, which invokes + Husky and writes the hooks into `.git/hooks`. +- The `prepare` script also runs automatically before `pnpm publish`, `pnpm pack`, and + when installing the project from a Git URL. This ensures the hooks are present for + contributors and before release builds are created. +- Unlike `postinstall`, `prepare` is skipped for consumers installing the published + package from the npm registry. That keeps end users from needing Husky (or other dev + tooling) in their production environments. + ## Code Quality All code must pass: @@ -32,4 +47,4 @@ All code must pass: - Keep changes focused and atomic - Ensure all CI checks pass - Request review from maintainers -- Rebase before merging to maintain linear history \ No newline at end of file +- Rebase before merging to maintain linear history diff --git a/package.json b/package.json index 3555e62..1eab62b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "bench:gc": "node --expose-gc node_modules/.bin/tsx benchmark/index.ts", "bench:watch": "tsx watch benchmark/index.ts", "prepare": "husky", - "postinstall": "husky", "prepublishOnly": "pnpm build", "release": "semantic-release" },