@jmlweb/commitlint-config 2.0.0 → 2.0.1
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/CHANGELOG.md +6 -0
- package/README.md +110 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
> Shared commitlint configuration for enforcing Conventional Commits across projects. Flexible design works out-of-the-box for any project, with optional scope restrictions.
|
|
9
9
|
|
|
10
|
-
## Features
|
|
10
|
+
## ✨ Features
|
|
11
11
|
|
|
12
|
-
- Enforces [Conventional Commits](https://conventionalcommits.org) specification
|
|
13
|
-
- **No scope restrictions by default
|
|
14
|
-
- Configurable scopes when you need them
|
|
15
|
-
- Custom
|
|
16
|
-
- TypeScript
|
|
12
|
+
- 📝 **Conventional Commits**: Enforces [Conventional Commits](https://conventionalcommits.org) specification
|
|
13
|
+
- 🎯 **Flexible Scopes**: No scope restrictions by default - works with any project structure
|
|
14
|
+
- ⚙️ **Configurable**: Customizable scopes when you need them
|
|
15
|
+
- 🚫 **Custom Ignores**: Ignore functions for merge commits, dependabot, etc.
|
|
16
|
+
- 📦 **TypeScript Support**: Full type definitions included
|
|
17
17
|
|
|
18
|
-
## Installation
|
|
18
|
+
## 📦 Installation
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
npm install --save-dev @jmlweb/commitlint-config @commitlint/cli @commitlint/config-conventional
|
|
@@ -27,7 +27,9 @@ Or with pnpm:
|
|
|
27
27
|
pnpm add -D @jmlweb/commitlint-config @commitlint/cli @commitlint/config-conventional
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
31
|
+
|
|
32
|
+
## 🚀 Quick Start
|
|
31
33
|
|
|
32
34
|
Create a `commitlint.config.js` file in your project root:
|
|
33
35
|
|
|
@@ -39,7 +41,7 @@ export default commitlintConfig;
|
|
|
39
41
|
|
|
40
42
|
That's it! Any commit type/scope following Conventional Commits is allowed.
|
|
41
43
|
|
|
42
|
-
##
|
|
44
|
+
## 💡 Examples
|
|
43
45
|
|
|
44
46
|
### No Scope Restrictions (Default)
|
|
45
47
|
|
|
@@ -94,7 +96,9 @@ export default createCommitlintConfig({
|
|
|
94
96
|
});
|
|
95
97
|
```
|
|
96
98
|
|
|
97
|
-
##
|
|
99
|
+
## 📋 Configuration Details
|
|
100
|
+
|
|
101
|
+
### Commit Message Format
|
|
98
102
|
|
|
99
103
|
This configuration enforces the Conventional Commits format:
|
|
100
104
|
|
|
@@ -118,7 +122,7 @@ test: add unit tests for utils
|
|
|
118
122
|
ci: add GitHub Actions workflow
|
|
119
123
|
```
|
|
120
124
|
|
|
121
|
-
|
|
125
|
+
### Allowed Types
|
|
122
126
|
|
|
123
127
|
| Type | Description |
|
|
124
128
|
| ---------- | ------------------------------------- |
|
|
@@ -134,7 +138,7 @@ ci: add GitHub Actions workflow
|
|
|
134
138
|
| `build` | Build system changes |
|
|
135
139
|
| `revert` | Reverting previous commits |
|
|
136
140
|
|
|
137
|
-
|
|
141
|
+
### Configuration Options
|
|
138
142
|
|
|
139
143
|
| Option | Type | Default | Description |
|
|
140
144
|
| ------------------ | --------------------------------- | ----------- | ---------------------------------------------- |
|
|
@@ -146,7 +150,7 @@ ci: add GitHub Actions workflow
|
|
|
146
150
|
| `bodyRequired` | `boolean` | `false` | Whether to require a commit body |
|
|
147
151
|
| `ignores` | `((commit: string) => boolean)[]` | `undefined` | Functions to ignore certain commits |
|
|
148
152
|
|
|
149
|
-
|
|
153
|
+
### Exports
|
|
150
154
|
|
|
151
155
|
```typescript
|
|
152
156
|
// Default config - no scope restrictions
|
|
@@ -159,21 +163,63 @@ import { createCommitlintConfig } from '@jmlweb/commitlint-config';
|
|
|
159
163
|
import { COMMIT_TYPES } from '@jmlweb/commitlint-config';
|
|
160
164
|
```
|
|
161
165
|
|
|
162
|
-
##
|
|
166
|
+
## 🎯 When to Use
|
|
167
|
+
|
|
168
|
+
Use this configuration when you want:
|
|
169
|
+
|
|
170
|
+
- ✅ Enforce Conventional Commits specification across your project
|
|
171
|
+
- ✅ Automatic changelog generation from commit messages
|
|
172
|
+
- ✅ Consistent commit message format across team members
|
|
173
|
+
- ✅ Optional scope restrictions for monorepos
|
|
174
|
+
- ✅ Integration with semantic-release or standard-version
|
|
175
|
+
|
|
176
|
+
**For projects without commitlint**, consider starting with this package to improve commit quality and enable automated versioning.
|
|
177
|
+
|
|
178
|
+
## 🔧 Extending the Configuration
|
|
179
|
+
|
|
180
|
+
You can extend the configuration for your specific needs:
|
|
181
|
+
|
|
182
|
+
### Adding Custom Scopes
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { createCommitlintConfig } from '@jmlweb/commitlint-config';
|
|
186
|
+
|
|
187
|
+
export default createCommitlintConfig({
|
|
188
|
+
scopes: ['frontend', 'backend', 'shared', 'docs'],
|
|
189
|
+
additionalTypes: ['wip'], // Add work-in-progress type
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Stricter Rules
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { createCommitlintConfig } from '@jmlweb/commitlint-config';
|
|
197
|
+
|
|
198
|
+
export default createCommitlintConfig({
|
|
199
|
+
scopes: ['core', 'api', 'ui'],
|
|
200
|
+
scopeRequired: true,
|
|
201
|
+
bodyRequired: true,
|
|
202
|
+
headerMaxLength: 72,
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## 📝 Usage with Scripts
|
|
207
|
+
|
|
208
|
+
### Integration with Husky
|
|
163
209
|
|
|
164
|
-
|
|
210
|
+
#### Step 1 - Install husky
|
|
165
211
|
|
|
166
212
|
```bash
|
|
167
213
|
pnpm add -D husky
|
|
168
214
|
```
|
|
169
215
|
|
|
170
|
-
|
|
216
|
+
#### Step 2 - Initialize husky
|
|
171
217
|
|
|
172
218
|
```bash
|
|
173
219
|
pnpm exec husky init
|
|
174
220
|
```
|
|
175
221
|
|
|
176
|
-
|
|
222
|
+
#### Step 3 - Add commit-msg hook
|
|
177
223
|
|
|
178
224
|
Create or edit `.husky/commit-msg`:
|
|
179
225
|
|
|
@@ -181,7 +227,7 @@ Create or edit `.husky/commit-msg`:
|
|
|
181
227
|
pnpm exec commitlint --edit $1
|
|
182
228
|
```
|
|
183
229
|
|
|
184
|
-
|
|
230
|
+
#### Step 4 - Test your setup
|
|
185
231
|
|
|
186
232
|
```bash
|
|
187
233
|
# This should fail
|
|
@@ -191,18 +237,61 @@ git commit -m "bad commit message"
|
|
|
191
237
|
git commit -m "feat: add new feature"
|
|
192
238
|
```
|
|
193
239
|
|
|
194
|
-
|
|
240
|
+
### Package.json Scripts
|
|
241
|
+
|
|
242
|
+
```json
|
|
243
|
+
{
|
|
244
|
+
"scripts": {
|
|
245
|
+
"commitlint": "commitlint --edit",
|
|
246
|
+
"commitlint:all": "commitlint --from HEAD~10"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## 📋 Requirements
|
|
195
252
|
|
|
196
253
|
- **Node.js** >= 18.0.0
|
|
197
254
|
- **@commitlint/cli** >= 19.0.0
|
|
198
255
|
- **@commitlint/config-conventional** >= 19.0.0
|
|
199
256
|
|
|
200
|
-
##
|
|
257
|
+
## 📦 Peer Dependencies
|
|
258
|
+
|
|
259
|
+
This package requires the following peer dependencies:
|
|
260
|
+
|
|
261
|
+
- `@commitlint/cli` (>=19.0.0)
|
|
262
|
+
- `@commitlint/config-conventional` (>=19.0.0)
|
|
263
|
+
|
|
264
|
+
## 🔗 Related Packages
|
|
265
|
+
|
|
266
|
+
### Internal Packages
|
|
201
267
|
|
|
202
268
|
- [`@jmlweb/eslint-config-base`](../eslint-config-base) - ESLint configuration for TypeScript
|
|
203
269
|
- [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier configuration
|
|
204
270
|
- [`@jmlweb/tsconfig-base`](../tsconfig-base) - TypeScript configuration
|
|
205
271
|
|
|
206
|
-
|
|
272
|
+
### External Tools
|
|
273
|
+
|
|
274
|
+
- [commitlint](https://commitlint.js.org/) - Lint commit messages according to conventional commits
|
|
275
|
+
- [Conventional Commits](https://www.conventionalcommits.org/) - A specification for adding meaning to commit messages
|
|
276
|
+
- [Husky](https://typicode.github.io/husky/) - Git hooks made easy (recommended for pre-commit integration)
|
|
277
|
+
- [semantic-release](https://semantic-release.gitbook.io/) - Automated versioning and changelog generation
|
|
278
|
+
|
|
279
|
+
## 🔄 Migration Guide
|
|
280
|
+
|
|
281
|
+
### Upgrading to a New Version
|
|
282
|
+
|
|
283
|
+
> **Note:** If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.
|
|
284
|
+
|
|
285
|
+
**No breaking changes have been introduced yet.** This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.
|
|
286
|
+
|
|
287
|
+
For version history, see the [Changelog](./CHANGELOG.md).
|
|
288
|
+
|
|
289
|
+
**Need Help?** If you encounter issues during migration, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
|
|
290
|
+
|
|
291
|
+
## 📜 Changelog
|
|
292
|
+
|
|
293
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
|
|
294
|
+
|
|
295
|
+
## 📄 License
|
|
207
296
|
|
|
208
297
|
MIT
|