-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Check postcss versions to avoid using PostCSS 7 #507
Comments
We allow to use PostCSS 7 and PostCSS 8, what the warhing we should show? |
We can do something like this: if (postcss().version.startsWith('7.')) {
let pkg = readPackageJson()
if (!pkg.dependencies.postcss && !pkg.devDependencies.postcss) {
throw new Error('Add postcss as project dependency. postcss is not a peer dependency for postcss-loader. Use `npm install postcss` or `yarn add postcss`')
}
} |
But npm@7 install peers deps automatically, yarn exit with non zero code, I can accept this PR, but I don't understand why developers ignore messages from package manager |
Short answer: because they always ignore warnings 😅 Long answer: npm writes a lot of messages and teach users to ignore them.
Yarn 1 (which is still the most popular) just print warning.
npm 7 is a non-standard version. Only npm 8 will be LTS version.
I will create task on Cult of Martians to prepare PR. |
hm, extra fs call, not good for performance, maybe we can try to use |
Can you show pseudo-code to understand what do you mean? |
Move |
If project has a few PostCSS plugins, npm can deduplicate
Am I right, that in this case |
If plugins have postcss in peer deps no postcss in node_modules and |
But most PostCSS plugins still have We need a solution for this case. The case with PostCSS 8 only plugins is not a problem, since these users will have errors like |
Searching and reading Honestly encourage bad practices like not reading messages from package managers, ignoring changelog when you updating new versions and etc are very bad ideas, many projects do it and in the future it will create huge problems with updates and performance |
Users do not read docs and do not read ChangeLog. This is reality. We can blame users, but blaming users will not make PostCSS 7→8 migration easier.
Yeap, I know that it is a dirty thing. This is why I am suggesting to do it only for If this way is OK, I will create a task on the Cult of Martians. If you have any other option, I am open to it. I know that it is simpler for us to ignore that problem. But we need to find some solution. Twitter is full of people, who forget to install |
Sounds good, PR welcome |
Many users report the same problem with PostCSS 7 → 8 migration.
postcss-loader
postcss
peer dependency warningpostcss
7 from some deep dependencyOf course, we can blame users. But this is a popular error.
In
postcss-cli
we checkpostcss().version
and showAdd postcss to package.json
error message. Should we do something like this inpostcss-loader
?The text was updated successfully, but these errors were encountered: