mirror of
https://github.com/smogon/sprites.git
synced 2026-03-23 18:35:25 -05:00
21 lines
516 B
JavaScript
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;
|
|
}
|