astroturfcss / astroturf

Better Styling through Compiling: CSS-in-JS for those that want it all.
https://astroturfcss.github.io/astroturf/
MIT License
2.28k stars 60 forks source link

Reduce Install size #734

Open ai opened 2 years ago

ai commented 2 years ago

New version of astroturf has dependnecies for 18 MB. Of course, node_modules install size is less important resources than bundle size. But 18 MB is too big and will affect CI performance and FS performance of using node_modules (text editor will be very slow when you will try to open node_modules).

It happens because astroturf use 140 (!) subdependnecies.

Снимок экрана от 2021-12-21 22-10-12

Seems like this problem can be fixed without big changes. Just by using dependencies a little more careful:

  1. Replacing cosmiconf to lilconfig (the same API but less subdependencies, we moved in PostCSS too).
  2. Replacing chalk with picocolors https://github.com/4Catalyzer/astroturf/issues/732
  3. Remove PostCSS plugins without maintaince using very old PostCSS: postcss-atroot and postcss-strip-inline-comments
  4. Using specific lodash.X packages instead of all-in-one lodash
  5. Cleaning some type dependencies. I am not sure that we need all of them. For instance, seems like we need @types/fs-extra only for astroturf development, not to use it always.
jquense commented 2 years ago

Happy to take PR's that reduce size without removing features, or make maintaince harder. I'm honestly not that concerned with install size...assuming we did everything on the list here how much would that affect the install size? I suspect most of the bulk is from big tools like babel

ai commented 2 years ago

I'm honestly not that concerned with install size...assuming we did everything on the list here how much would that affect the install size?

Hard to say. I could put a task to Cult of Martians (our way to help people go into open source) and see the result.

ai commented 2 years ago

Here is a link to 1.0.0’s dependnecies https://npm.anvaka.com/#/view/2d/astroturf/1.0.0-beta.29

In 1.0.0 there is even more 140 → 204 subdependencies.

ai commented 2 years ago

The task was created https://cultofmartians.com/tasks/astroturf-deps.html#task

I think in a 2-3 week it will be a PR where we can see the result.

In my projects, I was able to make node_modules less than 30 MB. It improved DX a lot (a few seconds for CI, yarn upgrade in insanely fast, less work for dependencies maintainability).

krutoo commented 1 year ago

@jquense @ai PR is ready. When can it be merged?