Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs/document new minimum NodeJS LTS version requirements #159

Merged
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/introduction/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Greenwood has a few options for getting a new project started. You can also chec

## 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.
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](https://nodejs.org/en/download) installed.

To scaffold into the _current_ directory, run:

Expand Down
30 changes: 24 additions & 6 deletions src/pages/docs/pages/server-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,24 +302,42 @@ For request handling, Greenwood will pass a native `Request` object and a Greenw

## Custom Imports

To use custom imports on the server side for prerendering or SSR use cases (ex. CSS, JSON), you will need to invoke Greenwood using **NodeJS** from the CLI and pass it the `--loaders` flag along with the path to Greenwood's provided loader function.
To use custom imports (non JavaScript resources) on the server side for prerendering or SSR use cases, you will need to invoke Greenwood using **NodeJS** from the CLI and pass the `--imports` flag along with the path to Greenwood's provided register function. _**This feature requires NodeJS version `>=21.10.0`**_.

This comment was marked as resolved.


<!-- prettier-ignore-start -->
<app-ctc-block variant="shell" paste-contents="node --loader ./node_modules/@greenwood/cli/src/loader.js ./node_modules/@greenwood/cli/src/index.js <command>">

<app-ctc-block variant="shell" paste-contents="node --import @greenwood/cli/register ./node_modules/@greenwood/cli/src/index.js <command>">

```shell
$ node --loader ./node_modules/@greenwood/cli/src/loader.js ./node_modules/@greenwood/cli/src/index.js <command>
$ node --import @greenwood/cli/register ./node_modules/@greenwood/cli/src/index.js <command>
```

</app-ctc-block>

<!-- prettier-ignore-end -->

Then you will be able to run this, or for any custom format you want using a plugin.
Or most commonly as an npm script in your _package.json_

<!-- prettier-ignore-start -->

<app-ctc-block variant="snippet" heading="package.json">

```json
{
"scripts": {
"build": "node --import @greenwood/cli/register ./node_modules/@greenwood/cli/src/index.js build"
}
}
```

</app-ctc-block>

<!-- prettier-ignore-end -->

Now any custom resource plugins will operate on the server side, enabling compatibility with non-JavaScript resources not supported by NodeJS, like CSS Module Scripts.

```js
import sheet from "./styles.css" with { type: "css" };
import data from "./data.json" with { type: "json" };

console.log({ sheet, data });
console.log({ sheet });
```
9 changes: 3 additions & 6 deletions src/pages/guides/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@ This _Getting Started_ guide will walk you through creating a basic static conte

You will need the following installed on your machine:

1. [**NodeJS LTS**](https://nodejs.org/en/download/package-manager) (required) - We recommend using a Node version manager (like NVM) to install the latest stable version of Node
1. [**NodeJS LTS**](https://nodejs.org/en/download) (required) - We recommend using a Node version manager (like NVM) to install the latest stable version of Node
1. [**Git**](https://git-scm.com/) (optional) - Can be useful for [cloning and inspecting](https://github.com/ProjectEvergreen/greenwood-getting-started) the companion repo for this guide, or otherwise managing your Greenwood project through version control

You can verify that both NodeJS and NPM are installed correctly by checking their version from the command line:
You can verify that NodeJS has been installed correctly by checking its version from the command line:

```bash
$ node -v
v18.12.1

$ npm -v
8.19.2
v22.13.0
```

## Setup
Expand Down
9 changes: 5 additions & 4 deletions src/pages/guides/hosting/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ If you're using GitHub, you can use GitHub Actions to automate the pushing of bu
1. At the root of your repo add a GitHub Action called _.github/workflows/publish.yml_ and adapt as needed for your own branch, build commands, and package manager.

<!-- prettier-ignore-start -->

<app-ctc-block variant="snippet" heading=".github/workflows/publish.yml">

```yml
Expand All @@ -79,14 +80,14 @@ If you're using GitHub, you can use GitHub Actions to automate the pushing of bu

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

# match to your version of NodeJS
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.20.2
node-version: 22

- name: Install Dependencies
run: |
Expand Down
8 changes: 4 additions & 4 deletions src/pages/guides/hosting/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ Following the steps [outlined here](https://pages.github.com/), first make sure

jobs:
build-and-deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

# match to your version of NodeJS
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.20.2
node-version: 22

# or replace with yarn, pnpm, etc
- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/pages/guides/hosting/netlify.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For static hosting, nothing is needed other than connecting your repository and
skip_processing = true

[build.environment]
NODE_VERSION = "18.x"
NODE_VERSION = "22.x"
```

</app-ctc-block>
Expand Down