This document will guide you through the process of contributing to mysql-plus.
If you're new to open source in general, check out GitHub's open source intro guide.
Before creating an issue, please make sure that the problem is with this module and not the mysql module.
If reporting a bug, make sure to include a code snippet and/or other relevant information that can be used to reproduce the bug.
Before writing code and submitting a pull request, it's a good idea to first open an issue to propose the changes you'd like to make. That way, you can find out if your changes are likely to be accepted before you make them. It's not fun trying to contribute to a project only to have your code rejected 😞 (as I know firsthand).
Once you're sure you want to write code, follow these steps:
Fork the project on GitHub, then check out your copy:
git clone https://github.com/<username>/node-mysql-plus.git
cd mysql-plus
git remote add upstream https://github.com/nwoltman/node-mysql-plus.git
Install dependencies and the grunt
command:
npm install
npm install -g grunt-cli # *nix users may need to use `sudo` with this command
Create a feature branch to work on:
git checkout -b my-branch-name -t origin/master
When appropriate, please:
- Update related doc comments (JSDoc 3-style)
- Add/update related tests
You can check that your code's style passes linting by running:
grunt lint
First set the following environment variables so that the tests can connect to your MySQL database:
MYSQL_HOST
(defaults tolocalhost
)MYSQL_PORT
(defaults to3306
)MYSQL_USER
(defaults toroot
)MYSQL_PASSWORD
(defaults to an empty string)
For example, if you're running MySQL on port 3307, you'd have to export the MYSQL_PORT
environment variable:
# *nix
export MYSQL_PORT=3307
# Windows
setx MYSQL_PORT 3307 # Then close and reopen your command prompt
If you have an installation of MySQL running on localhost:3306
with no password set for the root user, you don't need to do anything.
# Runs linting and all tests (make sure this passes before submitting your PR)
grunt
# Runs all tests
grunt test
# Runs only unit tests
grunt test:unit
#Runs only integration tests
grunt test:integration
First, make sure git knows your name and email address:
git config --global user.name "Your Name"
git config --global user.email "your.name@example.com"
Writing good commit logs is important. A commit log should describe what changed and why. Follow these guidelines when writing one:
- The first line should be less that 70 characters and contain a short description of the change.
- Keep the second line blank.
- The rest is a more detailed description of the commit (only if necessary).
A good commit log looks like this:
Briefly explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc.
Use git rebase
to sync your work if something has changed upstream.
$ git fetch upstream
$ git rebase upstream/master
$ git push origin my-branch-name
Then go to GitHub and create a pull request.