Creating Generators
SAO provides a generator for creating a new generator:
#
Folder StructureThe basic folder structure is as follows:
๐ saofile.js:
prompts
: CLI prompts to retrive answers from current user.actions
: A series of actions to manipulate files.completed
: A function that will be invoked when the whole process is finished.
Now you can run the generator to generate a new project:
Note that if no saofile.js
was found in the generator, SAO will use a default one which would simply copy all files into output directory.
#
Access SAO InstanceIf you want to access the instance you can use actions
prompts
as function
, the SAO instance will be available as this
in the function:
For a complete list of options in saofile.js
, please check out GeneratorConfig References.