[Question] Composer install
Hi,
I don't get the point here. Say we have the following structure :
|- monrepo
|- packages
|- mylib
composer.json
|- web
|- app
composer.json
composer.lock
composer.json
So when I release a version, all the dependencies are updated, but not the composer.lock. So in a CI I can't do a composer install. How do you handle this ? I also read this blog but not helped me https://blog.logrocket.com/hosting-all-your-php-packages-together-in-a-monorepo/
Thanks
Usually, The structure as following:
|- monrepo
|- packages
|- mylib1
composer.json
|- mylib2
composer.json
composer.json
merge composer context of all packages into the main composer.json (installed monorepo in this)
In the other project
|- web
|- app
composer.json
composer.lock
Install own libs
Ok, in my case I have this structure :
|- monrepo
|- packages
|- myBundle
composer.json
|- web
|- app
composer.json => myBundle
composer.lock
|- app2
composer.json => myBundle
composer.lock
|- app3
composer.json => myBundle
composer.lock
......
composer.json
In that case, monorepo-builder is not adapted for that ?
@alinceDev I understand what you are doing, and it is similar to what I am doing. I think monorepo-builder is most useful for having multiple "packages" that are pure libraries, because it makes it easy to run tests and other checks on all libraries at once, and you can easily use the same version of tools across all of them.
However, when multiple "apps" need to be distributed separately, and they need to work correctly out of the box, they can't be coded to load ../../vendor/autoload.php because it won't exist. That path would only work in the monorepo, which is not intended for distribution. Therefore, while developing the individual apps, you would have to do separate composer installs in each app directory, and I don't think there is any way around that.
Hopefully that helps to answer your question.