Tray Template Generator allows users to create customized templates by replacing specific placeholders with user-provided values. It supports both zip files and folders
Usage
import { NodeFsGenerator } from '@trayio/tray-generator';
const templatePath = 'path/to/template';
const outputPath = 'output/path';
const values = {
name: 'foo',
};
const generator = new NodeFsGenerator();
await generator.generate(
templatePath,
outputPath,
values
)();
Template Source
The template source can be either a zip file or a folder. If the template is a zip file, ensure the file extension is .zip
. If it's a folder, provide the path to the folder.
Placeholder Syntax
Placeholders could be defined using the $placeholder$
syntax on file/folder names or withing the content of files.