feat(docs): add a Debugging section to CONTRIBUTING.md (#4575)

This commit is contained in:
Nilay (Kancer) 2020-12-06 17:56:31 +01:00 committed by GitHub
parent 7697b907d7
commit 238530bc93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,20 +7,17 @@ For details on contributing to documentation, see [Website Directory Readme](htt
## Setup ## Setup
> Install Node.js (LTS) on your system: [https://nodejs.org/](https://nodejs.org/) > Install [Node.js (LTS)](https://nodejs.org/) and [yarn](https://yarnpkg.com/en/docs/install) on your system.
> Install yarn on your system: [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
### Install dependencies ### Install dependencies
> Only required on the first run, subsequent runs can use `yarn start` to both > Only required on the first run, subsequent runs can use `yarn start` to both bootstrap and run the development server.
> bootstrap and run the development server.
```sh ```sh
$ git clone https://github.com/netlify/netlify-cms git clone https://github.com/netlify/netlify-cms
$ cd netlify-cms cd netlify-cms
$ yarn yarn
$ yarn bootstrap yarn bootstrap
``` ```
### Run locally ### Run locally
@ -144,6 +141,48 @@ Netlify CMS uses the [Forking Workflow](https://www.atlassian.com/git/tutorials/
7. PR's must be rebased before merge (feel free to ask for help). 7. PR's must be rebased before merge (feel free to ask for help).
8. PR should be reviewed by two maintainers prior to merging. 8. PR should be reviewed by two maintainers prior to merging.
## Debugging
`yarn start` spawns a development server and uses `dev-test/config.yml` and `dev-test/index.html` to serve the CMS.
In order to debug a specific issue follow the next steps:
1. Replace `dev-test/config.yml` with the relevant `config.yml`
2. Change the content of `dev-test/index.html` to:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Netlify CMS</title>
</head>
<body>
<script src="dist/netlify-cms.js"></script>
<!-- <script>
// this is the place to add CMS customizations if you need to, e.g.
CMS.registerPreviewTemplate('posts', PostPreview);
</script> -->
</body>
</html>
```
3. Run `yarn start`
4. Open `http://localhost:8080/` in the browser and you should have access to the CMS
### Debugging Git Gateway
When debugging the CMS with Git Gateway you must:
1. Have a Netlify site with [Git Gateway](https://docs.netlify.com/visitor-access/git-gateway/) and [Netlify Identity](https://docs.netlify.com/visitor-access/identity/) enabled. An easy way to create such a site is to use a [template](https://www.netlifycms.org/docs/start-with-a-template/), for example the [Gatsby template](https://app.netlify.com/start/deploy?repository=https://github.com/AustinGreen/gatsby-starter-netlify-cms&stack=cms)
2. Tell the CMS the URL of your Netlify site using a local storage item. To do so:
1. Open `http://localhost:8080/` in the browser
2. Write the below command and press enter: `localStorage.setItem('netlifySiteURL', 'https://yourwebsiteurl.netlify.app/')`
3. To be sure, you can run this command as well: `localStorage.getItem('netlifySiteURL')`
4. Refresh the page
5. You should be able to log in via your Netlify Identity email/password
## License ## License
By contributing to Netlify CMS, you agree that your contributions will be licensed By contributing to Netlify CMS, you agree that your contributions will be licensed