UNPKG

woltlab-compiler

Version:

A compiler for WoltLab-Package Archives and WoltLab-Package Components

57 lines 2.66 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const FileSystem = require("fs-extra"); const temp_filesystem_1 = require("temp-filesystem"); const Compiler_1 = require("../Compiler"); const InstructionSetCompiler_1 = require("./InstructionSetCompiler"); const PackageFileCompiler_1 = require("./PackageFileCompiler"); /** * Provides the functionality to compile packages. */ class PackageCompiler extends Compiler_1.Compiler { /** * Initializes a new instance of the `PackageCompiler` class. * * @param item * The item to compile. */ constructor(item) { super(item); } /** * @inheritdoc */ Compile() { return __awaiter(this, void 0, void 0, function* () { let tempDir = new temp_filesystem_1.TempDirectory(); { for (let additionalFile of this.Item.AdditionalFiles) { FileSystem.copy(additionalFile.Source, additionalFile.FileName); } let compiler = new PackageFileCompiler_1.PackageFileCompiler(this.Item); compiler.DestinationPath = tempDir.MakePath("package.xml"); yield compiler.Execute(); let installSetCompiler = new InstructionSetCompiler_1.InstructionSetCompiler(this.Item.InstallSet); installSetCompiler.DestinationPath = tempDir.FullName; yield installSetCompiler.Execute(); for (let updateSet of this.Item.UpdateSets) { let updateSetCompiler = new InstructionSetCompiler_1.InstructionSetCompiler(updateSet); updateSetCompiler.DestinationPath = tempDir.FullName; yield installSetCompiler.Execute(); } yield this.Compress(tempDir.FullName, this.DestinationPath); } tempDir.Dispose(); }); } } exports.PackageCompiler = PackageCompiler; //# sourceMappingURL=PackageCompiler.js.map