Skip to content

v0.33.0

Choose a tag to compare

@thescientist13 thescientist13 released this 14 Sep 00:33
· 88 commits to master since this release

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@latest

Changelog

https://github.com/ProjectEvergreen/greenwood/issues?q=label%3Av0.33.0

  1. adopt prompt based user experience for the init experience
  2. expand package manager options for init scaffolding
  3. pre-clean all build output directories
  4. supported import map generation export condition matches are overwriting themselves
  5. SSR pages and layouts using custom HTML element with constructor props returns undefined for compilation object
  6. fix missing TS flag from Init scaffolding TS base template
  7. support bundling bare CSS @import specifiers
  8. inconsistent HTML output merging hierarchy for top level pages and layouts
  9. fix init project scaffolding version being to set to current Greenwood version
  10. nested export conditions for import map generation not working (showing [object Object])
  11. set init engines field in package.json to match CLI
  12. set minimum init TypeScript target compiler setting in tsconfig.json
  13. page contents overriding layouts content when no outlet tag is being used
  14. reconcile page level custom title and layout <title> merging when using active content
  15. pre-rendered SSR routes with a <body> tag causing a build error
  16. nested type modifier imports and verbatimModuleSyntax causing Greenwood to run incorrectly
  17. upgrade to latest version of node-html-parser
  18. prefix NodeJS builtin module imports with node:
  19. incorrect type for Greenwood CLI run function (will break tsc type-checking)
  20. update types for Resource plugin serve lifecycles)
  21. support TypeScript-based plugin configuration files
  22. add type checking script to init TypeScript template scaffolding
  23. add recommended lib compiler setting to init template TypeScript scaffolding
  24. shared CSS import attribute paths across layouts and SSR pages are linked as /undefined in production builds
  25. remove default content (pages / layouts) from Greenwood
  26. eliminate unnecessary SSR page instantiation during graph lifecycle
  27. stabilize to a single minimum NodeJS LTS version for engines (BREAKING)
  28. refactor order of static and dynamic assets
  29. ensure comments in HTML get parsed
  30. remove errant console log
  31. ensure Greenwood CLI and plugins are favoring idiomatic usages of async (thanks @KaiPrince 🙌 )
  32. bug(plugins): refactor CSS Modules plugin for better concurrency safety
  33. bug(cli): handle SSR double rendering when SSR page has a <body> tag
  34. bug(cli): safely copy files with their directories after concurrency refactor
  35. feat(plugins): #1247 standalone markdown plugin (BREAKING)
  36. enhancement(cli): issue 1390 deprecate eject command (BREAKING)
  37. bug(adapters): issue 1462 fix nested routing for all adapter plugins
  38. enhancement(cli): issue 1552 replace commander with util.parseArgs in @greenwood/cli (thanks @shyok21 🙌 )
  39. 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.md

However, none of these would merge

src/
  layouts/
    page.html
  pages/
    index.html
    about.js
    contact.ts

With 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

  1. max listener events warning
  2. type imports within the brackets breaks the build when importing Greenwood types

Diff

v0.32.0...v0.33.0