2022-04-01 15:45:11 +00:00
|
|
|
import * as fs from "fs";
|
|
|
|
import * as path from "path";
|
2022-04-02 03:58:04 +00:00
|
|
|
import app from "./styleTree/app";
|
2022-05-17 14:08:14 +00:00
|
|
|
import themes from "./themes";
|
2022-04-04 21:39:28 +00:00
|
|
|
import snakeCase from "./utils/snakeCase";
|
2022-04-01 15:45:11 +00:00
|
|
|
|
2022-05-16 22:11:22 +00:00
|
|
|
const themeDirectory = `${__dirname}/../../assets/themes/`;
|
|
|
|
|
|
|
|
// Clear existing themes
|
|
|
|
for (const file of fs.readdirSync(themeDirectory)) {
|
|
|
|
fs.unlinkSync(path.join(themeDirectory, file));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Write new themes to theme directory
|
2022-04-01 15:45:11 +00:00
|
|
|
for (let theme of themes) {
|
2022-04-06 17:35:29 +00:00
|
|
|
let styleTree = snakeCase(app(theme));
|
|
|
|
let styleTreeJSON = JSON.stringify(styleTree, null, 2);
|
|
|
|
let outPath = path.resolve(
|
2022-04-12 16:37:38 +00:00
|
|
|
`${__dirname}/../../assets/themes/${theme.name}.json`
|
2022-04-06 17:35:29 +00:00
|
|
|
);
|
|
|
|
fs.writeFileSync(outPath, styleTreeJSON);
|
|
|
|
console.log(`- ${outPath} created`);
|
2022-04-01 15:45:11 +00:00
|
|
|
}
|