Skip to content

v0.31.0-alpha.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@thescientist13 thescientist13 released this 14 Dec 19:31
· 29 commits to master since this release

Overview

This second pre-release in the v0.31.0 line wraps up the first half of the work done in our previous alpha release of overhauling how Greenwood generates import maps and resolves node_modules dependencies, to better support the entire NodeJS exports map spec as well as play nicer with a variety of package managers (like PNPM) and their various location strategies of where node_modules are installed on disk. We also shipped a couple of bug fixes.

You can peek this repo to see using PNPM in a Greenwood project, with links to other branches with demos for Shoelace, Spectrum Web Components, and the USWDS!

You can find the top-level tracking issue for this release here and if you have any questions, please feel free to reach out in Discord in the Greenwood #general channel.

To test the alpha, either manually bump all the versions in your package.json or you can use your package manager to upgrade each of your Greenwood dependencies to the alpha line (either way, all Greenwood dependencies need to be one the same version).

# npm
$ npm i @greenwood/cli@alpha

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

# pnpm
$ pnpm i @greenwood/cli@alpha

Changelog

https://github.com/ProjectEvergreen/greenwood/issues?q=label%3Av0.31.0+label%3Aalpha.1

  1. leverage import.meta.resolve to support import maps generation and accurate node_modules resolution when building
  2. Improve PNPM support
  3. bare CSS @import specifiers are not resolving and bundling correctly
  4. better document and clarify Lit SSR plugin usage caveats
  5. frontmatter imports not working for any format supported by a resource plugin
  6. ESM only configuration for PostCSS plugin

Breaking Changes

Node Modules

Going forward, the recommended pattern for referencing assets from your node_modules folder (that are not bare module ESM specifiers) will be to start all paths with /node_modules/. This will ensure Greenwood knows to use import.meta.resolve to find and lookup your dependency where ever it is installed based on your package managers.

Examples

@import "/node_modules/font-awesome/css/font-awesome.css";
@import "/node_modules/bootstrap/dist/css/bootstrap.css";
<script type="module" src="/node_modules/@shoelace-style/shoelace/dist/shoelace.js"></script>

PostCSS Plugin

Greenwood know supports only needing to have one PostCSS config for your project. So with this release, you can now

  1. Rename postcss.config.mjs -> postcss.config.js
  2. Delete postcss.config.cjs

If you're using Storybook, rename your postcss.config.cjs -> .postcssrc.js instead

Known Issues

  1. Discord link in init scaffolding output is using an expired link
  2. ESM-only PostCSS config seems to not play well with Storybook - ProjectEvergreen/www.greenwoodjs.dev#145
  3. The Lit SSR plugin is currently outputting some console.log messages, but that will be cleared up as part of

Diff

v0.31.0-alpha.0...v0.31.0-alpha.1