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

Addon-docs: Component parameter codemod #7155

Merged
merged 2 commits into from Jun 22, 2019
Merged

Conversation

shilman
Copy link
Member

@shilman shilman commented Jun 20, 2019

Issue: #7101

What I did

Storybook docs DocsPage requires that a user specify the target component as a parameter. This codemod tries to automatically add it to your storiesOf stories.

storiesOf('path/to/MyComponent', module).add(....)

=>

storiesOf('path/to/MyComponent', module)
  .addParameters({ component: MyComponent })
  .add(....)

How to test

yarn test --core

Also you can see the results of running this on the storybook codebase in the second commit.

@vercel
Copy link

vercel bot commented Jun 20, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://monorepo-git-7101-component-param-codemod.storybook.now.sh

@shilman shilman mentioned this pull request Jun 20, 2019
21 tasks
Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

);

function getLeafName(string) {
const parts = string.split(/\/|\.|\|/);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if they use a different path separator? Are the SOL?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Any suggestions here?

@shilman shilman merged commit 4265565 into next Jun 22, 2019
@shilman shilman deleted the 7101-component-param-codemod branch June 22, 2019 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants