We welcome you to join the development of Moleculer. This document helps you through the process.
Please follow the coding style:
- Use tabs with size of 4 for indents.
- Always use strict mode & semicolons.
- Use double quotes instead of single quotes.
Follow this workflow if you would like to modify the core modules.
-
Fork the moleculerjs/moleculer repo.
-
Clone the repository to your computer and install dependencies.
$ git clone https://github.com/<username>/moleculer.git $ cd moleculer $ npm install
-
Start Moleculer in dev mode
$ npm run dev
or in continuous test mode
$ npm run ci
-
Fix the bug or add a new feature.
-
Run tests & check the coverage report.
$ npm test
If you added new features, please add relevant new test cases! We aim to 100% cover.
{% note info %} Your pull request will only get merged when tests passed and covered all codes. Don't forget to run tests before submission. {% endnote %}
-
Commit & push the branch.
-
Create a pull request and describe the change.
-
If you've changed APIs, update the documentation as well.
Follow this workflow if you would like to create a new module for Moleculer
-
Install the command-line tool.
$ npm install moleculer-cli -g
-
Create a new module skeleton (named
moleculer-awesome
).$ moleculer init module moleculer-awesome
-
Edit
src/index.js
and implement the logic. -
For development use the
dev
mode (it starts your module withexample/simple/index.js
)$ npm run dev
or the continuous test mode
$ npm run ci
-
Create tests in
test/unit/index.spec.js
& cover the full source.$ npm test
-
If it's done and you think it will be useful for other users, tell us!
When you encounter some problems when using Moleculer, you can find the solutions in FAQ or ask us on Gitter. If you can't find the answer, please report it on GitHub Issues.
Thank you!