Setup
Greenwood has a few options for getting a new project started. You can also check out our Getting Started guide for a full walk-through of creating a simple blog site with Greenwood.
Init
The recommended way to start a new Greenwood project, our init CLI will scaffold out a starter project for you. Just run a single command and then follow the prompts. Make sure you have the latest LTS version of Node installed.
To scaffold into the current directory, run:
npx @greenwood/init@latest
To scaffold into a custom directory, run:
# initialize a new directory called my-app for your Greenwood project
$ npx @greenwood/init@latest my-app
Install
You can install the Greenwood CLI manually through your preferred package manager:
npm i -D @greenwood/cli@latest
yarn add @greenwood/cli@latest --save-dev
pnpm add -D @greenwood/cli@latest
Commands
The CLI supports three commands, that can be easily mapped to npm scripts in your package.json. You'll also want to make sure you've set the type
field to module:
- develop - Start Greenwood's local development server
- build - Build a Greenwood project for production
- serve - Start a production server for self-hosting a Greenwood build
{
"type": "module",
"scripts": {
"dev": "greenwood develop",
"build": "greenwood build",
"serve": "greenwood serve"
}
}