johnpbloch / wordpress-core-installer

A composer installer for WordPress core so I can stop saying core is a wordpress-plugin type package.
https://packagist.org/packages/johnpbloch/wordpress-core-installer
GNU General Public License v2.0
207 stars 49 forks source link

plugins and themes #20

Closed macvk closed 6 years ago

macvk commented 6 years ago

"wordpress-core-installer" has option "wordpress-install-dir", which is ignored by every plugin from https://wpackagist.org/. Is that ok? It seems to me that it is a bug. serious bug.

Rarst commented 6 years ago

That is quite correct and desired behavior. With Composer-based WP stack plugins and themes should absolutely be separate from core directory. Otherwise core package update will wipe them out.

WPackagist wrapper (as well as any plugins/themes purposely developed for Composer) use a different installer from Composer project itself and its configuration — https://github.com/composer/installers

macvk commented 6 years ago

how can i use your "installer" to install wordpress and themes? I see only one way: using post scripts. is that right?

Rarst commented 6 years ago

This installer is strictly meant for WP core itself. WP plugins and themes are handled by Composer's own multi-framework installer, as above.

macvk commented 6 years ago

Please suggest the way to install wordpress and wp themes using your installer and themes from wpackagist.org.

Rarst commented 6 years ago

I am not the author of this installer, to be clear, just chiming in. :)

If you need a complete site stack example I have one here — https://composer.rarst.net/recipe/site-stack/

macvk commented 6 years ago

thanks. As I can see your composer.json is configured to install wordpress into the folder /wp/ but plugins will be installed in the folders /wp-content/plugins/{$name}. Plugins would be installed outside wordpress. Am I right?

macvk commented 6 years ago

I want to add plugins and wordpress in the requirements of my composer.json and run "composer install". that's all. i don't want to do some additional work (copy, customize wordpress ...) after "installation". I don't understand the benefits of such an "installation". if after installation I must do additional steps to finish my "installation".

johnpbloch commented 6 years ago

Hi @macvk

Thanks for stopping by and starting the conversation! This installer is specifically meant to support a rather specific WordPress installation setup in which WordPress is installed in a subdirectory (see the WordPress codex on that subject) and in which the location of WP_CONTENT_DIR and WP_CONTENT_URL have been customized to be outside of WordPress core (see the WordPress codex on that subject). As @Rarst already explained, that is because composer will delete your whole wp-content directory every time it updates core. If that installation setup isn't what you are looking for, then this installer is not something you will want to use. And that's fine--this setup isn't right for everybody. But you can't use Composer to manage WordPress core without using this setup (at least not without brittle workarounds that strike me as more trouble than they're worth).

The good news is that this isn't the only way to get Composer into your site stack. You can use composer to do the initial download of WordPress and then after that use it to only manage plugin and theme dependencies. For example:

composer create-project johnpbloch/wordpress-core new-project 4.9.*@stable

Then you can use the composer.json file in the copy of core that gets downloaded to new-project. Add wpackagist to it as a custom repository, and go ahead and start using composer to install themes and plugins.

The only thing to be aware of here is that you can't manage the version of WordPress that's installed with Composer in this case. If you go with this route, you could still use wp-cli to keep WordPress up to date, but it won't factor into dependency resolution.

Hope this helps!

aleclarson commented 6 years ago

I think overriding WP_CONTENT_DIR should be recommended in the README.

And link to @Rarst's sample composer.json

johnpbloch commented 6 years ago

@aleclarson Good call. Added in 784aeeadcf21c7a8076c1ab2cb4725ea24a5d0c0.