@manuth/generator-wsc-package
Version:
A Generator for WoltLab Suite Core Packages.
57 lines • 1.78 kB
JavaScript
import { PathPrompt } from "@manuth/generator-ts-project";
import { LocalFileInstructionMapping } from "../FileMappings/LocalFileInstructionMapping.js";
import { InstructionComponent } from "./InstructionComponent.js";
/**
* Provides a component for generating instruction-files which are loaded from local.
*
* @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 LocalInstructionComponent extends InstructionComponent {
/**
* Gets a question for asking for the source of the templates.
*/
get SourceQuestion() {
return {
type: PathPrompt.TypeName,
name: "Source",
default: (options) => {
return this.GetDefaultSource(options);
}
};
}
/**
* @inheritdoc
*/
get ComponentOptionQuestionCollection() {
return [
...super.ComponentOptionQuestionCollection,
this.SourceQuestion
];
}
/**
* @inheritdoc
*/
get InstructionFileMapping() {
return new LocalFileInstructionMapping(this);
}
/**
* Gets the default full name of the path to suggest in the {@link LocalInstructionComponent.SourceQuestion `SourceQuestion`}.
*
* @param options
* The options of the component.
*
* @returns
* The default full name of the path to suggest in the {@link LocalInstructionComponent.SourceQuestion `SourceQuestion`}.
*/
GetDefaultSource(options) {
return this.Generator.assetPath(this.DefaultSourceBaseName);
}
}
//# sourceMappingURL=LocalInstructionComponent.js.map