commitfmt-darwin-x64 0.4.1 → 1.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/README.md +65 -16
- package/commitfmt +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,7 +155,7 @@ Most of the linting rules are disabled by default. Default config contains 2 rul
|
|
|
155
155
|
|
|
156
156
|
```toml
|
|
157
157
|
[lint.header]
|
|
158
|
-
full-stop = true
|
|
158
|
+
description-full-stop = true
|
|
159
159
|
|
|
160
160
|
[lint.footer]
|
|
161
161
|
breaking-exclamation = true
|
|
@@ -214,26 +214,37 @@ Lines starting with the comment symbol will be ignored during parsing.
|
|
|
214
214
|
|
|
215
215
|
commitfmt can add additional footers to the commit message.
|
|
216
216
|
|
|
217
|
-
####
|
|
217
|
+
#### Static value
|
|
218
218
|
|
|
219
|
-
You can
|
|
219
|
+
You can add a footer with a static value:
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
```toml
|
|
222
|
+
[[additional-footers]]
|
|
223
|
+
key = "Authored-By"
|
|
224
|
+
value = "John Doe"
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
#### Shell commands
|
|
228
|
+
|
|
229
|
+
You can use shell commands to dynamically generate footer values:
|
|
222
230
|
|
|
223
231
|
```toml
|
|
224
|
-
[additional-footers]
|
|
232
|
+
[[additional-footers]]
|
|
225
233
|
key = "Authored-By"
|
|
226
|
-
value
|
|
234
|
+
value = "{{ echo $USER }}"
|
|
227
235
|
```
|
|
228
236
|
|
|
237
|
+
Inside the template expression you can use any shell command available in the `PATH`.
|
|
238
|
+
|
|
229
239
|
#### Branch value pattern
|
|
230
240
|
|
|
231
241
|
You can also add the ticket number from the task tracker to the footer if it is in the branch name:
|
|
232
242
|
|
|
233
243
|
```toml
|
|
234
|
-
[additional-footers]
|
|
244
|
+
[[additional-footers]]
|
|
235
245
|
key = "Ticket-ID"
|
|
236
|
-
branch-
|
|
246
|
+
branch-pattern = "(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)"
|
|
247
|
+
value = "${{ TICKET_ID }}"
|
|
237
248
|
```
|
|
238
249
|
|
|
239
250
|
For example, if your branch name is `feature/CC-123/add-new-feature` or `feature/CC-123`, the `Ticket-ID` footer will be added to the commit message with the value `CC-123`.
|
|
@@ -242,27 +253,27 @@ If the ticket number is not found in the branch name, footer will be skipped.
|
|
|
242
253
|
|
|
243
254
|
You can use [rustexp](https://rustexp.lpil.uk) to test your pattern.
|
|
244
255
|
|
|
245
|
-
#####
|
|
256
|
+
##### Patterns
|
|
246
257
|
|
|
247
258
|
Examples of patterns for branch names in git flow format:
|
|
248
259
|
|
|
249
|
-
- Jira/YouTrack: `(?:.*)/([A-Z0-9-]+)/?(?:.*)`
|
|
260
|
+
- Jira/YouTrack: `(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)`
|
|
250
261
|
- `feature/CFMT-123`
|
|
251
262
|
- `feature/CFMT-123/add-new-feature`
|
|
252
|
-
- GitHub: `(?:.*)
|
|
253
|
-
- `feature/#123`
|
|
263
|
+
- GitHub: `(?:.*)/(?<ISSUE_ID>[0-9-]+)/?(?:.*)`
|
|
254
264
|
- `feature/123`
|
|
255
|
-
- `feature
|
|
265
|
+
- `feature/123/add-new-feature`
|
|
256
266
|
|
|
257
267
|
#### On conflict
|
|
258
268
|
|
|
259
269
|
If the footer already exists in the commit message, you can specify what to do with it. By default, the footer will be skipped.
|
|
260
270
|
|
|
261
271
|
```toml
|
|
262
|
-
[additional-footers]
|
|
272
|
+
[[additional-footers]]
|
|
263
273
|
key = "Ticket-ID"
|
|
264
|
-
branch-
|
|
265
|
-
|
|
274
|
+
branch-pattern = "(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)"
|
|
275
|
+
value = "${{ TICKET_ID }}"
|
|
276
|
+
on-conflict = "error" # optional. default: skip. available: skip, append, error
|
|
266
277
|
```
|
|
267
278
|
|
|
268
279
|
Available options:
|
|
@@ -271,6 +282,44 @@ Available options:
|
|
|
271
282
|
- `append` - append the footer to the end of the footer list
|
|
272
283
|
- `error` - abort the commit
|
|
273
284
|
|
|
285
|
+
#### Footer formatting
|
|
286
|
+
|
|
287
|
+
You can customize how footers are formatted using `separator` and `alignment` options:
|
|
288
|
+
|
|
289
|
+
```toml
|
|
290
|
+
[[additional-footers]]
|
|
291
|
+
key = "Ticket-ID"
|
|
292
|
+
value = "CFMT-123"
|
|
293
|
+
separator = "#"
|
|
294
|
+
alignment = "right"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Available alignment options:
|
|
298
|
+
|
|
299
|
+
- `left` - align separator to the left (default)
|
|
300
|
+
- `right` - align separator to the right
|
|
301
|
+
|
|
302
|
+
### Recipe
|
|
303
|
+
|
|
304
|
+
To enforce conventional commits, you can use the following configuration:
|
|
305
|
+
|
|
306
|
+
```toml
|
|
307
|
+
[lint.header]
|
|
308
|
+
type-enum = ["chore", "ci", "feat", "fix", "refactor", "style", "test", "docs"]
|
|
309
|
+
description-case = "lower-first"
|
|
310
|
+
description-max-length = 72
|
|
311
|
+
description-full-stop = true
|
|
312
|
+
type-required = true
|
|
313
|
+
# scope-enum = ["cc", "config", "git", "linter"] # optional
|
|
314
|
+
|
|
315
|
+
[lint.body]
|
|
316
|
+
max-line-length = 72
|
|
317
|
+
case = "upper-first"
|
|
318
|
+
|
|
319
|
+
[lint.footer]
|
|
320
|
+
breaking-exclamation = true
|
|
321
|
+
```
|
|
322
|
+
|
|
274
323
|
## Testing
|
|
275
324
|
|
|
276
325
|
To test the configuration and the work of commitfmt, run the following command:
|
package/commitfmt
CHANGED
|
Binary file
|