cswimr
7341343534
All checks were successful
Actions / Build Plugins (pull_request) Successful in 1m17s
30 lines
957 B
JavaScript
30 lines
957 B
JavaScript
import { readdirSync, statSync, existsSync } from "fs";
|
|
import { join } from "path";
|
|
import { execSync } from "child_process";
|
|
import { fileURLToPath } from "url";
|
|
import path from "path";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const srcDir = join(__dirname, "src");
|
|
|
|
try {
|
|
const directories = readdirSync(srcDir).filter((file) =>
|
|
statSync(join(srcDir, file)).isDirectory()
|
|
);
|
|
|
|
directories.forEach((dir) => {
|
|
const generatorPath = join(srcDir, dir, "generator", "index.js");
|
|
if (existsSync(generatorPath)) {
|
|
console.log(`Running generator for ${dir}...`);
|
|
try {
|
|
execSync(`node "${generatorPath}"`, { stdio: "inherit" });
|
|
} catch (error) {
|
|
console.error(`Error running generator for ${dir}:`, error);
|
|
}
|
|
console.log(`Generator for ${dir} completed.`);
|
|
}
|
|
});
|
|
} catch (error) {
|
|
console.error("Error reading directories:", error);
|
|
}
|