We welcome contributions - thanks for taking the time to contribute! Here are some guidelines to help you get started. These are just guidelines, not rules, so use your best judgment and feel free to propose changes to this document in a pull request.
While not absolutely required, it is encouraged that you first open an issue for any bug or feature request. This allows discussion on the proper course of action to take before coding begins.
In case your editor does not respect .editorconfig
, here is a summary of rules:
- spacing - use spaces not tabs
- 4 spaces for
.js
files - 2 spaces for
package.json
,.yml
and other configuration files that start with a.
- 4 spaces for
- semicolons - mandatory
- quotes - single-quote
- syntax - ES6/ES2015
- variable declarations - use
const
andlet
npm install
Most of the information you need to contribute code changes can be found here. In short: fork, make your changes and submit a pull request (PR).
Fork the project on Github and check out your copy locally:
git clone https://github.com/Marketionist/protractor-cucumber-steps.git
cd protractor-cucumber-steps
Create a feature branch and start hacking:
git checkout -b my-feature-branch origin/master
We practice HEAD-based development, which means all changes are applied directly on top of master.
First make sure git knows your name and email address:
git config --global user.name 'John Doe'
git config --global user.email 'john@example.com'
Writing good commit message is important. A commit message should be around
50 characters or less and contain a short description of the change and
reference issues fixed (if any). Include Fixes #N
, where N is the issue
number the commit fixes, if any.
Use git rebase
(not git merge
) to sync your work with the core repository
from time to time:
git remote add upstream https://github.com/Marketionist/protractor-cucumber-steps.git
git fetch upstream
git rebase upstream/master
Bug fixes and features should have tests. Look at other tests to see how they should be structured.
This project makes use of code linting and e2e tests to make sure we don't break anything. Before you submit your pull request make sure you pass all the tests:
You can run code linting with: npm run lint
.
You can run all the e2e tests with: npm test
.
To run tests with any specific parameters add -- --parameter value
. For example:
npm test -- --cucumberOpts.tags @Tag,@AnotherTag
Tests can be executed locally or remotely using Travis CI. Remote tests run is triggered by each pull request.
git push origin my-feature-branch
Go to https://github.com/yourusername/protractor-cucumber-steps.git and press the New pull request button and fill out the form.
A good PR comment message can look like this:
Explain PR normatively in one line
Details of PR message are a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc.
Fixes #142
Pull requests are usually reviewed within a few days. If there are comments to address, apply your changes in new commits (preferably fixups) and push to the same branch.
When code review is complete, a committer will take your PR and integrate it on protractor-cucumber-steps master branch. Because we like to keep a linear history on the master branch, we will normally squash and rebase your branch history.
So the time has come to publish the latest version of protractor-cucumber-steps to npm - let's rock it!
Before you can actually publish make sure the following statements are true:
- All tests should be green.
- The version number in package.json has been incremented.
- The changelog has been updated with details of the changes in this release. Where possible include the details of the issues affected and the PRs raised.
OK - you're actually ready. We're going to publish. Here we need to go carefully. Follow these steps:
- clone protractor-cucumber-steps from the main repo with this command:
git clone https://github.com/Marketionist/protractor-cucumber-steps.git
- login to npm if you need to:
npm login
- install protractor-cucumber-steps packages with:
npm install
- run linting to check the code:
npm run lint
- run the tests to ensure all is still good:
npm test
If all the tests passed then we're going to ship:
- Tag the release in git. You can see existing tags with the command:
git tag
. If the version in yourpackage.json
is"1.0.1"
then you would tag the release like so:git tag v1.0.1
. For more on type of tags we're using read here. - Push the tag so the new version will show up in the
releases:
git push origin --tags
. - On the releases page, click the "Draft a new release button" and, on the presented page, select the version you've just released, name it and copy in the new markdown that you added to the changelog.
- Now the big moment of publishing updated package to npm:
npm publish
.
Or use the short way:
- From the master branch run
npm run patch
ornpm run minor
ornpm run major
depending on the severity of changes you are publishing in this release. - On the releases page, click the "Draft a new release button" and, on the presented page, select the version you've just released, name it and copy in the new markdown that you added to the changelog.
You've released! Relax and enjoy your accomplishment.