diff --git a/src/pages/docs/reference/appendix.md b/src/pages/docs/reference/appendix.md index 9f326bab..2b6f72e3 100644 --- a/src/pages/docs/reference/appendix.md +++ b/src/pages/docs/reference/appendix.md @@ -1,6 +1,6 @@ --- layout: docs -order: 4 +order: 5 tocHeading: 2 --- diff --git a/src/pages/docs/reference/cli.md b/src/pages/docs/reference/cli.md new file mode 100644 index 00000000..8b6431da --- /dev/null +++ b/src/pages/docs/reference/cli.md @@ -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 + +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"); +``` diff --git a/src/pages/docs/reference/index.md b/src/pages/docs/reference/index.md index bafff109..d0b48896 100644 --- a/src/pages/docs/reference/index.md +++ b/src/pages/docs/reference/index.md @@ -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 diff --git a/src/pages/docs/reference/rendering-strategies.md b/src/pages/docs/reference/rendering-strategies.md index 54fb8803..b223fc07 100644 --- a/src/pages/docs/reference/rendering-strategies.md +++ b/src/pages/docs/reference/rendering-strategies.md @@ -1,6 +1,6 @@ --- layout: docs -order: 3 +order: 4 tocHeading: 2 ---