monorepo-builder icon indicating copy to clipboard operation
monorepo-builder copied to clipboard

Expose a helper to import the autoloader no matter the depth of the monorepo packages

Open adaliszk opened this issue 5 months ago • 0 comments

Great work on this, it really does enable monorepo use-cases!

However, one issue I ran into is that all autoload imports needed to be adjusted. The main issue there is not the adjustment, but that if you containerize your workspaces independently, you need to maintain two distinct import paths or adopt your image to mimic the exact folder structure depth.

It would be really useful if a symlink of sort or a helper function would be exposed so that importing the autoload from the global vendor or the local vendor in dockerized environments would not need a custom solution.

The ideal solution to me would be to symlink the vendor/autoload.php, vendor/composer, and vendor/bin in each of the monorepo workspaces, that way importing or using any of the binaries would work.

An alternative solution I can think of is to expose a simple recursive method that would find the vendor folder until it hits a limit or the .git folder and resolves the actual path. While this is extra computation, its not that horribly lot to go through.

adaliszk avatar Sep 10 '24 09:09 adaliszk