build(repo): simplify generation
All checks were successful
Actions / Build Plugins (pull_request) Successful in 1m17s
All checks were successful
Actions / Build Plugins (pull_request) Successful in 1m17s
This commit is contained in:
parent
6b73a82819
commit
7341343534
3 changed files with 41 additions and 4 deletions
30
generate.js
Normal file
30
generate.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
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);
|
||||||
|
}
|
|
@ -7,10 +7,7 @@
|
||||||
"build": "yarn generate && gauntlet build",
|
"build": "yarn generate && gauntlet build",
|
||||||
"dev": "gauntlet dev",
|
"dev": "gauntlet dev",
|
||||||
"format": "eslint --fix .",
|
"format": "eslint --fix .",
|
||||||
"generate": "yarn run generate:tailwindcss",
|
"generate": "node ./generate.js"
|
||||||
"generate:tailwindcss:css": "yarn dlx tailwindcss -i ./src/tailwindcss/generator/input.css -o ./assets/tailwindcss/generated/output.css",
|
|
||||||
"generate:tailwindcss:classes": "node ./src/tailwindcss/generator/index.js",
|
|
||||||
"generate:tailwindcss": "yarn run generate:tailwindcss:css && yarn run generate:tailwindcss:classes"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@project-gauntlet/api": "0.12.0",
|
"@project-gauntlet/api": "0.12.0",
|
||||||
|
|
|
@ -2,6 +2,16 @@ import fs from "fs";
|
||||||
import css from "css";
|
import css from "css";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
|
import { execSync } from "child_process";
|
||||||
|
|
||||||
|
try {
|
||||||
|
execSync(
|
||||||
|
"yarn dlx tailwindcss -i ./src/tailwindcss/generator/input.css -o ./assets/tailwindcss/generated/output.css",
|
||||||
|
{ stdio: "inherit" }
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error running tailwindcss: ", error);
|
||||||
|
}
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
Loading…
Reference in a new issue