sprites/tools/deploy/find.js
Christopher Monsanto 653b4284f8 Deploy DSL, take 3
2020-04-30 21:48:11 -04:00

21 lines
516 B
JavaScript

import fs from 'fs';
import pathlib from 'path';
export function find(startDir, tag) {
const stack = [startDir];
const results = [];
let dir;
while (dir = stack.pop()) {
for (const name of fs.readdirSync(dir)) {
const path = pathlib.join(dir, name);
if (fs.lstatSync(path).isDirectory()) {
stack.push(path);
} else if (name === `${tag}.deploy.js`) {
results.push(path);
}
}
}
return results;
}