Skip to content

Commit 04f9590

Browse files
docs: #227 add CLI reference documentation page (#238)
1 parent 79a1ead commit 04f9590

4 files changed

Lines changed: 46 additions & 2 deletions

File tree

src/pages/docs/reference/appendix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: docs
3-
order: 4
3+
order: 5
44
tocHeading: 2
55
---
66

src/pages/docs/reference/cli.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
layout: docs
3+
title: CLI
4+
label: CLI
5+
order: 3
6+
tocHeading: 2
7+
---
8+
9+
# CLI
10+
11+
Although the most common way to interact with Greenwood is through [npm scripts in your _package.json_](/docs/introduction/setup/#commands), it is also possible to interact with the CLI programmatically in JavaScript.
12+
13+
## Commands
14+
15+
You can see all available commands by passing the `--help` flag to the CLI entrypoint:
16+
17+
```shell
18+
$ ./node_modules/.bin/greenwood --help
19+
-------------------------------------------------------
20+
Welcome to Greenwood (v0.33.0) ♻️
21+
-------------------------------------------------------
22+
23+
Usage: greenwood <command>
24+
25+
Options:
26+
-h, --help Show help information
27+
-V, --version Show version number
28+
29+
Commands:
30+
build Generate a production build.
31+
develop Start a local development server.
32+
serve Start a production server.
33+
```
34+
35+
## Usage
36+
37+
For programmatic usage, you can import the CLI and call the `run` function with either the **build**, **develop**, or **serve** commands.
38+
39+
```js
40+
import { run } from "@greenwood/cli/src/index.js";
41+
42+
run("build");
43+
```

src/pages/docs/reference/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ The content is broken down across these sections:
1111

1212
- [Configuration](/docs/reference/configuration/) - All of Greenwood's configuration options
1313
- [Plugins API](/docs/reference/plugins-api/) - Learn how to create your own plugins
14+
- [CLI](/docs/reference/cli/) - Interacting with the Greenwood CLI programmatically
1415
- [Rendering Strategies](/docs/reference/rendering-strategies/) - Techniques and tips for various rendering options like CSR, SSR, and prerendering
1516
- [Appendix](/docs/reference/appendix/) - Supplemental topics like Greenwood's build output, internal build state, and DOM emulation handling

src/pages/docs/reference/rendering-strategies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: docs
3-
order: 3
3+
order: 4
44
tocHeading: 2
55
---
66

0 commit comments

Comments
 (0)