We would love for you to contribute code and help make Feathersjs even more productive than it is today! Here are some guidelines we would like you to follow:
- Search for an open or closed PR that relates to your submission. You don't want to duplicate effort.
-
Fork
feathers-community-hooks
. -
Make your changes in a new git branch:
git checkout -b my-hook-branch master
-
Create your hook in file /src/my-hook.js. Use kebab case file names.
-
Follow the hook writing convesntions.
-
Create your test in file /test/my-hook.test.js.
-
Follow the test writing suggestions.
-
If you must configure a Feathers service, configure a memory based one.
-
The NeDB adapter should not be used in tests as it cannot be opened more than once in a process.
-
Categorize your hook in the README. Hooks of a general nature should be mentioned in the concern they address. Hooks useful for specific industries should be categorized by industry.
-
Follow our Coding Rules.
-
Run the full test suite with
npm test
and ensure that all tests pass. -
Commit your changes using a descriptive commit message.
git commit -m "Added hook my-hook which ..."
-
Push your branch to GitHub:
git push origin my-hook-branch
-
In GitHub, send a pull request.
-
If a change is suggested then:
-
Make the required updates.
-
Re-run the test suite to ensure tests are still passing.
-
Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
git rebase master -i git push -f
-
That's it! Thank you for your contribution!
After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:
-
Delete the remote branch on GitHub:
git push origin --delete my-hook-branch
-
Check out the master branch:
git checkout master -f
-
Delete the local branch:
git branch -D my-hook-branch
-
Update your master with the latest upstream version:
git pull --ff upstream master
The most important need is that all code changes and contributions have unit tests.
- Place unit tests in
/test
. They should require their code from/lib
. - Unit tests should not require a build step. Feel free to use the latest Nodejs syntax.
- The repo is set up to use Mocha and Chai.
npm test
will build, lint and test. This command needs to complete successfully before you submit a PR.- Linting is performed using ESLint with the semistandard rule set. This checks for good standards without being oppressive. All Feathers modules use this.
The build:
- Add your code to
/src
. The build step expands it into/lib
. - Babel is set up to use plugin babel-preset-es2015.