Skip to content

v0.32.0-alpha.0

Pre-release
Pre-release

Choose a tag to compare

@thescientist13 thescientist13 released this 02 Mar 19:18
· 199 commits to master since this release

Overview

This first release in the v0.32.0 release line introduces types for Greenwood, an adapter plugin for AWS, and bumps the minimum required NodeJS 20.x version for stable JSON Import Attributes compatibility.

# npm
$ npm i -D @greenwood/cli@alpha

# Yarn 1.x (classic)
$ yarn upgrade @greenwood/cli@alpha --dev

# pnpm
$ pnpm i -D @greenwood/cli@alpha

Changelog

https://github.com/ProjectEvergreen/greenwood/issues?q=label%3Av0.32.0-alpha.0

  1. bump to minimum NodeJS 20.x version of 20.18.3
  2. allow greater than range for upper NodeJS minimum version in engines
  3. types support for public capabilities of Greenwood
  4. AWS Adapter plugin

Features (Early Access)

Docs are still in progress for types(script) and the AWS Adapter plugin, so please see the below references for now, and please feel free to ask in Discord if you have any questions / feedback if trying this stuff out early

Types

Greenwood now exports a number of types, which you can start using in JavaScript or TypeScript files right now, for example

// JSDoc
/** @type {import('@greenwood/cli').Config} */
// TypeScript
import type { Config } from '@greenwood/cli';

Note: Built-in TypeScript support will be coming in the next alpha, including deprecating the TypeScript plugin.

AWS Adapter

The current AWS Adapter plugin is designed to output predictable and consumable build output for your SSR pages and API routes, available at .aws-output, by simply adding the plugin to your Greenwood config

import { greenwoodPluginAdapterAws } from '@greenwood/plugin-adapter-aws';

export default {
  plugins: [
    greenwoodPluginAdapterAws()
  ]
}

You can see a couple integration examples here:

Check out this discussion around potential "presets" for this plugin.

Breaking Changes

Minimum NodeJS Version

The minimum NodeJS version on the 20.x line has been bumped to 20.18.3 which formally marks JSON Import Attributes as stable, which will remove any warning messages when running Greenwood.

Though not a breaking change, the minimum 22.x version has now been changed to have an upper bound using >= instead of ^

# before
^22.12.0

# after
>=22.12.0

Resource and Server Interface

With the introduction of types in Greenwood, the previously documented usage for creating Resource and Server plugins referenced an interface file, which was just a class to extend from, and wasn't really much of an interface at all.

In addition, you'll no longer need to do the super() call, and you'll want compilation and any options to be instance members of your own class.

For example, before you might have had:

import { ResourceInterface } from "@greenwood/cli/src/lib/resource-interface.js";

class ExampleResource extends ResourceInterface {
  constructor(compilation, options) {
    super(compilation, options);
    // ...
  }

  // ...
}

Now, you can use JSDoc based type imports and instance properties

/** @type {import('@greenwood/cli').Resource} */
class ExampleResource {
  constructor(compilation, options) {
    this.compilation = compilation;
    this.options = options;
    // ...
  }

  // ...
}

Exports Map / Module field

Though not likely a breaking change to anyone using Greenwood, as an internal change, Greenwood removed the non-standard module field from all package.json files and converted entirely to use the exports field.

// before
{
  "main": "./src/index.js",
  "module": "./src/index.js",
},
// after
{
  "main": "./src/index.js",
  "exports": {
    ".": {
      "types": "./src/types/index.d.ts",
      "import": "./src/index.js"
    }
  }
}

Known Issues

N / A

Diff

v0.31.1...v0.32.0-alpha.0