Skip to content

Commit

Permalink
nit #10
Browse files Browse the repository at this point in the history
  • Loading branch information
chrabyrd committed May 29, 2024
1 parent dc4fc32 commit 2430fba
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions webpack/webpack-utils/find-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fs = require('fs');
const Path = require('path');

function findFile(path, target) {
for (const name of fs.readdirSync(path)) {
const filePath = Path.join(path, name);
const stat = fs.lstatSync(filePath);

if (stat.isDirectory() && name !== 'node_modules') {
const result = findFile(filePath, target);
if (result) {
return result;
}
} else if (name === target) {
return filePath;
}
}
}

module.exports = { findFile };

0 comments on commit 2430fba

Please sign in to comment.