Skip to content
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

Installing wp-core to project root as dependency #53

Open
acalvino4 opened this issue Oct 6, 2021 · 1 comment
Open

Installing wp-core to project root as dependency #53

acalvino4 opened this issue Oct 6, 2021 · 1 comment

Comments

@acalvino4
Copy link

First of all, thanks so much for maintaining this project! it's always refreshing to see that there are in fact php developers who take time to make development best practices work in their projects, even if the framework out of the box doesn't support it.

Anyway, I know you say somewhere that if you want to install wp-core to root, this project is not for you. However, to me maintaining that third-party code (which wp is) is a dependency is a must for me, and unfortunately having wp-core installed to root is also a must because of the my client's hosting provider. I just thought I would publish my workaround here in case anyone else finds themself in a similar place, as well as for consideration for this method to be implemented into the core installer.

Basically, all I did was add the following to my composer.json:

{
...
  "extra": {
    "wordpress-install-dir": "wp"
  },
  "scripts": {
    "post-install-cmd": ["@moveWPtoRoot"],
    "post-update-cmd": ["@moveWPtoRoot"],
    "moveWPtoRoot": [
      "rsync -a wp/ .; rm -rf wp"
    ]
  }
...
}

Effectively all it does is install the core to a subfolder, then rsync it to root and delete the subfolder. This solves the issue where specifying "." as your "wordpress-install-dir" erases all your files.

@johnpbloch
Copy link
Owner

Thanks for putting this together! I think this is not something I'll be adding to the installer, just to keep the scope of the installer within where I want to maintain it. That being said, a separate installer and package that used it and required johnpbloch/wordpress-core directly which has this behavior would certainly be worth advertising here too.

Potential features aside, I'm going to lock and pin this issue so that future readers can get a good sense of how to do this with the least friction possible.

@johnpbloch johnpbloch pinned this issue Oct 6, 2021
Repository owner locked and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants