Skip to content

Latest commit

 

History

History
173 lines (115 loc) · 8.12 KB

CONTRIBUTING.md

File metadata and controls

173 lines (115 loc) · 8.12 KB

Contributing to Cypress Documentation

Thanks for taking the time to contribute! 😄

Table of Contents

Code of Conduct

All contributors are expected to abide by our Code of Conduct.

Getting Started

The documentation in this repo is generated using Hexo.

Fork this repository

Using GitHub, create a copy (a fork) of this repository under your personal account.

Clone your forked repository

git clone [email protected]:<your username>/cypress-documentation.git
cd cypress-documentation

Install dependencies:

Note: at least Node 6 is required, but Node 8 with NPM v5 is preferred to take advantage of the package lock file.

npm install

This will install this repo's direct dependencies.

Then, build the public directory and start the app:

npm run build
npm start

Visit http://localhost:2222/.

Note: If you need to debug the documentation build step, run it this way:

DEBUG=docs npm run build

Note: When Cypress generates the docs, it has to validate hundreds (thousands?) of URLs. This is expensive and the docs take a while to initialize. You can turn off validation of external URLs by passing a flag:

npm start -- --no-validate

Testing

We use Cypress itself to test the documentation. To start the server and run E2E tests, execute the command npm run test-e2e.

Writing Documentation

Tags

In addition to built-in Hexo tags (like {% img ... %}), we have written several custom ones. They help us write consistent documentation, check referenced urls, etc. You can find the list of tags and examples in TAGS.md.

Adding Examples

To add a blog, talk or podcast to our docs, submit a pull request with your data added to the corresponding blogs.yml, talks.yml, or podcasts.yml file.

Add an associated image with the example within the source/img/examples directory. Each image should have a resolution of 715×480. Reference the image in the markdown document as follows:

{% img /img/examples/name-of-file.jpg "alt text describing img" %}

Adding Plugins

To add a plugin, submit a pull request with the corresponding data added to the plugins.yml file. Your plugin should have a name, description, link to the plugins code, as well as any keywords.

Adding Pages

To add a page such as a new guide or API documentation:

  • Add the new page to the relevant directory under source.
  • Link to your new page in the sidebar.yml.
  • Add translations for the sidebar link (for English, this is located in en.yml).
  • Build the documentation site locally so that you can visually inspect your new page and the links to it.
  • Submit a pull request for your change.

A Worked Example

Let's imagine that the Cypress team have just added a new command called privateState and you've picked up the task to document it.

API documentation for commands is in the source/api/commands directory. Add a file called privatestate.md to that directory. Look to the existing documentation to see how to structure the content.

Once you've written the documentation the next step is to link to it from the sidebar. Open the source/_data/sidebar.yml file and add a link the new privatestate page. In this example we're adding a command so we'll add a link underneath the api.commands section.

api:
  commands:
    and: and.html
    as: as.html
    blur: blur.html
    # ...
    privatestate: privatestate.html

Finally, open themes/cypress/languages/en.yml and add an English translation for that sidebar link's title. In this example we're adding a command so we'll add the following text:

sidebar:
  api:
    introduction: Introduction
    api: API
    commands: Commands
    # ...
    privatestate: privateState

Writing the Changelog

When adding to the Changelog, be sure to follow the category structure defined below (in this order). Each bullet point in the list should always be associated to an issue on the cypress repo and link to that issue (except for Documentation changes).

Categories

  • Summary - If it is a large release, you may write a summary explaining what the point of this release is (mostly used for breaking releases)
  • Breaking Changes - The users current implementation of Cypress may break after updating.
  • Features - A new feature
  • Bugfixes - A bug existed in Cypress and a PR fixed the issue
  • Misc - Not a feature or bugfix, but work that was done. May be internal work that was done and associated with an issue
  • Documentation Changes - our docs were updated based on behavior changes in release

Committing Code

Linting

Danger 📛: because we are minifying client-side code using a Hexo plugin which in turn calls uglify, the code should be strictly ES5. Thus everything inside the theme should be linted with ES5 settings and not upgraded to ES6.

Pull Requests

You should push your local changes to your forked GitHub repository and then open a pull request from your repo to the cypress-io/cypress-documentation repo.

  • The pull request should be from your repository to the develop branch in cypress-io/cypress-documentation
  • When opening a PR for a specific issue already open, please use the address #[issue number] or closes #[issue number] syntax in the pull request description.
  • Please check the "Allow edits from maintainers" checkbox when submitting your PR. This will make it easier for the maintainers to make minor adjustments, to help with tests or any other changes we may need. Allow edits from maintainers checkbox

Contributor License Agreement

We use a cla-assistant.io web hook to make sure every contributor assigns the rights of their contribution to Cypress.io. If you want to read the CLA agreement, its text is in this gist.

After making a pull request, the CLA assistant will add a review comment. Just click on the link and accept the CLA. That's it!

Deployment

We will try to review and merge pull requests as fast as possible. After merging, we will deploy it to the staging environment, run E2E tests (using Cypress itself of course!), and then merge it into master, which will deploy it to the official https://docs.cypress.io website. If you want to know our deploy process, read DEPLOY.md.