Skip to content

Latest commit

 

History

History
243 lines (166 loc) · 13.2 KB

CONTRIBUTING.md

File metadata and controls

243 lines (166 loc) · 13.2 KB

Contributing to semantic-release

✨ Thanks for contributing to semantic-release! ✨

As a contributor, here are the guidelines we would like you to follow:

We also recommend to read How to Contribute to Open Source.

Code of conduct

Help us keep semantic-release open and inclusive. Please read and follow our Code of conduct.

How can I contribute?

Improve documentation

As a semantic-release user you are the perfect candidate to help us improve our documentation: typo corrections, clarifications, more examples, new recipes etc. Take a look at the documentation issues that need help.

Please follow the Documentation guideline.

Give feedback on issues

Some issues are created without information requested in the Bug report guideline. Help making them easier to resolve by adding any relevant informations.

Issues with the design label are meant to discuss the implementation of new features. Participating in the discussion is a good opportunity to get involved and influence the future direction of semantic-release.

Fix bugs and implement features

Confirmed bug and ready to implement features are marked with the help wanted label. Post a comment on an issue to indicate you would like to work on it and to request help from the @semantic-release/maintainers and the community.

Using the issue tracker

The issue tracker is the channel for bug reports, features requests and submitting pull requests only. Please use the Support and Get help sections for support, troubleshooting and questions.

Before opening an Issue or a Pull Request, please use the GitHub issue search to make the bug or feature request hasn't been already reported or fixed.

Bug report

A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report and fill the information requested in the Bug report template.

Feature request

Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible and fill the information requested in the Feature request template.

New plugin request

Plugins are a great way to extend semantic-release capabilities, integrate with other systems and support new project type. Please provide as much detail and context as possible and fill the information requested in the New plugin request template.

Submitting a Pull Request

Good pull requests whether patches, improvements or new features are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.

Please ask first before embarking on any significant pull request (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.

If you never created a pull request before, welcome 🎉 😄. Here is a great tutorial on how to send one :)

Here is a summary of the steps to follow:

  1. Set up the workspace
  2. If you cloned a while ago, get the latest changes from upstream and update dependencies:
$ git checkout master
$ git pull upstream master
$ rm -rf node_modules
$ npm install
  1. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix:
$ git checkout -b <topic-branch-name>
  1. Make your code changes, following the Coding rules
  2. Push your topic branch up to your fork:
$ git push origin <topic-branch-name>
  1. Open a Pull Request with a clear title and description.

Tips:

  • For ambitious tasks, open a Pull Request as soon as possible with the [WIP] prefix i nthe title, in order to get feedback and help from the community.
  • Allow semantic-release maintainers to make changes to you Pull Request branch this way we can rebase it and make some minor changes if necessary. All changes we make will be done in new commit and we'll ask for your approval before merging them.

Coding rules

Source code

To ensure consistency and quality throughout the source code, all code modification must have:

  • No linting errors
  • A test for every possible cases introduced by your code change
  • 100% test coverage
  • Valid commit message(s)
  • Documentation for new features
  • Updated documentation for modified features

Documentation

To ensure consistency and quality all documentation modification must:

  • Refer to brand in bold with proper capitalization, i.e. GitHub, semantic-release, npm
  • Prefer tables over lists when listing key values, i.e. List of options with their description
  • Use links when, the first you are referring to:
    • a semantic-release concept described somewhere else in the documentation, i.e. How to contribute
    • a third-party product/brand/service, i.e. Integrate with GitHub
    • an external concept or feature, i.e. Create a GitHub release
    • a package or module, i.e. The @semantic-release/github module
  • Use the the single backtick code quoting for:
    • commands inside sentences, i.e. the semantic-release command
    • programming language keywords, i.e. function, async, String
    • packages or modules, i.e. The @semantic-release/github module
  • Use the the triple backtick code formatting for:
    • code examples
    • configuration examples
    • sequence of command lines

Commit message guidelines

Commit message format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

The header is mandatory and the scope of the header is optional.

The footer can contain a closing reference to an issue.

Revert

If the commit reverts a previous commit, it should begin with revert: , followed by the header of the reverted commit. In the body it should say: This reverts commit <hash>., where the hash is the SHA of the commit being reverted.

Type

The type must be one of the following:

Type Description
build Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
ci Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
docs Documentation only changes
feat A new feature
fix A bug fix
perf A code change that improves performance
refactor A code change that neither fixes a bug nor adds a feature
style Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
test Adding missing tests or correcting existing tests

Subject

The subject contains succinct description of the change:

  • use the imperative, present tense: "change" not "changed" nor "changes"
  • don't capitalize first letter
  • no dot (.) at the end

Body

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.

Footer

The footer should contain any information about Breaking Changes and is also the place to reference GitHub issues that this commit Closes.

Breaking Changes should start with the word BREAKING CHANGE: with a space or two newlines. The rest of the commit message is then used for this.

Examples

`fix(pencil): stop graphite breaking when too much pressure applied`
`feat(pencil): add 'graphiteWidth' option`

Fix #42
perf(pencil): remove graphiteWidth option`

BREAKING CHANGE: The graphiteWidth option has been removed.

The default graphite width of 10mm is always used for performance reasons.

Working with the code

Set up the workspace

Fork the project, clone your fork, configure the remotes and install the dependencies:

# Clone your fork of the repo into the current directory
$ git clone https://github.com/semantic-release/<repo-name>
# Navigate to the newly cloned directory
$ cd <repo-name>
# Assign the original repo to a remote called "upstream"
$ git remote add upstream https://github.com/semantic-release/<repo-name>
# Install the dependencies
$ npm install

Lint

All the semantic-release repository use XO for linting and Prettier for formatting. Prettier formatting will be automatically verified and fixed by XO.

Before pushing your code changes make sure there is no linting errors with npm run lint.

Tips:

  • Most linting errors can be automatically fixed with npm run lint --fix.
  • Install the XO plugin for your editor to see linting error directly in your editor and automatically fix them on save.

Tests

Running the integration test require to install Docker on your machine.

All the semantic-release repository use AVA for writing and running tests.

Before pushing your code changes make sure all test pass and the coverage is 100%:

$ npm run test

Tips: During development you can:

  • run only a subset of test files with ava <glob>, for example ava test/mytestfile.test.js
  • run in watch mode with ava -w to automatically run a test file when you modify it
  • run only the test you are working on by adding .only to the test definition

Commits

All the semantic-release repository use Commitizen to help you create valid commit messages.

After staging your changes with git add, run npm run cm to start the interactive commit message CLI.