Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the storybook version base #133

Open
emexal-company opened this issue Jun 29, 2022 · 2 comments
Open

Update the storybook version base #133

emexal-company opened this issue Jun 29, 2022 · 2 comments

Comments

@emexal-company
Copy link

Are there any plans to upgrade to storybook 6.5.9 ? I'm facing a bug, that is fixed on the 6.5.9.
The bug is the following 👍

export default {
  title: 'Example/Button',
  argTypes: {
    label: {type: 'string'},
    value: {type: 'number'},
  }
}

const Template: Story<Partial<ButtonProps>> = (args) => {
  const [args, updateArgs] = useArgs();
  const newargs = Object.assign({}, args, {
    onClick: () => {
      updateArgs({label: 'gooooooooooooogle', value: 10});
    },
  });

After clicking the button, the "title" is updated in the ArgsTable, but the "value" is not. The issue seems to be related to the argtype 'number'.

@emexal-company
Copy link
Author

The issue was fixed in this PR.

@emexal-company
Copy link
Author

I tried to upgrade myself. What I did so far is:

  1. In package.json
{
    "scripts": {
       // Added this script
        "postinstall": "patch-package"
    },
    "devDependencies": {
         // Upgraded storybook to 6.5.9
         "@storybook/addon-docs": "6.5.9",
         "@storybook/addon-essentials": "6.5.9",
         "@storybook/addons": "6.5.9",
         "@storybook/api": "6.5.9",
         "@storybook/preact": "6.5.9",
         "@storybook/theming": "6.5.9",
         "@storybook/web-components": "6.5.9",
         // Added this package
         "patch-package": "^6.4.7"
     },
     "overrides": {
        /* Override Acorn, the new storybook is compiled in Ecma 2020, 
        and the plugin rollup-plugin-node-globals is using a too old version of acorn */
         "acorn": "8.7.1"
      }
}
  1. Added a patch file for rollup-plugin-node-globals in order to upgrade the ECMA version that acorn will parse
diff --git a/node_modules/rollup-plugin-node-globals/dist/rollup-plugin-node-globals.cjs.js b/node_modules/rollup-plugin-node-globals/dist/rollup-plugin-node-globals.cjs.js
index 2a94535..2390f1a 100644
--- a/node_modules/rollup-plugin-node-globals/dist/rollup-plugin-node-globals.cjs.js
+++ b/node_modules/rollup-plugin-node-globals/dist/rollup-plugin-node-globals.cjs.js
@@ -72,7 +72,7 @@ function inject (code, id, mod1, mod2, sourceMap) {
 
   try {
     ast = acorn.parse(code, {
-      ecmaVersion: 9,
+      ecmaVersion: 'latest',
       sourceType: 'module'
     });
   } catch (err) {

The result is that the build now is succeeding, but the prebuilt version fails to start.
Can anyone help to analyse the situation ? If we understand what is happening, then I might take some time to find a solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant