Skip to content

Commit c34b10a

Browse files
committed
feat(api/commit): expose scopes module with some common scope lists
1 parent 697a4c2 commit c34b10a

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

src/api/commit.js

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
const {readdirSync, statSync} = require('fs')
22
const {join, sep} = require('path')
33

4+
//
5+
// Common scopes
6+
7+
/**
8+
* Build scopes
9+
* - commit
10+
* - deps
11+
* - deps-dev
12+
* - format
13+
* - lint
14+
*/
15+
const build = () => ['commit', 'deps', 'deps-dev', 'format', 'lint']
16+
17+
const scopes = {build}
18+
19+
//
20+
// Scope helpers
21+
422
/**
523
* Enumerate config files
624
*
@@ -28,4 +46,4 @@ const configs = path =>
2846

2947
const ls = {configs}
3048

31-
module.exports = {ls}
49+
module.exports = {ls, scopes}

src/config/commitlint.config.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const {scopes} = require('../api/commit')
2+
13
module.exports = {
24
extends: ['@commitlint/config-conventional'],
35
rules: {
@@ -19,16 +21,6 @@ module.exports = {
1921
],
2022
],
2123
'scope-case': [1, 'always', 'kebab-case'],
22-
'scope-enum': [
23-
0,
24-
'always',
25-
[
26-
// build(...)
27-
'deps',
28-
'deps-dev',
29-
'format',
30-
'lint',
31-
],
32-
],
24+
'scope-enum': [0, 'always', scopes.build()],
3325
},
3426
}

0 commit comments

Comments
 (0)