"Shrink" library dependencies

I’m using PIO (PIOArduino actually, if it matters) to develop mostly for the ESP32 platform, and have a question.

When I set a library dependency, is there any good way to “shrink” the stuff it downloads and incorporates into the project? For example I use TFT_eSPI a lot, and it comes with a bunch of examples, extensions, user_setups, etc. that I don’t need and are just taking up extra space.

I suppose I could just go in and delete the files but presumably if the library gets updated or something else triggers it reinstalling, that stuff will all come back. So I’m wondering if there’s a better way to do it?

I see two solutions here:

If it is just about the storage on your harddrive you can use a global version of the library and include it via symlink in the platformio.ini to your project. See Are libraries duplicated? - #2 by sivar2311

If this should also apply to other users of your project I would recommend to create a fork of the library. Then remove the unwanted stuff and use the forked version of the library in your project.

Ask PlatforemIO to download dependencies on the version you want. Don’t worry about HD space consumed.
The compiler will ONLY include the things it actually needs to compile your software (this is not PHP or Python).

Avoid using globals libs IMHO, they will only bite you in the back when you needs multiple versions of the same library in different version numbers. Just stick to keeping things local to your project.

If HD space is an issue, see if you can be a bigger HD, they are not that expensive anymore and it will save you a LOT of time managing.

Last ly, if projects are not touched for sometime, then you only need to delete the build directory to clean up space, and you don’t need to worry about global libraries