catwalk3d 1.0.0

Headless model thumbnails rendered entirely in Rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# conventional-commits-parser

[![ESM-only package][package]][package-url]
[![NPM version][npm]][npm-url]
[![Node version][node]][node-url]
[![Dependencies status][deps]][deps-url]
[![Install size][size]][size-url]
[![Build status][build]][build-url]
[![Coverage status][coverage]][coverage-url]

[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
[package-url]: https://nodejs.org/api/esm.html

[npm]: https://img.shields.io/npm/v/conventional-commits-parser.svg
[npm-url]: https://npmjs.com/package/conventional-commits-parser

[node]: https://img.shields.io/node/v/conventional-commits-parser.svg
[node-url]: https://nodejs.org

[deps]: https://img.shields.io/librariesio/release/npm/conventional-commits-parser
[deps-url]: https://libraries.io/npm/conventional-commits-parser

[size]: https://packagephobia.com/badge?p=conventional-commits-parser
[size-url]: https://packagephobia.com/result?p=conventional-commits-parser

[build]: https://img.shields.io/github/actions/workflow/status/conventional-changelog/conventional-changelog/tests.yaml?branch=master
[build-url]: https://github.com/conventional-changelog/conventional-changelog/actions

[coverage]: https://coveralls.io/repos/github/conventional-changelog/conventional-changelog/badge.svg?branch=master
[coverage-url]: https://coveralls.io/github/conventional-changelog/conventional-changelog?branch=master

Parse raw conventional commits.

<hr />
<a href="#install">Install</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="#usage">Usage</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="#conventional-commit-message-format">Message format</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="#api">API</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="#cli">CLI</a>
<br />
<hr />

## Install

```bash
# pnpm
pnpm add conventional-commits-parser
# yarn
yarn add conventional-commits-parser
# npm
npm i conventional-commits-parser
```

## Usage

```js
import {
  CommitParser,
  parseCommits,
  parseCommitsStream
} from 'conventional-commits-parser'
import { pipeline } from 'stream/promises'
import { Readable } from 'stream'

const rawCommitMessage = 'feat(scope): broadcast $destroy event on scope destruction\nCloses #1'

// to parse raw commit message manually:
const parser = new CommitParser(options)

console.log(parser.parse(rawCommitMessage))

// to parse raw commit messages async iterables:
await pipeline(
  [rawCommitMessage],
  parseCommits(options),
  async function* (parsedCommits) {
    for await (const commit of parsedCommits) {
      console.log(commit)
    }
  }
)

// to parse raw commit messages streams:
Readable.from([rawCommitMessage])
  .pipe(parseCommitsStream(options))
  .on('data', commit => console.log(commit))
```

Parser expects raw commit message. Examples:

```js
'feat(scope): broadcast $destroy event on scope destruction\nCloses #1'
'feat(ng-list): Allow custom separator\nbla bla bla\n\nBREAKING CHANGE: some breaking change.\nThanks @stevemao\n'
```

It will return parsed commit object. Examples:

```js
{
  type: 'feat',
  scope: 'scope',
  subject: 'broadcast $destroy event on scope destruction',
  merge: null,
  header: 'feat(scope): broadcast $destroy event on scope destruction',
  body: null,
  footer: 'Closes #1',
  notes: [],
  references:
   [{
     action: 'Closes',
     owner: null,
     repository: null,
     issue: '1',
     raw: '#1',
     prefix: '#'
   }],
  mentions: [],
  revert: null
}
{
  type: 'feat',
  scope: 'ng-list',
  subject: 'Allow custom separator',
  merge: null,
  header: 'feat(ng-list): Allow custom separator',
  body: 'bla bla bla',
  footer: 'BREAKING CHANGE: some breaking change.\nThanks @stevemao',
  notes:
   [{
     title: 'BREAKING CHANGE',
     text: 'some breaking change.\nThanks @stevemao'
   }],
  references: [],
  mentions: ['stevemao'],
  revert: null
}
```

## Conventional Commit Message Format

A minimum input should contain a raw message.

Each commit message consists of a **merge header**, a **header** (mandatory), a **body** and a **footer**. **Mention** (optional) someone using the `@` notation.

```
<merge>
<header>
<body>
<footer>
```

### merge

The merge header may optionally have a special format that includes other parts, such as **branch**, **issueId** or **source**.

```
Merge branch <branch>
Merge pull request <issue-id> from <source>
```

### header

The header may optionally have a special format that includes other parts, such as **type**, **scope** and **subject**. You could **reference** (optional) issues here.

```
<type>(<scope>): <subject>
```

### footer

The footer should contain any information about **Important Notes** (optional) and is also the place to **reference** (optional) issues.

```
<important note>
<references>
```

### other parts

This module will only parse the message body. However, it is possible to include other fields such as hash, committer or date.

```
My commit message
-sideNotes-
It should warn the correct unfound file names.
Also it should continue if one file cannot be found.
Tests are added for these
```

Then `sideNotes` will be `It should warn the correct unfound file names.\nAlso it should continue if one file cannot be found.\nTests are added for these`. You can customize the `fieldPattern`.

## API

### `new CommitParser(options?: ParserOptions)`

Creates parser instance with `parse` method.

### `parseCommits(options?: ParserOptions)`

Create async generator function to parse async iterable of raw commits. If there is any malformed commits it will be gracefully ignored (an empty data will be emitted so down async iterable can notice).

### `parseCommitsStream(options?: ParserOptions)`

Creates an transform stream. If there is any malformed commits it will be gracefully ignored (an empty data will be emitted so down stream can notice).

### ParserOptions

#### mergePattern

Type: `RegExp`
Default: null

Pattern to match merge headers. EG: branch merge, GitHub or GitLab like pull requests headers. When a merge header is parsed, the next line is used for conventional header parsing.

For example, if we have a commit

```
Merge pull request #1 from user/feature/feature-name

feat(scope): broadcast $destroy event on scope destruction
```

We can parse it with these options and the default headerPattern:

```js
{
  mergePattern: /^Merge pull request #(\d+) from (.*)$/,
  mergeCorrespondence: ['id', 'source']
}
```

#### mergeCorrespondence

Type: `string[]`,
Default: null

Used to define what capturing group of `mergePattern`.

#### headerPattern

Type: `RegExp`,
Default: `/^(\w*)(?:\(([\w\$\.\-\* ]*)\))?\: (.*)$/`

Used to match header pattern.

#### headerCorrespondence

Type: `string[]`,
Default `['type', 'scope', 'subject']`

Used to define what capturing group of `headerPattern` captures what header part. The order of the array should correspond to the order of `headerPattern`'s capturing group. If the part is not captured it is `null`.

#### referenceActions

Type: `(string | RegExp)[]`,
Default: `['close', 'closes', 'closed', 'fix', 'fixes', 'fixed', 'resolve', 'resolves', 'resolved']`

Keywords to reference an issue. This value is case **insensitive**. String values are escaped for use in a regex, while `RegExp` values are used as-is.

Set it to `null` to reference an issue without any action.

#### issuePrefixes

Type: `(string | RegExp)[]`,
Default: `['#']`

The prefixes of an issue. EG: In `gh-123` `gh-` is the prefix. String values are escaped for use in a regex, while `RegExp` values are used as-is.

#### issuePrefixesCaseSensitive

Type: `boolean`,
Default: false

Used to define if `issuePrefixes` should be considered case sensitive.

#### noteKeywords

Type: `(string | RegExp)[]`,
Default: `['BREAKING CHANGE', 'BREAKING-CHANGE']`

Keywords for important notes. This value is case **insensitive**. String values are escaped for use in a regex, while `RegExp` values are used as-is.

#### notesPattern

Type: `function`,
Default: `noteKeywordsSelection => ^[\\s|*]*(' + noteKeywordsSelection + ')[:\\s]+(.*)` where `noteKeywordsSelection` is `join(noteKeywords, '|')`

A function that takes `noteKeywordsSelection` and returns a `RegExp` to be matched against the notes.

#### fieldPattern

Type: `RegExp`,
Default: `/^-(.*?)-$/`

Pattern to match other fields.

#### revertPattern

Type: `RegExp`,
Default: `/^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\.?/`

Pattern to match what this commit reverts.

#### revertCorrespondence

Type: `string[]`,
Default: `['header', 'hash']`

Used to define what capturing group of `revertPattern` captures what reverted commit fields. The order of the array should correspond to the order of `revertPattern`'s capturing group.

For example, if we had commit

```
Revert "throw an error if a callback is passed"

This reverts commit 9bb4d6c.
```

If configured correctly, the parsed result would be

```js
{
  revert: {
    header: 'throw an error if a callback is passed',
    hash: '9bb4d6c'
  }
}
```

It implies that this commit reverts a commit with header `'throw an error if a callback is passed'` and hash `'9bb4d6c'`.

#### commentChar

Type: `string` or `null`,
Default: null

What commentChar to use. By default it is `null`, so no comments are stripped.
Set to `#` if you pass the contents of `.git/COMMIT_EDITMSG` directly.

If you have configured the git commentchar via `git config core.commentchar` you'll want to pass what you have set there.

#### warn

Type: `function` or `boolean`,
Default: `() => {}`

What warn function to use. For example, `console.warn.bind(console)`. By default, it's a noop. If it is `true`, it will error if commit cannot be parsed (strict).

## CLI

You can use cli to practice writing commit messages or parse messages from files. Note: the sample output might be different. It's just for demonstration purposes.

If you run `conventional-commits-parser` without any arguments

```sh
$ conventional-commits-parser --help # for more details
```

You will enter an interactive shell. To show your parsed output enter "return" three times (or enter your specified separator).

```sh
> fix(title): a title is fixed

{"type":"fix","scope":"title","subject":"a title is fixed","header":"fix(title): a title is fixed","body":null,"footer":null,"notes":[],"references":[],"revert":null}
```

You can also use cli to parse messages from files.

If you have log.txt

```text
feat(ngMessages): provide support for dynamic message resolution

Prior to this fix it was impossible to apply a binding to a the ngMessage directive to represent the name of the error.

BREAKING CHANGE: The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive.

Closes #10036
Closes #9338
```

And you run

```sh
$ conventional-commits-parser log.txt
# or
$ cat log.txt | conventional-commits-parser
```

An array of json will be printed to stdout.

```sh
[
{"type":"feat","scope":"ngMessages","subject":"provide support for dynamic message resolution","header":"feat(ngMessages): provide support for dynamic message resolution","body":"Prior to this fix it was impossible to apply a binding to a the ngMessage directive to represent the name of the error.","footer":"BREAKING CHANGE: The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive.\nCloses #10036\nCloses #9338","notes":[{"title":"BREAKING CHANGE","text":"The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive."}],"references":[{"action":"Closes","owner":null,"repository":null,"issue":"10036","raw":"#10036"},{"action":"Closes","owner":null,"repository":null,"issue":"9338","raw":"#9338"}],"revert":null}
]
```

Commits should be split by at least three newlines (`\n\n\n`) or you can specify a separator as the second argument.

Eg: in log2.txt

```text

docs(ngMessageExp): split ngMessage docs up to show its alias more clearly
===

fix($animate): applyStyles from options on leave

Closes #10068
```

And you run

```sh
$ conventional-commits-parser log2.txt '==='
```

```sh
[
{"type":"docs","scope":"ngMessageExp","subject":"split ngMessage docs up to show its alias more clearly","header":"docs(ngMessageExp): split ngMessage docs up to show its alias more clearly","body":null,"footer":null,"notes":[],"references":[],"revert":null}
,
{"type":"fix","scope":"$animate","subject":"applyStyles from options on leave","header":"fix($animate): applyStyles from options on leave","body":null,"footer":"Closes #10068","notes":[],"references":[{"action":"Closes","owner":null,"repository":null,"issue":"10068","raw":"#10068"}],"revert":null}
]
```

Will be printed out.

You can specify one or more files. The output array will be in order of the input file paths. If you specify more than one separator, the last one will be used.

## License

MIT © [Steve Mao](https://github.com/stevemao)