Templates

The files mage generates come from the templates folder of this repository:

Template Used by
theme/ mage add theme
module/ mage add module
module-hyva/ mage add module, the extra files of a Hyvä module
magento.gitignore mage setup, when the project has no .gitignore
LocalValetDriver.php mage setup with Valet, when the project has none
composer-hyva.json mage add hyva
composer-hyva-dev.json mage add hyva --dev
composer-hyva-sample-dev.json mage add sample hyva, without a Hyvä license
composer-storeinfo.json mage add storeinfo

Sync

The first command that needs a template downloads them to ~/.config/mage/templates. After that they are only updated by mage self-update, so mage works offline and never fetches templates on a normal command. A failed update keeps the previous templates.

Running mage unbuilt, from src/mage.sh, uses the templates folder of the repository directly, see development.

Placeholders

A template file holds {{NAME}} placeholders, which are replaced when copied, such as {{VENDOR}}, {{MODULE}} and {{PARENT}}. The pages of the commands list which ones they fill.

The composer-*.json files are composer fragments, their placeholders are asked when applied.

Using a bundled json yourself

The bundled composer fragments can also be applied directly, or copied and changed:

mage add ~/.config/mage/templates/composer-hyva.json

View this page on GitHub