Project Structure:
- Basic liferay workspace intialized with
blade
./generate-cli
: POC for template management, this will eventually be merged into the workspace tools.- Added
./templates
directory to store client extension templates. (Necessary forcreateClientExtension
) - Added
./client-extensions
directory to store actively developed extensions. (Can be anything)
Setup:
- Clone this repo
./gradlew yarnInstall
Deploying Existing Extensions:
- Run
yarn workspaces build
(This is particularly helpful for the "shared" container) cd ./client-extensions
gw deploy
Creating a new Client Extension:
cd ./client-extensions
yarn exec createClientExtension
(POC way to call our tool)- Choose your project and follow the prompts
You may also need to run
gw setupYarn
to properly add the extension to your yarn workspace
Templates have a basic anatomy with four parts.
prompts.json
: questions that are asked when project is generatedbefore-templating-process
: executable that is run after prompts but before template files*.mustache
files: these are templates that take values from your prompts and copy to new project.- Note: One of these
*.mustache
files must be aclient-extension.yaml.mustache
with a supportedtype
. See existing templates for examples.
- Note: One of these
after-templating-process
: executable that is run after template files are generated.
Every template project may have a prompts.json
for setting up yoru template and providing variables for template creation. See inquirer API for specific details.
Example:
[
{
"name": "name",
"message":"What is the name of your Client Extension?",
"type": "string"
}
]
- For
*.mustache
files, see mustache templating documentation. Prompt answers will be available like{{ name }}
in your template. - For executables, use env variables
PROMPTS_*
, for examplePROMPTS_NAME
.
If you would like to create your own template, you can do so and the CLI tool will pick up that template as an option.