Skip to content

Commit f33c595

Browse files
authored
chore: add autogenerated docs for serve command (#5402)
1 parent 6d6531a commit f33c595

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,27 @@ output.
131131
DEBUG_TESTS=true npm exec vitest -- run tests/unit/tests/unit/lib/account.test.mjs -t 'test name'
132132
```
133133

134+
### Command docs
135+
136+
137+
If you're adding a new command, make sure to also add docs for it by creating a new `[commandname].md` file to the `docs` folder and adding the following information:
138+
139+
```md
140+
---
141+
title: Netlify CLI [command name] command
142+
description: A description.
143+
---
144+
145+
# `command name`
146+
147+
<!-- AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) -->
148+
149+
<!-- AUTO-GENERATED-CONTENT:END -->
150+
151+
```
152+
153+
Then autogenerate the docs by running `npm run docs`.
154+
134155
### Lint docs per Netlify style guide
135156

136157
1. [Install vale](https://docs.errata.ai/vale/install)

docs/commands/serve.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Netlify CLI serve command
3+
description: (Beta) Build the site for production and serve locally. This does not watch the code for changes, so if you need to rebuild your site then you must exit and run `serve` again.
4+
---
5+
6+
# `serve`
7+
8+
<!-- AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) -->
9+
(Beta) Build the site for production and serve locally. This does not watch the code for changes, so if you need to rebuild your site then you must exit and run `serve` again.
10+
11+
**Usage**
12+
13+
```bash
14+
netlify serve
15+
```
16+
17+
**Flags**
18+
19+
- `context` (*string*) - Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")
20+
- `country` (*string*) - Two-letter country code (https://ntl.fyi/country-codes) to use as mock geolocation (enables --geo=mock automatically)
21+
- `dir` (*string*) - dir with static files
22+
- `functions` (*string*) - specify a functions folder to serve
23+
- `functions-port` (*string*) - port of functions server
24+
- `geo` (*cache | mock | update*) - force geolocation data to be updated, use cached data from the last 24h if found, or use a mock location
25+
- `offline` (*boolean*) - disables any features that require network access
26+
- `debug` (*boolean*) - Print debugging information
27+
- `http-proxy` (*string*) - Proxy server address to route requests through.
28+
- `http-proxy-certificate-filename` (*string*) - Certificate file to use when connecting using a proxy server
29+
- `port` (*string*) - port of netlify dev
30+
31+
**Examples**
32+
33+
```bash
34+
netlify serve
35+
BROWSER=none netlify serve # disable browser auto opening
36+
```
37+
38+
39+
<!-- AUTO-GENERATED-CONTENT:END -->

src/commands/serve/index.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { createServeCommand } from './serve.mjs'

0 commit comments

Comments
 (0)