@brightspot/styleguide
v5.0.0
Published
The Brightspot styleguide renders JSON fixtures through a theme's Handlebars templates, so you can preview markup without running the CMS. It provides a webpack dev server helper for local development and the `styleguide-bundle` command, which packages a
Readme
@brightspot/styleguide
The Brightspot styleguide renders JSON fixtures through a theme's Handlebars templates, so you can preview markup without running the CMS. It provides a webpack dev server helper for local development and the styleguide-bundle command, which packages a theme into a .zip.
Choosing a version
The 4.9.x and 5.x lines both include the dependency security fixes from the 4.9.0 release. They differ in the front-end toolchain they expect from your project.
| | 4.9.x | 5.x | |---|---|---| | Node.js | 22.12 or later | 26 or later | | webpack | 5 | 5.101 or later | | webpack-dev-server | 3 | 5 or 6 | | Changes to your project | None | Toolchain and dev server configuration |
- 4.9.x is a drop-in upgrade from 4.8.x. Change the version number in
package.jsonand reinstall; no configuration changes are needed. Choose it when you want the security fixes without touching your build. - 5.x targets the current toolchain: webpack-dev-server 5 or 6, Express 5, and current versions of every dependency. Choose it when you are ready to upgrade your project's own toolchain.
The styleguide-bundle command, its options, and the PROXY_TARGET proxy mode work the same in both lines.
Upgrading from 4.x to 5.x
- Use Node.js 26 or later. Update
.nvmrc, theenginesfield, and any Gradlenode.versionsetting together. - Upgrade
webpackto 5.101 or later,webpack-dev-serverto 5 or 6 (6 is recommended), andwebpack-clito 7. The styleguide declares webpack and webpack-dev-server as peer dependencies, so your project's versions are the ones that run. - Remove
before,overlay, andpublicPathfrom your owndevServerconfiguration. Thestyleguide.webpack()helper now setssetupMiddlewaresanddevMiddleware.publicPathinstead, and defaultsclient.overlayto compile errors only, asoverlay: truedid in webpack-dev-server 3. Move any custom middleware intosetupMiddlewares, and setclient.overlayyourself if you want a different overlay. - Remove
HotModuleReplacementPluginif you added it yourself. webpack-dev-server adds it whenhotis on, and the helper no longer adds it. - Add any package your project uses directly to its own
package.json. In 4.x, the styleguide installed the following packages as dependencies, so a project could use them without declaring them. 5.x no longer installs them:stylelint,stylelint-config-prettier,stylelint-config-recommended,stylelint-order,stylelint-prettier,archiver,node-fetch,messageformat,capital-case, andisbinaryfile.globandchalkare still installed, but at new major versions (14 and 6); declare your own versions if your scripts use the old APIs.stylelint-config-prettierhas no release for stylelint 15 or later, so remove it from your stylelint configuration when you upgrade stylelint.
The helper's signature is unchanged: styleguide.webpack(rootDir, webpack, config).
Recommended toolchain upgrades
The styleguide does not require these, but upgrading them alongside 5.x brings the rest of a project current. The default and light bundles in the Brightspot starter packs are a working reference for all of them.
- Babel 8. Requires Node.js
^22.18.0 || >=24.11.0. TheuseBuiltInsandcorejsoptions are gone from@babel/preset-env. Usebabel-plugin-polyfill-corejs3withmethod: "usage-global", and settargetsat the top level of the Babel options: the polyfill plugin ignores targets passed to the preset. Babel 8 ships class properties and dynamic import, so remove@babel/plugin-proposal-class-propertiesand@babel/plugin-syntax-dynamic-import. - ESLint 10. Only flat config is supported. Replace
.eslintrcwitheslint.config.mjsand use thetypescript-eslintpackage in place of@typescript-eslint/eslint-pluginand@typescript-eslint/parser. - Prettier 3. The default
trailingCommachanged toall. Set"trailingComma": "es5"to keep the previous formatting and avoid reformatting every file. - TypeScript 6. The current
typescript-eslintandfork-ts-checker-webpack-pluginversions rely on TypeScript's existing JavaScript compiler API. TypeScript 7 uses a different native API and is not a drop-in replacement for these tools. - Asset loaders. webpack 5 asset modules replace
file-loaderandurl-loader.
