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

Setting `"wordpress-install-dir": "."` erases installation directory #9

Closed malthejorgensen closed 7 years ago

malthejorgensen commented 7 years ago

I wanted to install Wordpress in the same folder as the rest of my files so I set

"extras": {
  "wordpress-install-dir": "."
}

in composer.json.

This erased all files in the directory, including the .git-folder and .gitignore – leaving only the files from this repository (johnpbloch/wordpress).

Moved from johnpbloch/wordpress issue #23

tomjn commented 7 years ago

Composer updates a package by deleting it then installing the latest version. If your package is located in the root directory then the root directory is deleted and replaced with the latest version. This is expected behaviour in composer, which doesn't support nested packages, and would normally have dependencies in a vendor sub folder, so the chances of this being changed in composer are next to zero. There's little that can be done about it from this installer package.

I would advise you take one of the following steps:

I've gotten a lot of benefit from using the latter method when needing WordPress installed in the root, and managing everything else from composer, especially combined with the scripts configuration in composer.json

johnpbloch commented 7 years ago

Fixed in v1.0.0

garrettw commented 6 years ago

I have this issue as well. While the WP-CLI suggestion is a good one, I think I may have found a way to still do everything in Composer using drupal-composer/preserve-paths. It's not perfect, but it works (and it could be even more so if my feature request over there is accepted).