Welcome Guest, Not a member yet? Register   Sign In
How to make it a "Framework with a small footprint" again?
#1

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
Reply
#2

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.
Reply
#3

(This post was last modified: 11-07-2022, 02:20 AM by Kimotu.)

[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.
Reply
#4

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.
Reply
#5

(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
Reply
#6

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

https://packagist.org/packages/codeigniter4/shield
CMS CI4     I use Arch Linux by the way 

Reply
#7

(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.
Reply
#8

(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
Reply
#9

(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
Reply
#10

(This post was last modified: 01-22-2023, 09:29 PM by kenjis.)

(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/CodeIgnit...stallation
Reply




Theme © iAndrew 2016 - Forum software by © MyBB