-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Core: Deprecate default postcss config, recommend addon-postcss #13669
Conversation
@shilman This isn't quite ready to be promoted from a draft, but it'd be great if you can review to decide if this is a good direction to go. Happy to chat about it some time this week. |
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.
Looking great 💯
My only concern (and it's a small one) is the peer dependency -- is there any way of providing a "sensible default"?
846ce3a
to
7979383
Compare
@shilman What is your goal in avoiding the peerDep? If we don't have users install the version of postcss they want to use, we are going to run into the same issue that currently exists with |
Could the PnP tests be updated to cover this please? Should make sure the dependencies are handled correctly |
I have no idea what this is and I have no experience with PnP. FWIW, we decided that addon-postcss is going to embed it's dependencies directly and not rely on any peerDep stuff. Not sure if that matters at all. |
25d6538
to
e95ced7
Compare
e95ced7
to
abf6b14
Compare
abf6b14
to
05a82d7
Compare
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.
Aside from a couple typos, looking great!
@merceyz @gaetanmaisse I'm merging this and releasing to move the project along. We can update with the PnP stuff once we have a little more clarity there. |
https://yarnpkg.com/features/pnp - TL;DR; You can't access anything you haven't declared
Would basically just update the list of e2e tests to run through PnP here storybook/.circleci/config.yml Line 366 in 1b7fed0
|
Ah cool! So that means the |
As it is setup now, no, the CI config I linked to only tests
|
Hmm, is it not necessary to have cypress and a local registry set up? |
Alright, I've researched this more and it seems that the yarn PnP e2e tests use the scaffolds that the CLI provides and none of those are going to include addon-postcss, since it's an external addon that people opt into. I don't think it makes sense to e2e test this. |
It would make sense to have a test with multiples addons but we are not there yet, we talked about using the SB CLI to add them during the E2E process. Feels free to ping me on discord! |
Is the goal of this is to allow upgrading to |
@vdh if you take a look at the example, it proves that this works. Those loaders don't pull in autoprefixer or any plugins (config loading isn't part of postcss itself, only the loader). Additionally, PostCSS can support plugins using older versions if they are written in a specific fashion (see postcss-rebecca-purple in the example). |
I'm confused about the message introduced in this PR:
If I'm not relying on PostCSS, how do I disable the message? |
@kaelig you don't disable the warning. It will go away when storybook 7 is released. |
@phated shouldn't we detect if the user has |
@shilman that's only for people that actually want to use postcss, users that don't want to use it are just shown the warning to know the implicit addition of postcss will be removed in 7.0 |
This is definitely useful to know for people configuring Storybook. In contrast, I'm on a team where I configure Storybook for hundreds of devs (who are on the side of "using" storybook), and I'd like to prevent them from seeing this message in case they think there's something wrong with our config. I'd love the ability to hide this message, or perhaps you can provide a workaround with a webpack plugin that would filter out that particular message? |
@kaelig It's just a node flag https://nodejs.org/api/util.html#util_util_deprecate_fn_msg_code |
Yes, however I'm not sure we'll want to install it. I'll try both approaches and see! |
We didn't use the addon, so this change prevents logging the deprecation warning. storybookjs/storybook#13669
We didn't use the addon, so this change prevents logging the deprecation warning. storybookjs/storybook#13669
storybook with postcss8 works with npm but not with yarn |
Issue: #12668
What I did
I deprecated the implicit addition of the
postcss-loader
to the preview webpack config inside@storybook/core
and skip adding it completely if users depend on the new@storybook/addon-postcss
package.This new addon is much more flexible in configuring each loader and is versioned independently of Storybook, so it can track PostCSS updates in the future.
I also deprecated the default plugins that Storybook adds for users and added a migration guide to set up a postcss config file if consumers want those packages.
Additionally, I updated the
html-kitchen-sink
example to show how an end-user can swap out the PostCSS version to v8, even before the plugin is upgraded (handy for v9, v10, etc!).How to test
If your answer is yes to any of these, please make sure to include it in your PR.