Skip to content

Document npm run build step #984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion contributing/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@ This site is powered by Node.js! :sparkles: :turtle: :rocket: :sparkles:

It runs on macOS, Windows, and Linux environments.

You'll need Node.js version 12 or 14 to run the site. To install Node.js, [download the "LTS" installer from nodejs.org](https://nodejs.org). If you're using [`nodenv`](https://github.com/nodenv/nodenv), read the [`nodenv` docs](#nodenv) for instructions on switching Node.js versions.
You'll need Node.js version 12 or 14 to run the site. To install Node.js, [download the "LTS" installer from nodejs.org](https://nodejs.org). If you're using [`nodenv`](https://github.com/nodenv/nodenv), read the [`nodenv` docs](#nodenv) for instructions on switching Node.js versions.

Once you've installed Node.js (which includes the popular `npm` package manager), open Terminal and run the following:

```sh
git clone https://github.com/github/docs
cd docs
npm install
npm run build
npm start
```

You should now have a running server! Visit [localhost:4000](http://localhost:4000) in your browser. It will automatically restart as you make changes to site content.

When you're ready to stop your local server, type <kbd>CTRL</kbd><kbd>c</kbd> in your terminal window.

Note that `npm run build` is a one-time step that create static assets.

## Site structure

This site was originally a Ruby on Rails web application. Some time later it was converted into a static site powered by [Jekyll](https://jekyllrb.com/). A few years after that it was migrated to [Nanoc](https://nanoc.ws/), another Ruby static site generator.
Expand Down
13 changes: 10 additions & 3 deletions contributing/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Troubleshooting status checks <!-- omit in toc -->
# Troubleshooting <!-- omit in toc -->

- [Troubleshooting server tests that fail locally but pass in CI](#troublshooting-server-tests-that-fail-locally-but-pass-in-ci)
- [Troubleshooting stalled deployments and CI](#troubleshooting-stalled-deployments-and-ci)
- [Staging deployment stalled](#staging-deployment-stalled)
- [CI stalled or stuck](#ci-stalled-or-stuck)
Expand All @@ -11,7 +12,13 @@
- [Check external links](#check-external-links)
- [Debugging locally](#debugging-locally)

## Troubleshooting stalled deployments and CI
## Troubleshooting

### Troubleshooting server tests that fail locally but pass in CI

If you run the tests locally and get failures in `tests/rendering/server.js` around static assets, stylesheets, and/or the client-side JavaScript bundle, but **the same tests pass in CI** on a PR, you likely need to run `npm run build`. This is a one-time command that creates static assets locally.

See [`development.md`](./development.md) for more info.

### Staging deployment stalled
If a staging deployment is pending for more than 5-10min, try the following:
Expand Down Expand Up @@ -107,4 +114,4 @@ During development, you can visit any page on `http://localhost:4000` and add `?
| `permalinks` | Shows all [permalinks](contributing/permalinks.md) that the site is generating for the page.
| `redirect_from` | Shows the hardcoded redirects in the [`redirect_from` frontmatter](content#redirect_from).
| `redirects` | Shows all redirects that the site is generating for the page.
| `includesPlatformSpecificContent` | Shows whether the site detects any [platform-specific content](#operating-system-tags) on the page.
| `includesPlatformSpecificContent` | Shows whether the site detects any [platform-specific content](#operating-system-tags) on the page.