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

Feature request: Storybook 7 support #605

Closed
kaelig opened this issue Oct 26, 2022 · 4 comments · Fixed by #803
Closed

Feature request: Storybook 7 support #605

kaelig opened this issue Oct 26, 2022 · 4 comments · Fixed by #803
Labels
enhancement New feature or request
Milestone

Comments

@kaelig
Copy link

kaelig commented Oct 26, 2022

In Storybook 7 start-storybook becomes storybook dev (or shorthand sb dev).

Current workaround:

"storyExplorer.server.internal.storybookBinaryPath": "node_modules/.bin/sb",
"storyExplorer.server.internal.commandLineArgs": ["dev", "--no-open"], // --no-open is optional, but I'd recommend it!

This extension should probably support both out of the box?

@joshbolduc
Copy link
Owner

Thanks for opening this. I haven't done any testing with 7.0 yet but this is one of a few breaking changes that will affect this extension (the other big one being the changes to the hierarchy for docs).

For this issue, I think a version check on @storybook/cli should suffice to determine whether to call sb or start-storybook. (With #571 I'm also considering changing the default approach to launching a storybook npm script, if one can be found, but would probably keep the existing behavior at least as a fallback/option.)

@ndelangen
Copy link

@joshbolduc Storybook maintainer here!

I'd be happy to assist in this migration. Would you be open to collaborating with me?
https://discord.gg/storybook <-- storybook discord invite, please DM me, or post in the #contributors channel?

Here's also a link to my calendly:
https://calendly.com/chromaui/60min

Storybook 7.0 is going to be in beta soon, and in fact I'd love to use this VScode addon myself on the storybook monorepo itself, yes we use storybook to build out storybook's UI. 😃

@joshbolduc
Copy link
Owner

@ndelangen That would be great--thanks for the offer. Unfortunately the main bottleneck so far has just been my own free time, and it may still be a little while before I can find some dedicated time to dig into this as I'd like to.

I did start looking at doing version detection, which I'll need for at least some of these changes as they otherwise won't be compatible with projects that are on 6.x. After that I think the changes that affect this extension are:

  • server binary changes (this ticket), which I've also started poking at and don't expect to be too bad
  • default stories glob including *.mdx, which also looks reasonably straightforward
  • various docs changes, which I still need to research more closely, but first impression is this will be a much bigger lift and will require touching a bunch of things
  • MDX2 support, which I'm technically negligent in not yet supporting since it's already available. This is another one I've made progress on locally, but IIRC I still need to solve some build config issues since the required libs are all ESM-only.
  • formal CSF3 support, which IME mostly works already but may have some minor (even esoteric) gaps, particularly around story name assignment and creative uses of indirection. (As with MDX2, this isn't strictly new to 7.0, and I think it happens to already work well enough for most cases even though I haven't declared it officially.)

If I were better organized these things would already have their own issues, and perhaps even a board to make them easier to track! (To say nothing of the other smaller, unrelated enhancements I have in mind. 🙂) But hopefully in the next few weeks I'll be able to come back to this in earnest. Ultimately my goal is to get a 7.0-compatible release available by the time SB 7.0 reaches GA, if not sooner. I definitely won't hesitate to reach out--thanks again for the offer!

@joshbolduc joshbolduc added this to the 1.0 milestone Feb 6, 2023
@joshbolduc joshbolduc added the enhancement New feature or request label Feb 6, 2023
@joshbolduc joshbolduc moved this from Todo to In Progress in Storybook 7.0 support Feb 16, 2023
joshbolduc added a commit that referenced this issue Feb 20, 2023
Add support for new launch strategies for launching a Storybook
developer server. This allows the server to be launched via direct
invocation (`storybook` for Storybook 7 or `start-storybook` for
Storybook 6), npm script, VS Code task, or custom script.

The existing settings for configuring the `start-storybook` binary path
and arguments are deprecated in favor of new options.

Fixes #571
Fixes #605
joshbolduc added a commit that referenced this issue Feb 20, 2023
Add support for new launch strategies for launching a Storybook
developer server. This allows the server to be launched via direct
invocation (`storybook` for Storybook 7 or `start-storybook` for
Storybook 6), npm script, VS Code task, or custom script.

The existing settings for configuring the `start-storybook` binary path
and arguments are deprecated in favor of new options.

Fixes #571
Fixes #605
@github-project-automation github-project-automation bot moved this from In Progress to Done in Storybook 7.0 support Feb 20, 2023
@joshbolduc
Copy link
Owner

With #803, I've added new launch strategies to support launching Storybook 7 servers (including directly launching storybook, legacy start-storybook, npm scripts (#571), and more). The default is to automatically detect the best option, so you should be able to remove any workarounds involving storyExplorer.server.internal.storybookBinaryPath and storyExplorer.server.internal.commandLineArgs and it'll work.

One caveat: due to storybookjs/storybook#21055, when you try launching with the current beta, it'll open a browser window (and, depending on how you launch it, run into a port conflict that prompts for user input). I have a PR to fix that, but in the meantime you can add this to your workspace settings:

"storyExplorer.server.internal.storybook.args": ["--ci"]

Like I mentioned before, there are other changes in 7.0 that are still not fully supported. I've created a project to aggregate the work needed to complete that work for anyone who'd like to follow along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants