I see two posts that describe an issue similar to mine:
Neither contains either a solid reference or a solution.
I learned that:
- Plugin’s
composer.json
needs to define it as"type": "wordpress-plugin"
if you want it to be loaded intosite/web/app/plugins
(or it ends up insite/vendor
.)
Still struggling with:
-
The rest of the
"require"
dependencies are being put insite/vendor
, unless they also have"type": "wordpress-plugin"
defined in theircomposer.json
, in which case they are installed as separate plugins. -
No dependencies are installed inside of
myplugin/vendor
. (They’re all insite/vendor
orweb/app/plugins
.)
Here’s a MWE of the plugin’s composer.json
:
{
"name": "mikeill/my-plugin",
"type": "wordpress-plugin",
"keywords": ["wordpress", "plugin"],
"require": {
"php": ">=7.0",
"composer\/installers": "1.x",
"johnbillion\/extended-cpts": "4.3.*",
"cmb2\/cmb2": "2.7.*",
},
"require-dev": {
"codeception\/codeception": "4.1.*",
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"My_Plugin\\Backend\\": "backend",
"My_Plugin\\Frontend\\": "frontend",
},
"files": [
"vendor\/wp-custom-bulk-actions\/custom-bulk-actions.php"
]
},
"extra": {
"installer-paths": {
"vendor\/{$name}\/": [
"cmb2\/cmb2",
"seravo\/wp-custom-bulk-actions"
]
}
}
}
I could, I believe, add a task to build-before.yml
(trellis/site/deploy-hooks
):
- name: Install Composer dependencies for my plugin
command: composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts --classmap-authoritative
args:
chdir: "{{ deploy_helper.new_release_path }}/web/app/plugins/my-plugin"
But that would still leave a bunch of duplicate files in site/vendor
as well as duplicate plugins.
Is there an appropriate approach and/or an example of how this should be handled?