themes.ts

 1import fs from "fs";
 2import path from "path";
 3import Theme from "./themes/common/theme";
 4
 5const themes: Theme[] = [];
 6export default themes;
 7
 8const themesPath = path.resolve(`${__dirname}/themes`);
 9for (const fileName of fs.readdirSync(themesPath)) {
10  if (fileName == "template.ts") continue;
11  const filePath = path.join(themesPath, fileName);
12
13  if (fs.statSync(filePath).isFile()) {
14    const theme = require(filePath);
15    if (theme.dark) themes.push(theme.dark);
16    if (theme.light) themes.push(theme.light);
17  }
18}