Skip to content
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
2 changes: 1 addition & 1 deletion src/pages/docs/reference/appendix.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: docs
order: 4
order: 5
tocHeading: 2
---

Expand Down
43 changes: 43 additions & 0 deletions src/pages/docs/reference/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
layout: docs
title: CLI
label: CLI
order: 3
tocHeading: 2
---

# CLI

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.

## Commands

You can see all available commands by passing the `--help` flag to the CLI entrypoint:

```shell
$ ./node_modules/.bin/greenwood --help
-------------------------------------------------------
Welcome to Greenwood (v0.33.0) ♻️
-------------------------------------------------------

Usage: greenwood <command>

Options:
-h, --help Show help information
-V, --version Show version number

Commands:
build Generate a production build.
develop Start a local development server.
serve Start a production server.
```

## Usage

For programmatic usage, you can import the CLI and call the `run` function with either the **build**, **develop**, or **serve** commands.

```js
import { run } from "@greenwood/cli/src/index.js";

run("build");
```
1 change: 1 addition & 0 deletions src/pages/docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ The content is broken down across these sections:

- [Configuration](/docs/reference/configuration/) - All of Greenwood's configuration options
- [Plugins API](/docs/reference/plugins-api/) - Learn how to create your own plugins
- [CLI](/docs/reference/cli/) - Interacting with the Greenwood CLI programmatically
- [Rendering Strategies](/docs/reference/rendering-strategies/) - Techniques and tips for various rendering options like CSR, SSR, and prerendering
- [Appendix](/docs/reference/appendix/) - Supplemental topics like Greenwood's build output, internal build state, and DOM emulation handling
2 changes: 1 addition & 1 deletion src/pages/docs/reference/rendering-strategies.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: docs
order: 3
order: 4
tocHeading: 2
---

Expand Down