@jcoreio/toolchain 4.12.2 → 4.12.4
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/githooks.cjs +11 -9
- package/package.json +1 -1
- package/util/parseCommitMessage.cjs +3 -0
package/githooks.cjs
CHANGED
|
@@ -19,15 +19,17 @@ module.exports = {
|
|
|
19
19
|
}
|
|
20
20
|
try {
|
|
21
21
|
const parsed = parseCommitMessage(content)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
if (!parsed.merge) {
|
|
23
|
+
const scope = parsed.scope && parsed.scope[0]
|
|
24
|
+
if (
|
|
25
|
+
scope &&
|
|
26
|
+
monorepoSubpackageJsons &&
|
|
27
|
+
!monorepoSubpackageJsons.some((j) => scope === j.name)
|
|
28
|
+
) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`invalid scope: ${scope} - scope must be the name of a package in this monorepo`
|
|
31
|
+
)
|
|
32
|
+
}
|
|
31
33
|
}
|
|
32
34
|
// eslint-disable-next-line no-console
|
|
33
35
|
console.error(chalk`{green ✔} validated commit message`)
|
package/package.json
CHANGED
|
@@ -16,6 +16,9 @@ const validTypes = [
|
|
|
16
16
|
]
|
|
17
17
|
|
|
18
18
|
function parseCommitMessage(message) {
|
|
19
|
+
if (/^merge branch/i.test(message)) {
|
|
20
|
+
return { merge: true }
|
|
21
|
+
}
|
|
19
22
|
const state = new ParseState(message)
|
|
20
23
|
const type = state.match(/[^(:! )]+/)
|
|
21
24
|
if (!type || !validTypes.includes(type[0])) {
|