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.
To install Hygen, you need Node.js and the repo's package manager. Start by running:
pnpm generate:install
{
"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:
pnpm generate:generic-component
Whenever finding yourself creating the same files over and over again, it's time to create a template. To create a new template: ⬇️
Steps:
./dev/hygen/templates/new
Note:
new
-> specifies generator namegeneric-component
-> action to be performed