drush
drush copied to clipboard
Minimize drush 8 phar size package
Size could be minimized to ~25%
I used to exclude files compose install --no-dev
and then cleaned filed from drush.phar
via php -dphar.readonly=0 /usr/bin/phar delete -f drush.phar -e $file
script
Describe the solution you'd like Guess box packaging could exclude the same files and make next release smaller
$ ls -la drush*
-rw-r--r-- 1 1000 1000 4697837 Oct 9 07:45 drush.phar
-rw-r--r-- 1 1000 1000 6426331 Oct 9 03:09 drush.phar.bak
$ ls -lah drush*
-rw-r--r-- 1 1000 1000 4.5M Oct 9 07:45 drush.phar
-rw-r--r-- 1 1000 1000 6.1M Oct 9 03:09 drush.phar.bak
Describe alternatives you've considered Gonna polish script to drush8-minifier
Additional context Just used to try minimize docker container image and found that drush could be smaller
using php -dphar.readonly=0 $PHAR compress -c auto -f $DRUSH
can make release compressed (gzip/bz) and it will be
-rw-r--r-- 1 1000 1000 1.3M Oct 9 09:29 drush.phar
Sounds like a good idea.
@greg-1-anderson here's quick example It cuts > 26%
And if gzip used via phar
ir makes x5 smaller, at least it greatly saves disk and a bit of carbon)
https://github.com/andypost/drush8-repacker
It just needs to pass -d phar.readonly=0
to php
Still not sure which kind of autoloader to use to optimize classloader
https://github.com/box-project/box/blob/master/doc/configuration.md#excluding-dev-files-exclude-dev-files has setting to remove dev-files, also docs/examples are useless inside phar
The option to reduce the PHAR size is using compactors. https://github.com/box-project/box/blob/master/doc/configuration.md#compactors-compactors
Thank you, I will redo patch for config
Somehow https://github.com/box-project/box/blob/master/doc/configuration.md#excluding-dev-files-exclude-dev-files is not enough to remove all dev dependencies
@Chi-teck is it ok to enable GZ compression? As I see php requires zlib (it can't be build without it) so this option looks safe /cc @greg-1-anderson
I find dump-autoload
useful too
is it ok to enable GZ compression?
I don't know.
I think it could be closed, maybe dump-autoload
could be added but it needs to measure