You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an opinionated TypeScript Starter kit to help kick-start development of your next Bun package.
11
+
> Efficient Git Commit Message Linting and Formatting
12
12
13
-
## Features
13
+
GitLint is a tool for enforcing consistent Git commit message conventions. It analyzes commit messages to ensure they follow the [Conventional Commits](https://www.conventionalcommits.org/) specification and other configurable rules.
14
14
15
-
This Starter Kit comes pre-configured with the following:
15
+
## Installation
16
16
17
-
- 🛠️ [Powerful Build Process](https://github.com/oven-sh/bun) - via Bun
18
-
- 💪🏽 [Fully Typed APIs](https://www.typescriptlang.org/) - via TypeScript
19
-
- 📚 [Documentation-ready](https://vitepress.dev/) - via VitePress
20
-
- ⌘ [CLI & Binary](https://www.npmjs.com/package/bunx) - via Bun & CAC
21
-
- 🧪 [Built With Testing In Mind](https://bun.sh/docs/cli/test) - pre-configured unit-testing powered by [Bun](https://bun.sh/docs/cli/test)
- 🎨 [ESLint](https://eslint.org/) - for code linting _(and formatting)_
24
-
- 📦️ [pkg.pr.new](https://pkg.pr.new) - Continuous (Preview) Releases for your libraries
25
-
- 🐙 [GitHub Actions](https://github.com/features/actions) - runs your CI _(fixes code style issues, tags releases & creates its changelogs, runs the test suite, etc.)_
17
+
```bash
18
+
# Install globally
19
+
npm install -g gitlint
20
+
21
+
# Or using bun
22
+
bun install -g gitlint
23
+
```
24
+
25
+
## Usage
26
+
27
+
### CLI
28
+
29
+
```bash
30
+
# Check a commit message from a file
31
+
gitlint path/to/commit-message.txt
32
+
33
+
# Use with git commit message hook (common use case)
34
+
gitlint --edit $1
35
+
36
+
# Show help
37
+
gitlint --help
38
+
```
39
+
40
+
### Git Hooks Integration
41
+
42
+
GitLint can automatically install Git hooks for your repository:
43
+
44
+
```bash
45
+
# Install the commit-msg hook
46
+
gitlint hooks --install
47
+
48
+
# Force overwrite if a hook already exists
49
+
gitlint hooks --install --force
26
50
27
-
## Get Started
51
+
# Uninstall the hooks
52
+
gitlint hooks --uninstall
53
+
```
28
54
29
-
It's rather simple to get your package development started:
55
+
Or manually add to your `.git/hooks/commit-msg` file:
30
56
31
57
```bash
32
-
# you may use this GitHub template or the following command:
33
-
bunx degit stacksjs/ts-starter my-pkg
34
-
cd my-pkg
58
+
#!/bin/sh
59
+
gitlint --edit "$1"
60
+
```
35
61
36
-
bun i # install all deps
37
-
bun run build # builds the library for production-ready use
62
+
Or use with [husky](https://github.com/typicode/husky):
63
+
64
+
```json
65
+
// package.json
66
+
{
67
+
"husky": {
68
+
"hooks": {
69
+
"commit-msg": "gitlint --edit $HUSKY_GIT_PARAMS"
70
+
}
71
+
}
72
+
}
73
+
```
38
74
39
-
# after you have successfully committed, you may create a "release"
40
-
bun run release # automates git commits, versioning, and changelog generations
75
+
## Configuration
76
+
77
+
Create a `gitlint.config.js` file in your project root:
78
+
79
+
```js
80
+
// gitlint.config.js
81
+
module.exports= {
82
+
verbose:true,
83
+
rules: {
84
+
'conventional-commits':2,
85
+
'header-max-length': [2, { maxLength:72 }],
86
+
'body-max-line-length': [2, { maxLength:100 }],
87
+
'body-leading-blank':2,
88
+
'no-trailing-whitespace':1
89
+
},
90
+
ignores: [
91
+
'^Merge branch',
92
+
'^Merge pull request'
93
+
]
94
+
}
41
95
```
42
96
43
-
_Check out the package.json scripts for more commands._
97
+
### Rule Levels
98
+
99
+
-`0` or `off`: Disable the rule
100
+
-`1` or `warning`: Warning (doesn't cause exit code to be non-zero)
101
+
-`2` or `error`: Error (causes exit code to be non-zero)
102
+
103
+
## Built-in Rules
104
+
105
+
-`conventional-commits`: Enforces conventional commit format (`<type>(scope): description`)
106
+
-`header-max-length`: Enforces a maximum header length
107
+
-`body-max-line-length`: Enforces a maximum body line length
108
+
-`body-leading-blank`: Enforces a blank line between header and body
109
+
-`no-trailing-whitespace`: Checks for trailing whitespace
"compile:all": "bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64",
0 commit comments