@manuth/generator-wsc-package
Version:
A Generator for WoltLab Suite Core Packages.
84 lines • 2.18 kB
JavaScript
import path from "upath";
import { LocalInstructionComponent } from "../../../Components/LocalInstructionComponent.js";
import { PackageComponentType } from "../Settings/PackageComponentType.js";
const { join } = path;
/**
* Provides a component for generating sql-script instructions.
*
* @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 SQLScriptComponent extends LocalInstructionComponent {
/**
* Initializes a new instance of the {@link SQLScriptComponent `SQLScriptComponent<TSettings, TOptions, TComponentOptions>`} class.
*
* @param generator
* The generator of the component.
*/
constructor(generator) {
super(generator);
}
/**
* @inheritdoc
*/
get ID() {
return PackageComponentType.SQLScript;
}
/**
* @inheritdoc
*/
get DisplayName() {
return "SQL-Script to Execute During the Installation";
}
/**
* @inheritdoc
*/
get FileMappings() {
return [
...super.FileMappings,
this.SQLFileMapping
];
}
/**
* @inheritdoc
*/
get DefaultSourceBaseName() {
return "install.sql";
}
/**
* @inheritdoc
*/
get SourceQuestion() {
return Object.assign(Object.assign({}, super.SourceQuestion), { message: "Where do you want to store the SQL-file?" });
}
/**
* Gets the file-mapping for creating the example sql-script.
*/
get SQLFileMapping() {
return {
Destination: join(this.ComponentOptions.Source),
Processor: (target, generator) => {
generator.fs.write(target.Destination, "");
}
};
}
/**
* @inheritdoc
*
* @param options
* The options which have been provided by the user.
*
* @returns
* The name of the instruction-class.
*/
GetClassName(options) {
return "SQLInstruction";
}
}
//# sourceMappingURL=SQLScriptComponent.js.map