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

Codemod: convert mdx to module format #7419

Merged
merged 11 commits into from
Jul 18, 2019
Merged

Conversation

shilman
Copy link
Member

@shilman shilman commented Jul 15, 2019

Issue: #7101

Builds on #7418, merge that first before reviewing

What I did

  • Adds convert-mdx-to-module codemod + test cases

How to test

Unit:

yarn jest --testPathPattern convert-mdx-to-module.test.js

End-to-end:

./lib/cli/bin/index.js migrate convert-mdx-to-module --glob "examples/official-storybook/**/*.stories.mdx" --rename mdx:js

@vercel
Copy link

vercel bot commented Jul 15, 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-convert-mdx-to-module.storybook.now.sh

@github-actions
Copy link
Contributor

Automention: Hey @Keraito @elevatebart @JeroenReumkens, you've been tagged! Can you give a hand here?

@shilman shilman marked this pull request as ready for review July 15, 2019 11:18
@shilman shilman requested a review from tmeasday July 15, 2019 11:18
import { Meta, Story } from '@storybook/addon-docs/blocks';

<Meta title='Button' />

Copy link
Member

Choose a reason for hiding this comment

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

Any markdown here just gets completely dropped?

Copy link
Member Author

@shilman shilman Jul 15, 2019

Choose a reason for hiding this comment

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

For now, yes. PR's welcome 😉

Copy link
Member

Choose a reason for hiding this comment

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

Hmm.. do you think this is useful if we do that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely. We're going from a format that supports mixtures of longform documentation and code to one that does not. This completely solves the tedious task of translation in an automated fashion, and for now users will have to figure out themselves how they want to encode that documentation.

If we ever have a recommended way to encode longform docs in module format, we can try to encode that in the codemod.

Copy link
Member

Choose a reason for hiding this comment

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

I thought you could put markdown in the module format somehow?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have a prescription for that. Some users will put it in docgen comments, others in strings, others in .md files that get loaded in. When somebody has a good solution they want to push, they can upgrade this codemod accordingly.

I personally think people should be using MDX for longform docs and not module format, and the purpose of this PR is to help people who try it and want to go back for whatever reason.

@shilman shilman merged commit 984912d into next Jul 18, 2019
@shilman shilman deleted the 7101-convert-mdx-to-module branch July 18, 2019 12:03
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.

3 participants