woltlab-compiler
Version:
A compiler for WoltLab-Package Archives and WoltLab-Package Components
103 lines • 2.58 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Path = require("path");
const UPath = require("upath");
const util_1 = require("util");
const InstructionCompiler_1 = require("../../Compilation/PackageSystem/Instructions/InstructionCompiler");
/**
* Represents a step of a package-installation.
*/
class Instruction {
/**
* Initializes a new instance of the `Instruction` class.
*/
constructor(options) {
/**
* The package this instruction belongs to.
*/
this.collection = null;
/**
* The name of the file to save the compiled instruction to.
*/
this.fileName = null;
/**
* A value indicating whether the instruction should be executed in standalone-mode.
*/
this.standalone = false;
this.FileName = options.FileName;
}
/**
* @inheritdoc
*/
get Collection() {
return this.collection;
}
/**
* @inheritdoc
*/
set Collection(value) {
if (this.Collection !== value) {
if (!util_1.isNullOrUndefined(this.Collection) &&
this.Collection.includes(this)) {
this.Collection.splice(this.Collection.indexOf(this), 1);
}
if (util_1.isNullOrUndefined(value) ||
value.includes(this)) {
this.collection = value;
}
else {
value.push(this);
}
}
}
/**
* @inheritdoc
*/
get DestinationRoot() {
return Path.join(this.Collection.Directory);
}
/**
* @inheritdoc
*/
get FileName() {
return this.fileName;
}
/**
* @inheritdoc
*/
set FileName(value) {
this.fileName = value;
}
/**
* @inheritdoc
*/
get FullName() {
return UPath.join(this.DestinationRoot, this.FileName);
}
/**
* @inheritdoc
*/
get Standalone() {
return this.standalone;
}
/**
* @inheritdoc
*/
set Standalone(value) {
this.standalone = value;
}
/**
* Gets the compiler for compiling the instruction.
*/
get Compiler() {
return new InstructionCompiler_1.InstructionCompiler(this);
}
/**
* @inheritdoc
*/
get ObjectsByID() {
return {};
}
}
exports.Instruction = Instruction;
//# sourceMappingURL=Instruction.js.map