Skip to content

Commit

Permalink
build(commit): dogfood ls helper from API
Browse files Browse the repository at this point in the history
  • Loading branch information
jrolfs committed Oct 11, 2020
1 parent c34b10a commit 58ed6e9
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
const {readdirSync, statSync} = require('fs')
const {join, sep} = require('path')

const ls = path =>
readdirSync(path)
.filter(f => statSync(join(path, f)).isFile())
.map(
f =>
`${path.split(sep).reverse()[0]}/${f.replace(
/(\.config)?.(json|js)/,
'',
)}`,
)
const {ls} = require('./src/api/commit')

module.exports = {
extends: ['./src/config/commitlint.config'],
Expand All @@ -20,14 +8,14 @@ module.exports = {
'always',
[
'config',
...ls('./src/config'),
'scripts',
...ls('./src/scripts'),
'api',
...ls('./src/api'),
'deps',
'deps-dev',
'build',
...ls.configs('./src/config'),
...ls.configs('./src/scripts'),
...ls.configs('./src/api'),
],
],
},
Expand Down

0 comments on commit 58ed6e9

Please sign in to comment.