Core: Throw an error if renderer is used as framework #19452
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
When upgrading from 6.5 to 7.0, if you just upgrade the versions in package.json instead of running the CLI, and you don't change the
framework
setting, you'll get an error like this:It's not clear from this error what the problem is, and it looks like storybook is just broken.
What I did
This PR checks the
framework
against the list of 6.5 renderers that are not frameworks in 7.0 (angular and ember are frameworks). If one of the "renderers" are found, we will now throw an error that gives a hint of what is actually wrong and how to fix it:I went back-and-forth with myself whether I should use a permalink, but I think it's best to have up-to-date docs here, especially since the list of valid frameworks will expand.
Also, I was going to add a test for this, and I found the
dev-server.test.ts
file which was great, but it turned out to be for a utility function instead, so I moved it. I can remove that commit though if you'd like, since it's not directly related to this PR.How to test
The way I tested was to build the branch, create a sandbox (linked), and set
frameworks
to@storybook/react
. Runningyarn storybook
then showed my validation error, instead of the confusing one.