-
Notifications
You must be signed in to change notification settings - Fork 90
Move postcss to peerDependencies #65
Comments
Hi, I was wondering the same thing with all those PostCSS 7 upgrades. Also we had a similar case somehow in postcss/postcss-reporter#44. |
Yes, every postcss plugin includes This is output from my project
So, currently my setup uses 4 different versions of postcss (5.2.18, 6.0.23, 7.0.1, 7.0.2) and it is not ok :) Also I receive warning from one of postcss versions:
However I specify filename inside
|
@stalniy you should ask Most of the l plugins will move to PostCSS 7 soon. It will reduce from 2 to 1. |
The |
I was on vacation and missed this conversation. I was just asking something similar JLHwung/postcss-font-family-system-ui#62 (comment) so I wonder if we can resolve everything here and I’ll write up a little document explaining why things work the way they do. |
I’ll add this article also here. Another article explaining why and when it’s important to use peer deps https://lexi-lambda.github.io/blog/2016/08/24/understanding-the-npm-dependency-model/ It has a good example with React which shows the difference between deps and peer deps. And explains why React needs to be specified in peer deps |
As an example you can also check Babel plugins. The idea is completely the same and all Babel plugins specify Babel/core package in peer deps |
I do agree that there is a problem with the organization of plugins. Choosing Because there's no official curated set of plugins for PostCSS, it's hard to justify any significant changes to the conventional setup. Here is what @ai says about plugins under PostCSS organization(I don't mean to harm the image of the organization or the quality of the plugins):
Source: postcss/postcss#1173
I don't think it's entirely fair to consider React as an ultimate example, because it's a client-side library, where code duplication has performance cost(longer loading time and evaluation time). I'm playing the devil's advocate here, but it's not the same as an npm install. Babel did not specify |
@halfzebra I agree with you about babel. Until all plugins in one hands and versions are up to date, I don't care how they are managed :) |
Pasting a relevant reply from @ai
I'm quite curious about this one:
|
Also to move some info into the main thread:
|
All this files are just links to the same files, so it doesn't take too much space. |
Humm running |
@pascalduez yarn and npm doesn't make a copy. It link files if the directory contain the same version. BTW, you should open a issue for every plugin which use PostCSS 5, since they are not compatible with PostCSS 7. |
@ai these are not links. this is a proof: find node_modules/ -name postcss -type d -exec stat -c '%i' '{}' \; | uniq | wc -l
97 If they were links we would get 4 unique inodes |
they are also not symlinks because for symlinks there is a separate |
They are not links (as symlinks) but real folders with all the files in.
I will, but the after having done that on several plugins for PostCSS 7, most of them are not yet published, so without the rights on the repo and npm it seems a bit useless. |
I am talking about files, not a directories |
@ai do you mean that npm/yarn links individual files instead of folder? This sounds at least strange because would require more resources to utilize and I don't see the purpose. I will check this |
@stalniy making a link is much faster than copy a file |
Don't miss software link (special file type with path to different file) and hardware link (multiple files are pointing to the same memory) |
@ai can you provide proofs about what you say? |
there are only 2 types of links on linux systems: https://www.linuxtopia.org/online_books/introduction_to_linux/linux_Link_types.html And again links which are not symlinks must have the same inode and this is not the case for postcss: As you can see in this script I retrieve inodes of all js files.
The result is 2512 unique inodes. |
@stalniy not today (I need to fix few issues in Autoprefixer and release new Browserslist). Fast fact: yarn writes "linking" and not "coping" in terminal during installation. |
As you can see these are hard links which have the same inode |
@ai
The same tests show the same results, there are duplicates:
|
I’m sticking with the pattern established in other plugins unless/until @ai wants to make this change across the board. PRs or new issues are welcome, but I’m closing this due to inactivity. |
@ai any updates? @jonathantneal I don’t think this is the good way to communicate issues with community. There is a problem. I provided proves. The fact that you close this issues due to inactivity makes me think that the problem just ignored by the post css creators. Another point. Everybody “redirects” decision making to @ai what makes me think that if @ai doesn’t respond as in this case (or just stop working on post css), all plugins will be abandoned and the project will die. It’s pity... |
@stalniy, I’m still open to considering a change, but I would need clearer examples of prior art and the changes requested of various plugins before I made a decision. What I do feel strongly about is closing this thread. A new thread could be made, possibly on the postcss project that is more succinct. This thread sat vacant for a month. There are some robots that do this automatically and lock the thread, and I understand why that can be valuable, but I’m trying to be a little more human about it, at least until I get burned, I suppose. |
It is just better to update all plugins to PostCSS 7. |
any updates? |
@ai from angular docs about creating angular specific libs (i.e., angular plugins), what clearly maps to postcss plugins:
|
I can think about changing our policy in PostCSS 8.0, but 8.0 release funding is not very successful. |
I guess that majority of people still use SCSS, a lot of libraries use SCSS. Some may not even know which power postcss can bring to the project. I also in majority of commercial projects use only autoprefixer and that's it. So, Good luck! |
No, PostCSS has 4 times more downloads than Sass. People use Sass only as a preprocessor, but PostCSS is used as preprocessor, linter, minifier, and parser. |
postcss-preset-env
is a plugin forpostcss
thus should includepostcss
aspeerDependency
and not asdepedency
in package.json. This basically allows to use whatever supported version of postcss together with the plugin and be sure that different postcss plugins use the same instance of postcss.Please read this article https://nodejs.org/en/blog/npm/peer-dependencies/ for more details.
I can create a PR if you are ok
The text was updated successfully, but these errors were encountered: