@manuth/generator-wsc-package
Version:
A Generator for WoltLab Suite Core Packages.
87 lines • 2.28 kB
JavaScript
import { join } from "node:path";
import { FileUploadComponentBase } from "../../../Components/FileUploadComponentBase.js";
import { PackageComponentType } from "../Settings/PackageComponentType.js";
/**
* Provides a component for generating templates.
*
* @template TSettings
* The type of the settings of the generator.
*
* @template TOptions
* The type of the options of the generator.
*
* @template TComponentOptions
* The type of the options of the component.
*/
export class TemplateComponent extends FileUploadComponentBase {
/**
* Initializes a new instance of the {@link TemplateComponent `TemplateComponent<TSettings, TOptions, TComponentOptions>`} class.
*
* @param generator
* The generator of the component.
*/
constructor(generator) {
super(generator);
}
/**
* @inheritdoc
*/
get ID() {
return PackageComponentType.Template;
}
/**
* @inheritdoc
*/
get DisplayName() {
return "Templates";
}
/**
* @inheritdoc
*/
get FileMappings() {
return [
...super.FileMappings,
this.TemplateFileMapping
];
}
/**
* @inheritdoc
*/
get DefaultSourceBaseName() {
return "templates";
}
/**
* @inheritdoc
*/
get AppQuestion() {
return Object.assign(Object.assign({}, super.AppQuestion), { message: "What application do you want to upload the templates to?" });
}
/**
* @inheritdoc
*/
get SourceQuestion() {
return Object.assign(Object.assign({}, super.SourceQuestion), { message: "Where do you want to store the templates?" });
}
/**
* Gets the file-mapping for creating the example-template.
*/
get TemplateFileMapping() {
return {
Source: this.Generator.templatePath("template.tpl"),
Destination: join(this.ComponentOptions.Source, "example.tpl")
};
}
/**
* @inheritdoc
*
* @param options
* The options which have been provided by the user.
*
* @returns
* The name of the instruction-class.
*/
GetClassName(options) {
return "TemplateInstruction";
}
}
//# sourceMappingURL=TemplateComponent.js.map