From 58ed6e97b9a5e796ace0de131aafffa04d878cc1 Mon Sep 17 00:00:00 2001 From: Jamie Rolfs Date: Sun, 11 Oct 2020 00:50:33 -0700 Subject: [PATCH] build(commit): dogfood `ls` helper from API --- commitlint.config.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/commitlint.config.js b/commitlint.config.js index 89070da8..afa33ffe 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -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'], @@ -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'), ], ], },