-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
packages not discovered due to numerous issues with package manifest search paths #410
Comments
Thanks for the issue. In your steps to reproduce, you're missing running
But WordPress doesn't load your Composer deps, so how are you loading Acorn? What are the contents of your Where are you setting |
Sorry for the confusing reproduction steps, which I added from memory.
I will try to publish a sample repo but currently the project template I'm using is private, so I'll have to do some cleanup first for it to be an actually-usable project for repro. The project uses a Bedrock-like
Composer autoloader is loaded in I boot Acorn using <?php
declare(strict_types=1);
/*
* Plugin Name: Wordpress But Lowercase P: Site Plugin
* Plugin URI: https://github.com/kleinweb/
* Description: It is a website
* Version: 1.0.0
* Author: Klein College of Media and Communication
* Author URI: https://github.com/kleinweb
* License: GPL-3.0-or-later.
*/
use Kleinweb\Lib\Application;
// Initialize the Acorn application.
add_action('after_setup_theme', static function () {
Application::configure()
->withProviders([
/*
* Package Service Providers
*/
/*
* Application Service Providers
*/
App\Core\Providers\AppServiceProvider::class,
App\Core\Providers\AssetsServiceProvider::class,
])
->boot();
}, priority: 0); |
With a I overrode Edit: That's definitely not acceptable for Bedrock-based setups, however! I don't have a clever solution to supporting both 1-level and 2-level |
Version
5.0.0-beta.0
What did you expect to happen?
WP_CONTENT_DIR
is any arbitrary number of directories below the directory containing the top-levelcomposer.json
(including at one level deep, the default for non-Bedrock WordPress projects)$composerPaths
used inApplication::registerPackageManifest()
somehow to circumvent issues like thisWhat actually happens?
Packages are not automatically discovered because Acorn attempts to find them outside of my project, where
WP_CONTENT_DIR
is only one level belowcomposer.json
:acorn/src/Roots/Acorn/Application.php
Line 240 in b72fd72
In the current implementation of
Application::registerPackageManifest()
,$composerPaths
assumes a Bedrock-like project structure where the project rootis two directory levels higher than
WP_CONTENT_DIR
.When the project root (i.e. directory containing the top-level
composer.json
)is only one level above
WP_CONTENT_DIR
, the current implementation ofApplication::registerPackageManifest()
will attemptto find packages outside of the project directory…
Steps to reproduce
composer install roots/acorn Log1x/acf-composer
in the WordPress directory./wp-content/mu-plugins/application-mu-plugin/application-mu-plugin.php
and load that file somehowACORN_BASEPATH
to that mu-plugin's directorywp acorn optimize:clear && wp acorn vendor:discover
System info
Guest: DDEV
Host: NixOS (nixos-unstable)
Log output
No response
Please confirm this isn't a support request.
Yes
The text was updated successfully, but these errors were encountered: