woltlab-compiler
Version:
A compiler for WoltLab-Package Archives and WoltLab-Package Components
34 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const FileSystem = require("fs-extra");
const Path = require("path");
const ThemeInstruction_1 = require("../../../PackageSystem/Instructions/Customization/Presentation/ThemeInstruction");
/**
* Represents a set of theme-instructions.
*/
class ThemeInstructionCollection extends Array {
/**
* Initializes a new instance of the `ThemeInstructionCollection` class.
*
* @param path
* The path to look for themes.
*/
constructor(path) {
super();
let themeFolders = FileSystem.pathExistsSync(path) ? FileSystem.readdirSync(path).map((entry) => Path.join(path, entry)).filter((entry) => FileSystem.lstatSync(entry).isDirectory()) : [];
for (let themeFolder of themeFolders) {
let metaFile = Path.resolve(Path.join(themeFolder, "Theme"));
if (FileSystem.pathExistsSync(metaFile + ".ts")) {
let currentDir = process.cwd();
process.chdir(themeFolder);
{
let theme = require(metaFile);
this.push(new ThemeInstruction_1.ThemeInstruction({ Theme: theme }));
}
process.chdir(currentDir);
}
}
}
}
exports.ThemeInstructionCollection = ThemeInstructionCollection;
//# sourceMappingURL=ThemeInstructionCollection.js.map