@sealcode/sealgen
v0.19.17
Published
Module to automate adding routes and collections to a sealious application
Readme
In order to add Font Squirrel fonts with get-fonts command you need to create fonts.json file with the following structure:
{
"fontSquirrel": {
"source-sans-pro": [],
"fira-sans": ["hair", "medium"]
}
}where you put an empty brackets for a regular style font or a list of desired font styles.
Register External Controllers and Styles
When creating a module that is a dependency for a Sealgen app, you can automatically register your module's controllers and styles with the parent project using these commands:
register-external-controllers
Registers a module's stimulus controllers directory with the parent project's sealgen.controllerDirs configuration.
npx sealgen register-external-controllers <module-name> <subdirectory>Example:
npx sealgen register-external-controllers my-module src/stimulus-controllersThis will add node_modules/my-module/src/stimulus-controllers to the parent project's package.json sealgen configuration.
register-external-styles
Registers a module's styles directory with the parent project's sealgen.styleDirs configuration.
npx sealgen register-external-styles <module-name> <subdirectory>Example:
npx sealgen register-external-styles my-module src/stylesThis will add node_modules/my-module/src/styles to the parent project's package.json sealgen configuration.
Usage in Module Development
You can add these commands to your module's package.json postinstall script to automatically register your controllers and styles when the module is installed:
{
"name": "my-module",
"scripts": {
"postinstall": "npx sealgen register-external-controllers my-module src/stimulus-controllers && npx sealgen register-external-styles my-module src/styles"
}
}How It Works
- The command traverses up the directory tree from the current working directory
- It looks for a
package.jsonfile that contains asealgenconfiguration - It adds the specified path to the appropriate array (
controllerDirsorstyleDirs) - If the
sealgenconfiguration doesn't exist, it creates it - If the path is already present, it doesn't add a duplicate
This ensures that when your module is installed as a dependency, the parent project will automatically know where to find your controllers and styles.
Attributions
File icon - Gnome Project
