-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add autoload paths for app plugins. #64
Conversation
746348b
to
20102b9
Compare
After this we can update bake's plugin creating command to run |
One can still manually update composer.json and any existing namespace under psr-4 autoload will be left unchanged (as seen for |
This change avoids having to update the app's composer.json to add autoload paths for app plugins under the "plugins" folder.
20102b9
to
dc2b5b4
Compare
src/Plugin.php
Outdated
if (!isset($autoload['psr-4'][$pluginNamespace])) { | ||
$autoload['psr-4'][$pluginNamespace] = $path . 'src'; | ||
} | ||
if (!isset($devAutoload['psr-4'][$pluginTestNamespace])) { | ||
$devAutoload['psr-4'][$pluginTestNamespace] = $path . 'tests'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make sure these directories exist before generating autoloader paths for them? The paths should exist but userland application structures are unpredictable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This is great 👏 We should announce this on the bakery as it is a good quality of life improvement. |
This is targeting 2.x. Would have to be backported to 1.x for Cake 4 apps. |
If we are going to backport it to |
This should be merged before we release Cake5 |
This change avoids having to update the app's composer.json to add autoload paths for app plugins under the "plugins" folder.
I have been using a custom composer plugin which does the same for quite a while for my apps.