diff --git a/rollup.config.js b/rollup.config.js index b89260f1c..dc1ba2e55 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,19 +6,27 @@ import commonjs from 'rollup-plugin-commonjs'; import { terser } from 'rollup-plugin-terser'; const BASE_PATH = process.cwd(); -const directory = 'dist/rulesets/oas/functions'; -// TODO: Add aas -const targetDir = path.join(BASE_PATH, directory); const functions = []; -for (const file of fs.readdirSync(targetDir)) { - const targetFile = path.join(targetDir, file); - const stat = fs.statSync(targetFile); - if (!stat.isFile()) continue; - const ext = path.extname(targetFile); - if (ext !== '.js') continue; - - functions.push(targetFile); + +const builtIns = ['oas', 'aas'] + +for (const rulesetName of builtIns) { + const targetDir = path.join(BASE_PATH, `dist/rulesets/${rulesetName}/functions/`); + + if (!fs.existsSync(targetDir)) { + continue; + } + + for (const file of fs.readdirSync(targetDir)) { + const targetFile = path.join(targetDir, file); + const stat = fs.statSync(targetFile); + if (!stat.isFile()) continue; + const ext = path.extname(targetFile); + if (ext !== '.js') continue; + + functions.push(targetFile); + } } module.exports = functions.map(fn => ({