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

Add codemod for deprecated addon-info API #1582

Merged
merged 7 commits into from
Aug 14, 2017

Conversation

trevoreyre
Copy link
Contributor

Issue:

What I did

Added a codemod to convert the outdated addWithInfo API from the addon-info package.

How to test

./node_modules/.bin/jscodeshift -t ./node_modules/@storybook/codemod/dist/transforms/update-addon-info.js . --ignore-pattern "node_modules|dist"

@trevoreyre
Copy link
Contributor Author

Note - This doesn't modify the setAddon(infoAddon) call made in the Storybook config file. I wasn't sure how to catch all possible permutations of setting up the addon in that file, and it's a pretty easy change to make manually.

@codecov
Copy link

codecov bot commented Aug 3, 2017

Codecov Report

Merging #1582 into master will decrease coverage by 0.56%.
The diff coverage is 13.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1582      +/-   ##
==========================================
- Coverage   21.38%   20.81%   -0.57%     
==========================================
  Files         244      247       +3     
  Lines        5410     5476      +66     
  Branches      671      667       -4     
==========================================
- Hits         1157     1140      -17     
- Misses       3746     3820      +74     
- Partials      507      516       +9
Impacted Files Coverage Δ
...es__/update-addon-info/update-addon-info.output.js 0% <0%> (ø)
lib/codemod/src/index.js 0% <0%> (ø) ⬆️
...res__/update-addon-info/update-addon-info.input.js 0% <0%> (ø)
lib/codemod/src/transforms/update-addon-info.js 53.65% <53.65%> (ø)
lib/ui/src/modules/api/actions/api.js 49.42% <0%> (-1.06%) ⬇️
...rc/modules/ui/components/left_panel/text_filter.js 33.33% <0%> (-0.92%) ⬇️
lib/ui/src/modules/ui/containers/left_panel.js 25% <0%> (-0.72%) ⬇️
...-native/src/preview/components/OnDeviceUI/index.js 0% <0%> (ø) ⬆️
addons/knobs/src/components/types/Select.js 7.81% <0%> (ø) ⬆️
lib/ui/src/modules/ui/components/menu_item.js 19.14% <0%> (ø) ⬆️
... and 38 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f552cac...c8faebe. Read the comment docs.

@trevoreyre
Copy link
Contributor Author

This doesn't include any tests yet, but they are coming. In the meantime, if anyone wants to try out the codemod or provide any feedback, that would be great!

@trevoreyre
Copy link
Contributor Author

This is ready for final review.

@ndelangen
Copy link
Member

Looks good to me! anyone else want to pitch in here? @storybooks/team

@usulpro
Copy link
Member

usulpro commented Aug 5, 2017

Maybe it's not related to this PR directly but I think we need to add some info about this codemod otherwise users will not know about its existence

@ndelangen
Copy link
Member

Yes @usulpro we do, Right now the "how to test" @trevoreyre wrote describe how to run codemods. And I think some codemod is also part of the CLI.

But it's definitely something we must improve!

@trevoreyre
Copy link
Contributor Author

@ndelangen @usulpro - I can add some info about the new codemod at lib/codemod/README.md. That should help. But I do think there should be a little more documentation about the existence of these codemods and how to find them somewhere else. Maybe in the main README? Or in the CHANGELOG? Or somewhere else on the docs site?

@danielduan
Copy link
Member

@trevoreyre I think it would be helpful to link it to the deprecation console message as well.

@usulpro
Copy link
Member

usulpro commented Aug 8, 2017

@ndelangen
Copy link
Member

I think for now it's fine to add it to the readme of the codemod package, if you could add it there, we can get this merged!

A mention about codemods and where to find info about them would be perfect in MIGRATION.md!

@trevoreyre
Copy link
Contributor Author

@ndelangen I added a couple examples in the codemod package's README.

@ndelangen ndelangen merged commit f3fa02f into storybookjs:master Aug 14, 2017
@ndelangen ndelangen changed the title Added codemod for deprecated addon-info API Add codemod for deprecated addon-info API Aug 14, 2017
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.

4 participants