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

ClassicPress updates should not overwrite composer.json #477

Open
nylen opened this issue Sep 8, 2019 · 2 comments
Open

ClassicPress updates should not overwrite composer.json #477

nylen opened this issue Sep 8, 2019 · 2 comments
Labels
type: bug Something isn't working

Comments

@nylen
Copy link
Contributor

nylen commented Sep 8, 2019

On sites that use a customized composer.json, this file will be overwritten when ClassicPress is updated (manually or automatically). This is not the desired behavior as any dependencies will be lost.

We need to modify the update code to avoid overwriting composer.json. A couple of options:

  • Never overwrite composer.json
  • Detect whether composer.json has been modified and overwrite it if no customizations have been made
@nylen nylen added the type: bug Something isn't working label Sep 8, 2019
@nylen
Copy link
Contributor Author

nylen commented Sep 14, 2019

invisnet
with #477, i remember we looked into that when including composer.json - did we miss something or just get it wrong?
James Nylen 12:37 AM
no, we looked into something different (what happens when migrating if composer.json already exists)
I don't think we really got that case right either
invisnet 12:38 AM
ah, that'd be it....
really goes back to the fundamental problem that it's in the wrong place
James Nylen 12:39 AM
composer wants to install from the repo where composer.json lives though, right? if that's the only way then there isn't really a better place to put it
invisnet 12:43 AM
there was a convo about subdirs etc iirc to solve that - not something for 1.x obvs
is there any existing logic for not overwriting files?
James Nylen 12:50 AM
I don't remember seeing anything like that.. the simplest fix would just be putting if ( $filename === 'composer.json' ) { continue; } in the right place
yeah, "if it doesn't exist, write it, otherwise leave it alone"
this works because composer.json (normally) doesn't change across releases
invisnet 12:54 AM
it'll change between v1 and v2 won't it?
nevermind - it'll change when johnpbloch/wordpress-core-installer changes as we've got a specific version in there
i think we need to change that to "^1.0"
James Nylen 1:04 AM
wfm

@nylen
Copy link
Contributor Author

nylen commented Sep 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant