Thanks for taking the time to contribute! 😄
All contributors are expected to abide by our Code of Conduct.
The documentation uses Nuxt.js to generate a static website. Refer to the Nuxt.js documentation for specifics about the Nuxt.js framework.
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
This project uses @nuxt/content
which enables you to write Vue components within markdown. Any component files placed within the /components/global
directory will be available for use within the markdown files. There are a few limitations with using Vue components in markdown.
Use <Alert>
to grab the reader's attention with a blurb. You can change the look of the <Alert>
by setting the type
prop to info
, tip
, warning
, or danger
.
<Alert type="info">This is an important message.</Alert>
If you are starting a new page and want to add images, add a new folder to assets/img
. For example when adding a new "Code Coverage" page to guides/tooling
, I have created new folder assets/img/guides/tooling
and copied an image there called coverage-object.png
. Within the markdown, I can include the image using the <DocsImage />
component.
<DocsImage
src="/assets/img/guides/tooling/coverage-object.png"
alt="code coverage object"
/>
You can embed videos within the markdown with the <DocsVideo>
component. Currently, it supports local files, YouTube, and Vimeo embeds. Set the src
prop to a relative path for a local video file or the embed link for YouTube or Vimeo videos. You should also set a title
prop describing the video for accessibility reasons.
<DocsVideo
src="https://www.youtube.com/embed/dQw4w9WgXcQ"
title="Cypress Tips and Tricks"
>
Font Awesome icons can be used within markdown. Set the name
prop to the name of the Font Awesome icon. Make sure that the icon appears in the list of imported icons within the nuxt.config.js
file under the fontawesome
key.
<Icon name="question-circle"></Icon>
To add a course, blog, talk, podcast, or screencast to our docs, submit a pull request with your data added to the corresponding courses.json, blogs.json, talks.json, podcasts.json or screencasts.json file.
Add an associated image with the example within the assets/img
directory. Each image should have a resolution of 715×480. Reference the image in the markdown document as follows:
<DocsImage src="/img/examples/name-of-file.jpg" alt="alt text describing img" />
To add a plugin, submit a pull request with the corresponding data added to the plugins.json
file. Your plugin should have a name, description, link to the plugin's code, as well as any keywords.
To add a page such as a new guide or API documentation:
- Add the new page to the relevant directory under
content
. - Link to your new page in the
sidebar.json
. - Add translations for the sidebar link for each supported language (for English, this is located in
en.json
). - Build the documentation site locally so that you can visually inspect your new page and the links to it.
- REQUIRED: Commit the new file using git - we auto-generate the doc to display within each supported language, this auto-generation depends on the file existing in git.
- Submit a pull request for your change.
Note: If you need to change the overall layout of a page, you should create a Vue component within the
/pages
directory. The/pages
directory contains the_.vue
components responsible for generating the views for the routes/guides
,/api/
,/plugins
, etc. If you wanted to create a guide page that has a different layout from the other guide pages, you would create a component file within/guides
matching the route name that you want to use. For example, if I wanted to create a unique guide page without the sidebar about using the Dashboard, I would create a file called/pages/guides/my-dashboard-guide.vue
and create a Vue component for the specific layout I want to create. The page will then be accessible at the route/guides/my-dashboard-guide
.
To delete a page:
- Delete the page from the relevant directory under
content
. - Remove the link from the the
sidebar.json
. - Remove the translations for the sidebar link for each supported language (for English, this is located in
en.json
). - REQUIRED: Commit the change using git - we auto-remove the doc within each supported language, this auto-generation depends on the file being deleted in git, the build will not work until this is commited.
- Build the documentation site locally so that you can visually inspect and make sure it was properly deleted.
Let's imagine that the Cypress team has just added a new command called privateState
and you've picked up the task to document it.
API documentation for commands is in the content/api/commands
directory.
- Add a file called
privatestate.md
to that directory. - Write the document. Look to the existing documentation to see how to structure the content.
- Open the
content/_data/sidebar.json
file and add a link the newprivatestate
page. In this example we're adding a command so we'll add a link underneath theapi.commands
section.
"api": {
"commands": {
"and": "and.html",
"as": "as.html",
"blur": "blur.html",
// ...
"privatestate": "privatestate.html"
}
}
- Open
content/_data/en.json
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"
}
}
- Submit a pull request for your change.
When adding to the Changelog, create a new file in content/_changelogs
named as the version number. 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).
- 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.
- Deprecations - Features have been deprecated, but will not 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
Javascript code is linted with ESLint.
You should push your local changes to your forked GitHub repository and then open a pull request (PR) from your repo to the cypress-io/cypress-documentation
repo.
- The PR should be from your repository to the
master
branch incypress-io/cypress-documentation
- When opening a PR for a specific issue already open, please use the
closes #issueNumber
syntax in the pull request description—for example,closes #138
—so that the issue will be automatically closed when the PR is merged. - 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.
- All PRs against
master
will automatically create a deploy preview URL with Netlify. The deploy preview can be accessed via the PR'snetlify-cypress-docs/deploy-preview
status check:
- All branches will automatically create a branch deploy preview. The branch deploy previews do not appear as a GitHub status check like deploy previews. You can view your branch's deploy preview by visiting
https://$BRANCH_NAME--cypress-docs.netlify.app
where$BRANCH_NAME
is your git branch name. For example, if my branch was namedmy-branch
, my branch preview will be available athttps://my-branch--cypress-docs.netlify.app
.
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. Click on the link and accept the CLA. That's it!
We will try to review and merge pull requests as fast as possible. After merging, the changes will be made available on the official https://docs.cypress.io website.
Due to CircleCI API limitations, you cannot trigger a workflow build using the API. Thus if you need to build, test and deploy your-branch
branch for example, your best bet is to create an empty GitHub commit in the cypress-io/cypress-documentation repository in the your-branch
branch. We have added make-empty-github-commit as a dev dependency and set it as make-empty-commit
NPM script in the package.json.
To trigger production rebuild and redeploy, use personal GitHub token and run:
GITHUB_TOKEN=<your token> npm run make-empty-commit -- --message "trigger deploy" --branch master
As always, using as-a is recommended for storing and using sensitive environment variables.