CodeIgniter Forums
How to make it a "Framework with a small footprint" again? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: How to make it a "Framework with a small footprint" again? (/showthread.php?tid=84728)

Pages: 1 2


How to make it a "Framework with a small footprint" again? - Kimotu - 11-03-2022

Hi all,

CodeIgniter is advertised as a
Quote:Framework with a small footprint
But this is only true if you manually clean up all those test, vendor, contribution directories. If you had to run 'composer' you may end up with 20 times more disc space used.
Is there a command (composer dist-clean, spark cleanup,...) command to shrink it automatically or a howto/manual which directories are safe for deletion in production?

My current project has 275 MB after I had to run composer, then I always have to cleanup directory by directory and check whether my app still runs (the files in vendor are pretty critical).
So I delete directory by directory, test my app, restore essential directories again, test the next one and so on. Pretty annoying after every upgrade.

Would be nice  if you have hints how to make an automatic dist export for production with "small footprint" and without all these unit tests and test dependencies that are never used in production.

Kimotu


RE: How to make it a "Framework with a small footprint" again? - kenjis - 11-04-2022

v4.2.9 has 24MB right after installation by composer appstarter.

If you remove  Composer packages only for development;

Code:
$ composer install --no-dev

It will have only 5.5MB.


RE: How to make it a "Framework with a small footprint" again? - Kimotu - 11-07-2022

[quote pid="402590" dateline="1667603944"]
Code:
composer install --no-dev

[/quote]
Thanks for the hint. This is what I was looking for. But I still have a question:

I did:
Code:
composer create-project codeigniter4/appstarter

composer update

composer install --no-dev

Then there exists a directory appstarter/vendor/codeigniter4/framework which holds the same directory structure as appstarter (app, public, writeable,...), but additionally the essential system directory. Can I savely delete everything in there except system (and maybe the other directories in appstarter/vendor?. Would reduce the footprint more and remove useless (?) dupes.


RE: How to make it a "Framework with a small footprint" again? - kenjis - 11-07-2022

Basically you should not touch files in vendor/.
So I don't recommend you remove any files in it.

But yes in vendor/codeigniter4/framework/, actually only vendor/codeigniter4/framework/system/
(and composer.json) is used now.


RE: How to make it a "Framework with a small footprint" again? - ijurisic - 11-14-2022

(11-04-2022, 04:19 PM)kenjis Wrote: v4.2.9 has 24MB right after installation by composer appstarter.

If you remove  Composer packages only for development;

Code:
$ composer install --no-dev

It will have only 5.5MB.

If use --no-dev, official package shield not work


RE: How to make it a "Framework with a small footprint" again? - captain-sensible - 11-14-2022

perhaps after your composer no dev install you run :
Code:
composer require codeigniter4/shield

https://packagist.org/packages/codeigniter4/shield


RE: How to make it a "Framework with a small footprint" again? - ijurisic - 11-14-2022

(11-14-2022, 03:48 AM)captain-sensible Wrote: perhaps after your  composer no dev install you run  :
Code:
composer require codeigniter4/shield   

https://packagist.org/packages/codeigniter4/shield

If using "composer require codeigniter4/shield" then got:
  Could not find a version of package codeigniter4/shield matching your min 
  imum-stability (stable). Require it with an explicit version constraint a 
  llowing its desired stability.    

I see only one way to avoid this with bring devs packages with "composer require codeigniter4/shield:dev-develop" but I'n that case framework on my disk have about 32mb.


RE: How to make it a "Framework with a small footprint" again? - kenjis - 01-21-2023

(11-14-2022, 04:00 AM)ijurisic Wrote: I see only one way to avoid this with bring devs packages with "composer require codeigniter4/shield:dev-develop" but I'n that case framework on my disk have about 32mb.

It is because dev-develop is a git branch, so git repository (.git) is installed.

I checked the folder size:
16M ./vendor/codeigniter4/shield/.git
24M ./vendor/codeigniter4/shield

And Shield has a dictionary for passwords:
6.5M vendor/codeigniter4/shield/src/Authentication/Passwords/_dictionary.txt


RE: How to make it a "Framework with a small footprint" again? - ruslan - 01-22-2023

(11-04-2022, 04:19 PM)kenjis Wrote: v4.2.9 has 24MB right after installation by composer appstarter.

If you remove  Composer packages only for development;

Code:
$ composer install --no-dev

It will have only 5.5MB.

Nice hint
My 'vendors' folder has got 50 times thinner
This is partly in the documentation, but perhaps it can be emphasized


RE: How to make it a "Framework with a small footprint" again? - kenjis - 01-22-2023

(01-22-2023, 06:43 AM)ruslan Wrote: My 'vendors' folder has got 50 times thinner
This is partly in the documentation, but perhaps it can be emphasized

How about this?
https://github.com/codeigniter4/CodeIgniter4/pull/7165

Updated: https://codeigniter4.github.io/CodeIgniter4/installation/installing_composer.html#installation