How to contribute to the code
You can contribute in a number of ways:
- Report an issue. Reporting it first will ensure that it is in fact an issue, and there is not already a fix in the works.
- After reporting a bug, go one step further and fix it.
- Ensure that your effort is aligned with the project’s roadmap by talking to the maintainers, especially if you are going to spend a lot of time on it.
- Adhere to code style outlined in the style guide.
- Agree to the Contributor License Agreement.
- Submit a pull request through Github.
- Run tests; see Running tests.
Where to start
If you are looking to contribute, but aren’t sure where to start, review open pull requests for the module. For example: LoopBack open pull requests.
Also, please read the source code before contributing. If something is confusing, poorly documented, poorly commented, or could otherwise be improved: open a GitHub issue and link to the file and line of code with a useful description of what you would like to see or think is missing.
LoopBack maintains a current version, a long-term support (LTS) version, and a maintenance version. New features go into the current version; bug fixes can go into the LTS and maintenance versions, depending on the nature of the bug. For more information, see Long-term support.
Recommended Node.js version
Check your Node.js version with the command
LoopBack 2.x supports Node.js v0.10 and v0.12, but LoopBack 3.0 does not support Node.js v0.10 or v0.12.
Submitting a pull request
Follow the GitHub Flow.
- Create a GitHub issue for large changes and discuss the change there before coding. You can skip this step and submit the pull request for minor changes.
- Fork the repository on GitHub.
- Create a branch for you change/feature off of the master branch.
- Make your change. Remember to update tests as well as code! Always run all the tests to assure nothing else was accidentally broken. For bugs, adding a failing test and submitting a pull request usually leads to the bug being fixed quickly. For features, include tests that cover the entire feature. For remote / client facing features, include integration tests in the [loopback-example-app](](https://github.com/strongloop/loopback-example-app).
- Check for unnecessary whitespace with
git diff --checkbefore committing.
- Make commits of logical units and push them to Github.
- Use a descriptive commit message, and follow 50/72 format.
- Use GitHub’s pull requests to submit the patch. Feel free to issue the pull request as soon as you have something partial to show and get reviewed. You can add more commits to your pull request as you are progressing on the implementation. The title of the pull request should start with “WIP” for “work in progress” when the pull request is not complete yet.
- Request a code review. Add a specific committer to speed up this process. (for example,
- Make any requested changes and push to your fork. Make sure your changes are still based on the latest code (use
git rebase upstream/master).
### How to rebase your branch ###
Our code base is always getting updated and being able to successfully rebase your PR is very important. Here are some simple steps to rebase your code:
- Checkout your branch which you are submitting the pull request against
git checkout <my_branch>
- Add an upstream remote from your fork
git remote add upstream <upstream_repo>
- Fetch the latest from the upstream remote
git fetch upstream
- Rebase your code using the interactive mode
git rebase -i upstream/master
- If you are happy with the changes and there are no merge conflicts, push the code to your remote branch
git push origin <my_branch>
All LoopBack projects follow the same convention for running tests. To run a projects test suite, change to the project’s directory and run:
If a test is failing, open an issue on the appropriate repositories GitHub issues page.
Agreeing to the CLA
Like many open source projects, you must agree to the contributor license agreement (CLA) before we can accept (merge) your changes.
In summary, by submitting your code or doc contributions, you are granting us a right to use that code/content under the terms of this agreement, including providing it to others. You are also certifying that you wrote it, and that you are allowed to license it to us. You are not giving up your copyright in your work. The license does not change your rights to use your own contributions for any other purpose.
Contributor License Agreements are important because they define the chain of ownership of a piece of software. Some companies won’t allow the use of free software without clear agreements around code ownership. That’s why many open source projects collect similar agreements from contributors. The LoopBack CLA is based on the Apache CLA.