Add instructions on how to add nextjs.org/docs/messages urls (#26865)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Tim Neutkens 2021-07-02 13:39:00 +02:00 committed by GitHub
parent 277061943a
commit 59c742ee7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 1 deletions

View file

@ -8,6 +8,7 @@ Choose the right checklist for the change that you're making:
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
@ -16,6 +17,7 @@ Choose the right checklist for the change that you're making:
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`
## Documentation / Examples

View file

@ -14,6 +14,20 @@ Read about our [Commitment to Open Source](https://vercel.com/oss).
To contribute to [our examples](examples), take a look at the [“Adding examples” section](#adding-examples).
## Adding warning/error descriptions
In Next.js we have a system to add helpful links to warnings and errors.
This allows for the logged message to be short while giving a broader description and instructions on how to solve the warning/error.
In general all warnings and errors added should have these links attached.
Below are the steps to add a new link:
- Create a new markdown file under the `errors` directory based on `errors/template.md`: `cp errors/template.md errors/<error-file-name>.md`
- Add the newly added file to `errors/manifest.json`
- Add the following url to your warning/error: `https://nextjs.org/docs/messages/<file-path-without-dotmd>`. For example to link to `errors/api-routes-static-export.md` you use the url: `https://nextjs.org/docs/messages/api-routes-static-export`
## To run tests
Make sure you have `chromedriver` installed for your Chrome version. You can install it with
@ -158,4 +172,4 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut
## Publishing
Repo maintainers can use `yarn publish-canary` to publish a new version of all packages to npm.
Repository maintainers can use `yarn publish-canary` to publish a new version of all packages to npm.

13
errors/template.md Normal file
View file

@ -0,0 +1,13 @@
# <!-- INSERT TITLE HERE -->
#### Why This Error Occurred
<!-- Explain why the error occured. Ensure the description makes it clear why the warning/error exists -->
#### Possible Ways to Fix It
<!-- Explain how to fix the warning/error, potentially by providing alternative approaches. Ensure this section is actionable by users -->
### Useful Links
<!-- Add links to relevant documentation -->