Skip to content

Commit

Permalink
Add instructions on how to add nextjs.org/docs/messages urls (#26865)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
timneutkens and kodiakhq[bot] authored Jul 2, 2021
1 parent 2770619 commit 59c742e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
16 changes: 15 additions & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 changes: 13 additions & 0 deletions errors/template.md
Original file line number Diff line number Diff line change
@@ -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 -->

0 comments on commit 59c742e

Please sign in to comment.