Yeoman generator for new services.
Install Yeoman:
npm i -g yo
Clone the repo, install, link and build:
git clone [email protected]:msinton/generator-node-service-bespoke.git && \
cd generator-node-service-bespoke && \
npm i && \
npm link && \
npm run build # or npm run watch
And then, inside of the directory of the new package you want to create:
yo node-service-bespoke
There are several generated documents that describe best practices.
- NEW-SERVICE.md
- RELEASE-NOTES.md (template)
- README.md (template)
The generation of the project is done in several steps. "Prompting" is the first step, where the user must select the project characteristics. Then the templates are generated during the "writing" step. At the "end" step, some commands are run to setup the project (e.g. install npm dependencies, copy githooks, etc). Some related source files are:
- Prompting: available prompts, features texts and followed flow
- Template: Check out the files (the names don't always match) app and the writing of app
- Tests: Take a look at the tests to understand how the templates should work.
There is the option to try the generator inside the repo with: npm run generate-example
, which will create the directory example-project
which will not be tracked by git. You must have the generator previously linked.
- Use the
.tpl
name in files when it has conditional content, so it is copied withthis.fs.copyTpl
- If you want to create a subgenerator, e.g.
yo node-service-bespoke:foo
, place the new generator withinsrc/foo/
(more info)