Commit d98fa282 by Dominik Prokop Committed by GitHub

grafana/toolkit: Resolve modules correctly (#21216)

parent 392819c5
...@@ -29,18 +29,20 @@ export const findModuleFiles = async (base: string, files?: string[], result?: s ...@@ -29,18 +29,20 @@ export const findModuleFiles = async (base: string, files?: string[], result?: s
result = result || []; result = result || [];
if (files) { if (files) {
files.forEach(async file => { await Promise.all(
const newbase = path.join(base, file); files.map(async file => {
if (fs.statSync(newbase).isDirectory()) { const newbase = path.join(base, file);
result = await findModuleFiles(newbase, await readdirPromise(newbase), result); if (fs.statSync(newbase).isDirectory()) {
} else { result = await findModuleFiles(newbase, await readdirPromise(newbase), result);
const filename = path.basename(file); } else {
if (/^module.(t|j)sx?$/.exec(filename)) { const filename = path.basename(file);
// @ts-ignore if (/^module.(t|j)sx?$/.exec(filename)) {
result.push(newbase); // @ts-ignore
result.push(newbase);
}
} }
} })
}); );
} }
return result; return result;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment