@jcoreio/toolchain 4.11.0 → 4.11.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/package.json +1 -1
- package/util/parseCommitMessage.cjs +18 -2
package/package.json
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
const ParseState = require('./ParseState.cjs')
|
|
2
2
|
const ParseError = require('./ParseError.cjs')
|
|
3
3
|
|
|
4
|
+
const validTypes = [
|
|
5
|
+
'build',
|
|
6
|
+
'chore',
|
|
7
|
+
'ci',
|
|
8
|
+
'docs',
|
|
9
|
+
'feat',
|
|
10
|
+
'fix',
|
|
11
|
+
'perf',
|
|
12
|
+
'refactor',
|
|
13
|
+
'revert',
|
|
14
|
+
'style',
|
|
15
|
+
'test',
|
|
16
|
+
]
|
|
17
|
+
|
|
4
18
|
function parseCommitMessage(message) {
|
|
5
19
|
const state = new ParseState(message)
|
|
6
20
|
const type = state.match(/[^(:! )]+/)
|
|
7
|
-
if (!type ||
|
|
21
|
+
if (!type || !validTypes.includes(type[0])) {
|
|
8
22
|
throw new ParseError(
|
|
9
|
-
|
|
23
|
+
`${
|
|
24
|
+
type ? `invalid type: ${type[0]}` : 'must begin with a type'
|
|
25
|
+
} - valid types are: ${validTypes.join(', ')}`,
|
|
10
26
|
0
|
|
11
27
|
)
|
|
12
28
|
}
|