Skip to content

Commit

Permalink
fixup! WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nulltoken committed Feb 25, 2020
1 parent c076389 commit d8006df
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ({
Expand Down

0 comments on commit d8006df

Please sign in to comment.