-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support automated storybook population via MAGIC #4
Conversation
setConfigPromise: async (config) => { | ||
if (!manual) { | ||
const storybook = await buildStorybook({ configDir }) | ||
console.log('storybook', JSON.stringify(storybook, null, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What level of logging should we be shooting for? This one looks like more of a debug log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call; we should remove most of this debugging stuff before we proceed too far w/ this module.
Looks like docz
uses signale for its logging and we could follow suit with some optional verbose logging if we wanted.
This looks great @transitive-bullshit! If I'm reading correctly, it looks like it would be rather trivial to permanently write the MDX files for a full migration to DocZ with a simple update the the file path where the mdx file is written. Does the storybook data include information on file path of original story files? |
Yes and no. We're actually permanently writing the mdx files to |
<Story kind='${kind}' name='${name}' /> | ||
|
||
`)} | ||
` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be separated into a separate template file that's overridable by the user.
78882f7
to
ba07858
Compare
Closing in favor of #13 |
This PR adds the following steps in order to aggregate the story metadata server-side during our Docz plugin hooks.
plugin.setConfigPromise
@storybook/react/standalone
to build a pared down version of the real storybook frontend (with our shim aliased)plugin.modifyFiles
Note that before this PR can be merged, it is dependent on two other PRs:
PR 1) a simple bugfix for
storybook
that fixes a bug where the standalone build Promise is resolved before it's actually completedPR 2) a feature for
docz
that adds two new plugin hooks:plugin.setConfigPromise
(an async version of the existingplugin.setConfig
) andplugin.modifyFiles
(which allows us to edit the list of files Docz has aggregated before Docz starts processing them)Note that I have a fully automated working version of this locally including locally linked versions of
@storybook/core
anddocz-core
.In the image below, the
Manual Button
menu item was added via a manualmdx
file, whereas theButton Stories
menu item was added automatically by MAGIC!