Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Migrate Storybook to 6.4.0 and enable auto-detection of controls (#5249
Browse files Browse the repository at this point in the history
…) (#5264)

* Migrate Storybook to 6.4.0 and enable auto-detection of controls (#5249)

Previously our Babel configuration conflicted with the one provided by
default by Storybook, making us unable to leverage the automatic
detection of properties from both JS and TS components to create
controls (formerly known as knobs).

Upgrading to 6.4.0 fixes a bug that makes it easier to work with
Babel configurations. Also done here:

* Removed a few deprecated addons in favor of the replacement ones
bundled within Storybook Essentials.
* Add auto-detection of certain control types depending on the property names
* Add support for TS stories

More context: storybookjs/storybook#12292

* Use `react-docgen` only in development environments

This should reduce production bundle size dramatically. The only
problem here is that Storybook runs its `build` command with the
`NODE_ENV` set to `production`. For this reason, we change the
script to provide `BABEL_ENV` set to `development` to still make sure
the correct configuration is loaded, while trying to reduce any
side-effects on changing the whole `NODE_ENV`.
  • Loading branch information
sunyatasattva authored Dec 1, 2021
1 parent f2f4c56 commit 08d4575
Show file tree
Hide file tree
Showing 5 changed files with 2,017 additions and 1,629 deletions.
11 changes: 11 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
module.exports = {
env: {
development: {
plugins: [
[
'react-docgen',
{ DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES' },
],
[ '@babel/plugin-syntax-jsx' ],
],
},
},
presets: [
[
'@wordpress/babel-preset-default',
Expand Down
Loading

0 comments on commit 08d4575

Please sign in to comment.