v0.33.0
Overview
This release introduces an overhaul to the Greenwood init scaffolding experience, moves markdown out of the CLI and into its own standalone plugin, and includes a number of enhancements and bug fixes. The minimum NodeJS version was bumped to >= 22.18.0
# npm
$ npm i -D @greenwood/cli@latest
# Yarn 1.x (classic)
$ yarn upgrade @greenwood/cli@latest --dev
# pnpm
$ pnpm i -D @greenwood/cli@latestChangelog
https://github.com/ProjectEvergreen/greenwood/issues?q=label%3Av0.33.0
- adopt prompt based user experience for the
initexperience - expand package manager options for
initscaffolding - pre-clean all build output directories
- supported import map generation export condition matches are overwriting themselves
- SSR pages and layouts using custom HTML element with constructor props returns
undefinedfor compilation object - fix missing TS flag from Init scaffolding TS base template
- support bundling bare CSS
@importspecifiers - inconsistent HTML output merging hierarchy for top level pages and layouts
- fix init project scaffolding version being to set to current Greenwood version
- nested export conditions for import map generation not working (showing
[object Object]) - set init engines field in package.json to match CLI
- set minimum init TypeScript
targetcompiler setting in tsconfig.json - page contents overriding layouts content when no outlet tag is being used
- reconcile page level custom title and layout
<title>merging when using active content - pre-rendered SSR routes with a
<body>tag causing a build error - nested
typemodifier imports andverbatimModuleSyntaxcausing Greenwood to run incorrectly - upgrade to latest version of node-html-parser
- prefix NodeJS builtin module imports with
node: - incorrect type for Greenwood CLI
runfunction (will breaktsctype-checking) - update types for Resource plugin serve lifecycles)
- support TypeScript-based plugin configuration files
- add type checking script to init TypeScript template scaffolding
- add recommended lib compiler setting to init template TypeScript scaffolding
- shared CSS import attribute paths across layouts and SSR pages are linked as
/undefinedin production builds - remove default content (pages / layouts) from Greenwood
- eliminate unnecessary SSR page instantiation during graph lifecycle
- stabilize to a single minimum NodeJS LTS version for
engines(BREAKING) - refactor order of static and dynamic assets
- ensure comments in HTML get parsed
- remove errant console log
- ensure Greenwood CLI and plugins are favoring idiomatic usages of
async(thanks @KaiPrince 🙌 ) - bug(plugins): refactor CSS Modules plugin for better concurrency safety
- bug(cli): handle SSR double rendering when SSR page has a
<body>tag - bug(cli): safely copy files with their directories after concurrency refactor
- feat(plugins): #1247 standalone markdown plugin (BREAKING)
- enhancement(cli): issue 1390 deprecate
ejectcommand (BREAKING) - bug(adapters): issue 1462 fix nested routing for all adapter plugins
- enhancement(cli): issue 1552 replace
commanderwithutil.parseArgsin@greenwood/cli(thanks @shyok21 🙌 ) - bug(cli): #1247 remove old markdown references in config lifecycle
Breaking Changes
Minimum Node Version
The minimum version of NodeJS for Greenwood has been bumped to >=22.18.0
Markdown
Markdown support has been moved to a standalone plugin now, but the configuration is still the same. You'll now need to install @greenwood/plugin-markdown and add it to your Greenwood configuration file.
// before
export default {
// ...
markdown: {
plugins: [
"@mapbox/rehype-prism",
"remark-gfm",
],
},
};// after
import { greenwoodPluginMarkdown } from "@greenwood/plugin-markdown";
export default {
// ...
plugins: [
greenwoodPluginMarkdown({
plugins: [
"@mapbox/rehype-prism",
"remark-gfm",
],
}),
],
};Default Pages and Layouts
With this release, Greenwood removed its built-in default layouts and pages content, specifically:
- app.html
- page.html
- 404.html
If you find any unexpected missing content, you will likely need to provide your own content for these pages going forward. For reference, here were the default contents of these files for your reference
<!-- app.html -->
<!doctype html>
<html lang="en" prefix="og:http://ogp.me/ns#">
<head>
<title>My App</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>
<body>
<page-outlet></page-outlet>
</body>
</html><!-- page.html -->
<html>
<head>
<body>
<content-outlet></content-outlet>
</body>
</head>
</html><!-- 404.html -->
<!doctype html>
<html lang="en" prefix="og:http://ogp.me/ns#">
<head>
<title>Page Not Found</title>
<style>
h1 {
text-align: center;
}
</style>
</head>
<body>
<h1>Sorry, unfortunately the page could not be found.</h1>
</body>
</html>Layouts and Pages Merging
Prior to this release, there as a hard "stop" to which pages could "merge" into layouts. For example, this would work
src/
layouts/
page.html
pages/
index.mdHowever, none of these would merge
src/
layouts/
page.html
pages/
index.html
about.js
contact.tsWith this change, all page formats can now participate in the pages <> layout hierarchy merging, and while not a breaking change in terms of functionality, we are treating it more as a potential breaking change in terms of behavior / outcome based on your project, so cataloging it in this section to be safe.
As mentioned prior, a few small regressions were observed as called out in the Known Issues section below. This may require explicitly setting the layout property in your frontmatter as otherwise the default is that now everything will default to a page layout.
Constructor Props
The signature for constructor props has changed slightly, now allowing for access to the compilation object
// before compilation was undefined
constructor(request, compilation) {
// ...
}// after, we pass an object with access to both
constructor({ request, compilation }) {
//
}SSR Custom Imports
Based on a small refactor in this release of Greenwood, the document snippet for invoking the custom loaders hooks will need to change slightly to use bin.js
# before
$ node --import @greenwood/cli/register ./node_modules/@greenwood/cli/src/index.js <command># after
$ node --import @greenwood/cli/register ./node_modules/@greenwood/cli/src/bin.js <command>eject command
The eject has been officially removed in this release and there is no alternative. (this was soft deprecated during the documentation website refresh)
Known Issues
- max listener events warning
typeimports within the brackets breaks the build when importing Greenwood types