InitTemplateBase class
Base class for xpm init templates.
Signature
export declare abstract class InitTemplateBase
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
InitTemplateBase.generate()method creates project files
Derived classes must implement InitTemplateBase.generate() to define the specific files and folder structure to create.
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
Constructs an |
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 |
Flag indicating whether the template is running in interactive mode. | ||
|
|
Logger |
The logger instance for output and diagnostics. | |
|
The policy flags instance that governs template behaviour. | |||
|
|
NodeJS.Process |
The Node.js process object for accessing runtime environment information. | |
|
|
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 |
|---|---|---|
|
|
Prompts the user interactively for missing property values. | |
|
_copyFolderRecursively({ sourceFolderPath, destinationFolderPath, }, input) |
|
Recursively copies all contents of a source folder to a destination folder. |
|
|
Validates the structure and content of property definitions. | |
|
copyFile({ sourceFileRelativePath, destinationFilePath, }, input) |
Copies a single file from the templates folder to the destination. | |
|
copyFolder({ sourceFolderRelativePath, destinationFolderPath, }, input) |
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({ sourceFilePath, destinationFilePath, substitutionsVariables, }, input) |
Renders a template file using Liquid and writes the output. | |
|
Executes the template initialisation process. | ||
|
Validates a property value against its definition. |
Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.