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

fix(storybook): support mdx #5456

Merged

Conversation

virtuoushub
Copy link
Collaborator

closes #5348

@netlify
Copy link

netlify bot commented May 6, 2022

Deploy Preview for redwoodjs-docs canceled.

Name Link
🔨 Latest commit 3303cfe
🔍 Latest deploy log https://app.netlify.com/sites/redwoodjs-docs/deploys/628cde0bdafdf200085b3cb4

@simoncrypta
Copy link
Collaborator

Hey Peter ! Is it ready for review ? I'm excited to try out 😄

@virtuoushub
Copy link
Collaborator Author

Hey Peter ! Is it ready for review ? I'm excited to try out 😄

👋🏻 hi @simoncrypta , yes it is ready. I was going to add an MDX file to our smoke test to verify; but please feel free to try it out if you are excited.

@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch 2 times, most recently from 6563f09 to 76706af Compare May 12, 2022 14:34
@virtuoushub
Copy link
Collaborator Author

@simoncrypta in order to get this to work it looks like we need to yarn add -D @storybook/addon-docs in web.

@shilman - any hint as to why even with @storybook/addon-essentials installed which includes @storybook/addon-docs according to the docs, we need to explicitly install @storybook/addon-docs to get this to work?

We are wiring it up here but we also do some stuff in there that may be affecting how Storybook expected to be configured.

(cc @jtoar)

@virtuoushub
Copy link
Collaborator Author

storybookjs/storybook#14429 looks related

@virtuoushub virtuoushub requested review from dac09 and Tobbe May 13, 2022 13:33
@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from 78064d2 to 4b7b67d Compare May 13, 2022 19:05
yarn.lock Outdated Show resolved Hide resolved
Copy link
Contributor

@dac09 dac09 left a comment

Choose a reason for hiding this comment

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

Looking good, but a couple of minor comments!

@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from 4b7b67d to 9eb9334 Compare May 19, 2022 16:41
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 20, 2022
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 20, 2022
@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from 9eb9334 to 32c358d Compare May 20, 2022 18:52
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 20, 2022
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 20, 2022
@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from 32c358d to 1a94637 Compare May 20, 2022 19:03
Copy link
Contributor

dac09 commented May 20, 2022

👍I think the duplication is okay really - unless you wanted to move the mdx into a string - but not sure how much cleaner that is!

I know it's weird about the codemod folder - but short of renaming applyCodemod to applyCodeshift - not sure what else we could do that's an improvement. Atleast this way we know all the code in this folder will change the project somehow.

I just fixed the rebuild fixture with Dom’s help a few PRs ago btw - so you can actually regenerate the fixture now with yarn build:test-project ``-``-rebuild-fixture

virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 20, 2022
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 20, 2022
@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from 1a94637 to dd4f8fc Compare May 20, 2022 21:13
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 21, 2022
@virtuoushub
Copy link
Collaborator Author

virtuoushub commented May 21, 2022

@dac09 - I know this is your favorite topic so please don't 🔫 the messenger, but it seems like we have some flakey CI/CD tests.

These failed due to timeout, when every other run passed -

It seems mostly unrelated to this PR, but if adding MDX to Storybook increases the load on CI/CD we might want to rethink adding it as a smoke test.

@dac09
Copy link
Contributor

dac09 commented May 22, 2022

Timeouts usually mean storybook hasn't started up correctly I'm afraid. The timeout happens because the tests are looking for the elements, but can't find it.

Also just noticed there aren't actually any smoke tests for mdx haha. Up to you if you want to add it - I really don't want to be master of smoke tests.

virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 22, 2022
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 22, 2022
@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from 2292b35 to 1459916 Compare May 22, 2022 23:01
@virtuoushub
Copy link
Collaborator Author

virtuoushub commented May 22, 2022

@jtoar this fix most likely warrants a codemod to install @storybook/addon-docs to web if it is not already installed. Thoughts? addon-docs is already added, no need to make a codemod

Copy link
Contributor

@dac09 dac09 left a comment

Choose a reason for hiding this comment

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

Everything looks LGTM! Awaiting confirmation on where @storybook/addon-docs goes.

I personally don't think we need to modify the template, because rwjs/testing (which now includes addon-docs) is already is a dependency - but will defer to someone else on this.

virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 23, 2022
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 23, 2022
@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from e463647 to 05d42fe Compare May 23, 2022 12:34
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 23, 2022
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 23, 2022
@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from 05d42fe to cba83d4 Compare May 23, 2022 15:26
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 23, 2022
virtuoushub added a commit to virtuoushub/redwood that referenced this pull request May 23, 2022
@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from cba83d4 to 19e8b7f Compare May 23, 2022 21:33
@virtuoushub virtuoushub force-pushed the fix/support-mdx-stories-in-storybook branch from ae2b6d3 to 3303cfe Compare May 24, 2022 13:30
@dac09 dac09 enabled auto-merge (squash) May 24, 2022 13:34
@dac09 dac09 merged commit 7560fc9 into redwoodjs:main May 24, 2022
@jtoar jtoar added this to the next-release milestone May 24, 2022
@virtuoushub virtuoushub deleted the fix/support-mdx-stories-in-storybook branch May 24, 2022 14:01
@jtoar jtoar modified the milestones: next-release, v2.0.0 Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature topic/storybook
Projects
Status: Archived
Development

Successfully merging this pull request may close these issues.

Unable to Write Stories in MDX
4 participants