mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
Co-authored-by: Dusan Vuckovic <dv@zammad.com> Co-authored-by: Ralf Schmid <rsc@zammad.com>
1.5 KiB
1.5 KiB
Hygen Template Generator
Table of Contents
Introduction
Hygen is a powerful, extensible code generator that helps us quickly create files and boilerplate code based on customizable templates. This document provides an overview of how to use Hygen in Zammad, including setup, template creation, and common usage patterns.
Setup
To install Hygen, you need Node.js and the repo's package manager. Start by running:
pnpm generate:install
Docs
Generating a template
{
"generate:generic-component": "pnpm --dir ./.dev/hygen exec hygen new generic-component",
"generate:composable": "pnpm --dir ./.dev/hygen exec hygen new composable ",
"generate:store": "pnpm --dir ./.dev/hygen exec hygen new store",
"generate:view": "pnpm --dir ./.dev/hygen exec hygen new view"
}
Steps:
- Open the terminal
- Run the command f.e
pnpm generate:generic-component - Follow the CI prompts
Writing your own templates
Whenever finding yourself creating the same files over and over again, it's time to create a template. To create a new template: ⬇️
Steps:
- Navigate into
./dev/hygen/templates/new - Create a prompt.js file
- Add additional configurations in lib.config.js
- Create a template file in the directory
Note:
- For example directory
new-> specifies generator name generic-component-> action to be performed