v0.32.0-alpha.0
Pre-releaseOverview
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@alphaChangelog
https://github.com/ProjectEvergreen/greenwood/issues?q=label%3Av0.32.0-alpha.0
- bump to minimum NodeJS
20.xversion of20.18.3 - allow greater than range for upper NodeJS minimum version in engines
- types support for public capabilities of Greenwood
- 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:
- SST - ProjectEvergreen/greenwood-demo-adapter-aws#5
- Architect - ProjectEvergreen/greenwood-demo-adapter-aws#8
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