We welcome you to join the development of Moleculer. This document helps you through the process.
Before You Start
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.
Contribution in the core modules
Follow this workflow if you would like to modify the core modules.
Workflow
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 installStart 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.
Your pull request will only get merged when tests passed and covered all codes. Don’t forget to run tests before submission.
Commit & push the branch.
Create a pull request and describe the change.
If you’ve changed APIs, update the documentation as well.
Contribution to create a new Moleculer module
Follow this workflow if you would like to create a new module for Moleculer
Workflow
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!
Reporting Issues
When you encounter some problems when using Moleculer, you can find the solutions in FAQ or ask us on Discord or on StackOverflow. If you can’t find the answer, please report it on GitHub Issues.
Thank you!