-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
CLI: Add Server template generator #13979
Conversation
d151341
to
7cf5c72
Compare
const prefix = fse.existsSync('./src') ? '../src' : '../stories'; | ||
const stories = [`${prefix}/**/*.stories.json`]; |
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.
People could have stories in any location, correct? Maybe we should just prescribe one like we do in other generators.
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.
Simplified this.
|
||
baseGenerator(packageManager, npmOptions, options, 'server', { | ||
addComponents: false, | ||
configureOptions: { stories }, |
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.
Doesn't seem like this is used?
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.
reworked it a little
7cf5c72
to
34cded1
Compare
34cded1
to
659c938
Compare
|
||
baseGenerator(packageManager, npmOptions, options, 'server', { | ||
addComponents: false, | ||
extraMain: { stories }, |
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.
updated to leverage the recently added extraMain
params.
In all of our other project templates, Would it be possible to:
That way everything's hooked up and the user can just remove stuff to get it working with their own server. What do you think? |
@shilman I think we're in decent shape here. Did you solidify the netlify app that backs these generated samples? |
@jonspalmer I think it's in good shape |
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.
LGTM!
Nx Cloud ReportCI ran the following commands for commit 3c04dc6. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
@jonspalmer @shilman the url http://storybook-server-demo.netlify.app/api resolves into a 404. Did we miss something? |
@yannbf thanks! i added minimal docs and a redirect to the docs. it never actually called that URL, so it didn't matter in practice that it was a 404. but the redirect removes more opportunities for confusion. |
Issue: #12077
What I did
Added Cli generator support for Server
Open questions
It would be helpful to the user if the generator added a few stanzas to
.storybook/preview.js
to template the configuration required to point to the server backend. However, I'm a little lost as to have to arrange that. It seems like the template copying has mostly been eliminated and preview in particular gets written explicitly here: https://github.com/storybookjs/storybook/blob/next/lib/cli/src/generators/configure.ts#L18Not sure if the intent would be to add more cases to that logic or somehow generalize the preview handling to make it simpler for apps to provide their own tweaks.