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

csf-hoist-story-annotations does not migrate files #15442

Closed
nickofthyme opened this issue Jun 30, 2021 · 2 comments
Closed

csf-hoist-story-annotations does not migrate files #15442

nickofthyme opened this issue Jun 30, 2021 · 2 comments

Comments

@nickofthyme
Copy link

Describe the bug
Running the csf-hoist-story-annotations migration on tsx files leaves files with deprecated syntax unmodified

To Reproduce

System

Environment Info:

  System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Binaries:
    Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.10.0
  Browsers:
    Chrome: 91.0.4472.114
    Firefox: 86.0
    Safari: 14.1.1
  npmPackages:
    @storybook/addon-actions: ^5.3.19 => 5.3.21
    @storybook/addon-docs: ^5.3.19 => 5.3.21
    @storybook/addon-info: ^5.3.19 => 5.3.21
    @storybook/addon-knobs: ^5.3.19 => 5.3.21
    @storybook/addon-links: ^5.3.19 => 5.3.21
    @storybook/addon-storysource: ^5.3.19 => 5.3.21
    @storybook/preset-typescript: ^3.0.0 => 3.0.0
    @storybook/react: ^5.3.19 => 5.3.21
    @storybook/source-loader: ^5.3.19 => 5.3.21
    @storybook/theming: ^5.3.19 => 5.3.21

Additional context
This repo use yarn workspaces, could have an impact but unlikely.

@shilman
Copy link
Member

shilman commented Jun 30, 2021

This migration is looking for code of the following form in *.stories.tsx:

Example.story = {
  parameters: {
    options: { selectedPanel: SB_SOURCE_PANEL },
  },
};

The problem is that your *.stories.tsx look like this:

export { Example as basic } from './1_basic';
export { Example as withValueLabel } from './2_label_value';

And the pattern that the codemod is looking for is in files like 1_basic.tsx and 2_label_value.tsx.

If you're able to come up with a glob that matches those files, I'd expect it to work as advertised.

@nickofthyme
Copy link
Author

Ahh gotcha! Thanks for the quick look. I managed to use a regex replace in vscode to migrate the syntax.

Thanks for the help!

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

No branches or pull requests

2 participants