Use the sub-generator generator to create a sub-generator. Add the name to the files section under package.json
Go to the root folder then use the generator-generator
generator to create a new generator set then add the name of generator to the package.json
- Create a Folder inside the generator set to add (if it's a javascript project like react create a folder under javascript).
- Create a
templates
folder with the contents of the project inside of it. - Copy the
index.js
of another project, it should mostly copy the contents of the templates folder however if you need more logic this is the file to edit.
After copying the repo go to the generator folder and use the command
yarn link
You should then be able to see that generator when you use
yo --generators