Open brikis98 opened 7 years ago
Can you give an example use case of this?
Sure. Let's say you're using boilerplate to generate a skeleton for a react.js project. Actually, here's an example of just such a template: https://github.com/Granze/react-starterify
You could package that template as a boilerplate template and use the callbacks as follows:
start
: Look on GitHub and see if there is a newer version of the template available. If there is, prompt the user to download the latest version.file
: when the package.json
file is being processed, run the npm update
command to fetch the latest version of each Node.js package (this may be a way to solve #8, BTW). end
: run npm install
to install all those dependencies and npm run watch
to immediately put you into live reload development mode as soon as the project is finished generating.
To make
boilerplate
even more flexible and powerful, it would be great to support "callbacks" where you can provide arbitrary code to execute at specific times. For example, there could be astart
callback that gets called just after Boilerplate gathers all variables but before it starts generating; afile
callback called for each file and folder Boilerplate processes; and anend
callback called after project generation is finished. The callbacks could be defined as simple shell commands inboilerplate.yml
: