Skip to content

Commit 58ed6e9

Browse files
committed
build(commit): dogfood ls helper from API
1 parent c34b10a commit 58ed6e9

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

commitlint.config.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
const {readdirSync, statSync} = require('fs')
2-
const {join, sep} = require('path')
3-
4-
const ls = path =>
5-
readdirSync(path)
6-
.filter(f => statSync(join(path, f)).isFile())
7-
.map(
8-
f =>
9-
`${path.split(sep).reverse()[0]}/${f.replace(
10-
/(\.config)?.(json|js)/,
11-
'',
12-
)}`,
13-
)
1+
const {ls} = require('./src/api/commit')
142

153
module.exports = {
164
extends: ['./src/config/commitlint.config'],
@@ -20,14 +8,14 @@ module.exports = {
208
'always',
219
[
2210
'config',
23-
...ls('./src/config'),
2411
'scripts',
25-
...ls('./src/scripts'),
2612
'api',
27-
...ls('./src/api'),
2813
'deps',
2914
'deps-dev',
3015
'build',
16+
...ls.configs('./src/config'),
17+
...ls.configs('./src/scripts'),
18+
...ls.configs('./src/api'),
3119
],
3220
],
3321
},

0 commit comments

Comments
 (0)