lechnerio-git-hooks 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# lechnerio-git-hooks
|
|
2
|
+
|
|
3
|
+
Shared git hooks for all lechnerio projects. Install once, get commit linting, lint-staged, version bumping, and changelog generation.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D lechnerio-git-hooks
|
|
9
|
+
pnpm approve-builds
|
|
10
|
+
pnpm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For pnpm workspaces, add the `-w` flag:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add -wD lechnerio-git-hooks
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## What it does
|
|
20
|
+
|
|
21
|
+
On install, the package automatically:
|
|
22
|
+
|
|
23
|
+
- Copies `pre-commit`, `commit-msg`, and `post-commit` hooks into `.husky/`
|
|
24
|
+
- Copies `generate-changelog.mjs` into `scripts/`
|
|
25
|
+
- Copies `commitlint.config.js` and `.lintstagedrc.js` into the project root
|
|
26
|
+
- Adds a `lint-staged` script to `package.json`
|
|
27
|
+
- Configures git to use `.husky/` as the hooks path
|
|
28
|
+
|
|
29
|
+
## Hooks
|
|
30
|
+
|
|
31
|
+
| Hook | What it does |
|
|
32
|
+
| ------------- | -------------------------------------------------------------------------------------------- |
|
|
33
|
+
| `pre-commit` | Runs lint-staged (eslint --fix + prettier) |
|
|
34
|
+
| `commit-msg` | Enforces conventional commits via commitlint |
|
|
35
|
+
| `post-commit` | Interactive version bump (subtle/patch/minor/major), changelog generation, push/merge prompt |
|
|
36
|
+
|
|
37
|
+
## Peer dependencies (auto-installed)
|
|
38
|
+
|
|
39
|
+
- `@commitlint/cli`
|
|
40
|
+
- `@commitlint/config-conventional`
|
|
41
|
+
- `lint-staged`
|
|
42
|
+
|
|
43
|
+
## Project requirements
|
|
44
|
+
|
|
45
|
+
These are **not** included and must be installed by the project:
|
|
46
|
+
|
|
47
|
+
- `eslint`
|
|
48
|
+
- `prettier`
|
|
49
|
+
|
|
50
|
+
## Environment variables
|
|
51
|
+
|
|
52
|
+
For non-interactive usage (CI, scripts):
|
|
53
|
+
|
|
54
|
+
| Variable | Values |
|
|
55
|
+
| -------------- | --------------------------------------------------------------- |
|
|
56
|
+
| `VERSION_BUMP` | `1` = subtle, `2` = patch, `3` = minor, `4` = major, `0` = skip |
|
|
57
|
+
| `POST_ACTION` | `1` = push, `2` = merge to main, `0` = skip |
|
|
58
|
+
|
|
59
|
+
## Update
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pnpm update lechnerio-git-hooks
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Removing old setup
|
|
66
|
+
|
|
67
|
+
If migrating from a manual setup, remove these before installing:
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
Remove-Item .husky\post-commit
|
|
71
|
+
Remove-Item .husky\pre-commit
|
|
72
|
+
Remove-Item .husky\commit-msg
|
|
73
|
+
Remove-Item commitlint.config.js
|
|
74
|
+
Remove-Item .lintstagedrc.js
|
|
75
|
+
Remove-Item scripts\generate-changelog.mjs
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Also remove these from `devDependencies` if present:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm remove @commitlint/cli @commitlint/config-conventional husky lint-staged
|
|
82
|
+
```
|