Laravel-AdminLTE
Laravel-AdminLTE copied to clipboard
The dependency of adminlte is HUGE
Hi, i just notice that when i install jeroennoten/Laravel-AdminLTE it has dependency of almasaeed2010/adminlte which has HUGE download size, around ~109MB.

But here, i believe it just copied some of necessary files from almasaeed2010/adminlte and after that the dependency never used again. I tested it by removing almasaeed2010/adminlte after installing jeroennoten/Laravel-AdminLTE and it still works.
https://github.com/jeroennoten/Laravel-AdminLTE/blob/29213f2ff7b9cb35ff4df0298c549d5e39ab0450/src/Console/PackageResources/AssetsResource.php#L24-L77
My question is, why would almasaeed2010/adminlte included in the first place? Why not just include the necessary files in this package instead? So we can save lots of space of our vendor dir 🤷♂️️
@lakuapik
My question is, why would almasaeed2010/adminlte included in the first place?
Because this packages is based on the AdminLTE template, and we use composer to include dependencies.
Why not just include the necessary files in this package instead?
Because the process to update the AdminLTE package version will need to be manually implemented and more hard to maintain. For what I know, I think they are working on reduce the package size on the future. Also, the recommendation is to NOT include the vendor folder into any version control tool. Dependencies will be installed automatically when you execute composer install and/or composer update.
On the other hand, if you have problems with disk space, you can create your own script that execute composer update/install and then delete files from the vendor folder you won't need anymore. However, take note that the php artisan adminlte:install and php artisan adminlte:plugins we provide within this package will not work as expected if the required source files are not present on the vendor folder.
Why vendor folder size is a problem for your case?
Maybe we can use composer scripts post-update-cmd and/or post-install-cmd to remove some files after the installing/update process, for example, the vendor/almasaeed2010/adminlte/docs folder. I will try this when get some time...
@lakuapik You can add next lines to your composer.json file (the one at the root folder of your Laravel project) to reduce size of the adminlte package to 80M:
"scripts": {
"post-install-cmd": [
"rm -rf vendor/almasaeed2010/adminlte/docs",
"rm -rf vendor/almasaeed2010/adminlte/pages"
],
"post-update-cmd": [
"rm -rf vendor/almasaeed2010/adminlte/docs",
"rm -rf vendor/almasaeed2010/adminlte/pages"
]
}
You can add other files to remove, just take in mind that plugins and dist folders are used by this package.
@Shidersz thank you for the explanation and the alternative solution.
Why vendor folder size is a problem for your case?
I am building my laravel app as docker image, the size got 50% bigger just because the dependency.
My current solution is just like what you said, but for me i made an artisan command to remove unnecessary files on post-autoload-dump
@lakuapik Good to know you have find a solution. Unfortunately, I do not consider a good idea to add these lines into this package, since a package should not mess with files of other packages. Also, i'm not sure if there is a way to create a minified version of a package. If that is possible, ideally we could change the composer.json to something like:
"require": {
...
"almasaeed2010/adminlte-minified": "3.1.*"
},
Instead of using the full one with docs, example pages, etc...
@Shidersz would you mind checking this out https://github.com/lakuapik/adminlte-dist
I create adminlte-dist only, everyday it will update to upstream and check if there is new version available, if so it will open a PR and then i release new version accordingly.
another idea i had is using the same github action and add to this repo, everyday it check the upstream and update the content if the upstream has changes. what do you think? ill made a draft pr if you are interested.
Hi @lakuapik , that repository will use the same tags/versions used by AdminLTE. If yes, maybe we can use it on the composer file instead of using original AdminLTE (but I need to test all works nicely before doing that).
For the second idea, we don't and won't track any AdminLTE file in this repo, we just require and use it. So, I can't imagine how do you expect to update files inside this repo adding the Github action...
yes, i will keep the version and tag same as the upstream ColorlibHQ/AdminLTE.
Nice, do you think it will be possible to track multiple branchs on the future (not only the master one). Just in case we wanted to test AdminLTE v4 (when ready) and integrate it on a separate branch on the future. However, I'm still not sure if they will provide same structure for distributions files of AdminLTE 4.
i think the v4 has lots of major changes and the dir structure seems different from v3.
if you would like to try v4-dev you could use composer require lakuapik/adminlte-dist:dev-upstream-v4-dev branch
its a fork branch from the upstream v4-dev
Yea, v4 is currently on development, but we need to have a way to test it when ready. Thanks for including it. After finishing with some pending work I will give a review to this one.