XpmInitTemplateBase class
Base class for xpm initialisation templates.
Signature
export declare abstract class XpmInitTemplateBase
Remarks
This abstract class provides the foundation for template-based project initialisation. It handles the complete workflow: property validation, interactive user prompts for missing mandatory values, variable substitution, and file generation using the Liquid templating engine.
Template workflow:
- Properties are validated against their definitions
- Missing mandatory properties trigger interactive prompts (if TTY)
- Substitution variables are prepared from properties
- The
XpmInitTemplateBase.generate()method creates project files
Derived classes must implement XpmInitTemplateBase.generate() to define the specific files and folder structure to create.
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
(constructor)({ context, __dirname, templatesPath, propertiesDefinitions, process: _process, }) |
Constructs an xpm initialisation template instance. |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
string |
The absolute path to the module folder. | |
|
|
The xpm context containing configuration and logging utilities. | ||
|
|
Liquid |
The Liquid templating engine instance. | |
|
|
boolean | ||
|
|
Logger |
The logger instance for output and diagnostics. | |
|
|
NodeJS.Process | ||
|
|
Definitions of all properties supported by this template. | ||
|
|
(Optional) The variables to be used for template substitutions. | ||
|
|
string |
The absolute path to the templates folder. |
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
_copyFolderRecursively(sourceFolderPath, destinationFolderPath) |
|
Recursively copies all contents of a source folder to a destination folder. |
|
| ||
|
|
Validates a property value against its definition. | |
|
Prompts the user interactively for missing property values. | ||
|
Copies a single file from the templates folder to the destination. | ||
|
Copies an entire folder from the templates folder to the destination. | ||
|
|
Generates the project files from the template. | |
|
Determines whether the current platform is supported. | ||
|
render(inputFileRelativePath, outputFileRelativePath, substitutionsVariables) |
Renders a template file using Liquid and writes the output. | |
|
Executes the template initialisation process. |
Generated via tsdoc2docusaurus 1.3.0-pre by API Extractor/Documenter 7.55.2.