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 CRA TypeScript support for .storybook folder #4902

Merged
merged 2 commits into from
Dec 3, 2018
Merged

Add CRA TypeScript support for .storybook folder #4902

merged 2 commits into from
Dec 3, 2018

Conversation

mrmckeb
Copy link
Member

@mrmckeb mrmckeb commented Dec 2, 2018

Issue: #4587 (comment)

What I did

Allowed the use of .ts and .tsx files in the .storybook folder. This was not in scope initially, but was added on request.

How to test

When using with CRA and TypeScript, rename your config.js to config.tsx in the .storybook folder.

@mrmckeb
Copy link
Member Author

mrmckeb commented Dec 2, 2018

@igor I found a strange issue, unrelated, where this config is loaded twice - you can see that it's happening because it logs the action twice in the terminal.
image

I've safeguarded against this for now, but we should look to resolve it - unfortunately I don't have time this weekend. I'll create an issue for it.

app/react/src/server/cra-config.js Outdated Show resolved Hide resolved
@igor-dv
Copy link
Member

igor-dv commented Dec 2, 2018

I found a strange issue, unrelated, where this config is loaded twice

Yeah, it is a "known" thing. We apply presets on defaultConfig and baseConfigbecause we don't know what user will choose. The fix could be only to have a defaultConfig, but for now it's a breaking change and should be discussed...

@codecov
Copy link

codecov bot commented Dec 2, 2018

Codecov Report

Merging #4902 into next will increase coverage by 0.13%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #4902      +/-   ##
==========================================
+ Coverage   34.84%   34.98%   +0.13%     
==========================================
  Files         566      566              
  Lines        7005     7009       +4     
  Branches      937      938       +1     
==========================================
+ Hits         2441     2452      +11     
+ Misses       4064     4060       -4     
+ Partials      500      497       -3
Impacted Files Coverage Δ
app/react/src/server/framework-preset-cra.js 0% <0%> (ø) ⬆️
app/react/src/server/cra-config.js 47.05% <83.33%> (+19.39%) ⬆️

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 cede173...5273cb8. Read the comment docs.

@igor-dv igor-dv added feature request cra Prioritize create-react-app compatibility presets labels Dec 2, 2018
@mrmckeb
Copy link
Member Author

mrmckeb commented Dec 2, 2018

@igor-dv Thanks for the feedback. PR updated, and I also added tests.

Copy link
Member

@igor-dv igor-dv left a comment

Choose a reason for hiding this comment

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

LGTM 💪

@igor-dv igor-dv merged commit be544bc into storybookjs:next Dec 3, 2018
@mrmckeb mrmckeb deleted the feature/storybook-folder-ts-support branch December 3, 2018 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cra Prioritize create-react-app compatibility feature request presets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants