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

composer update --lock invokes composer update #61

Closed
caugner opened this issue Dec 9, 2021 · 2 comments
Closed

composer update --lock invokes composer update #61

caugner opened this issue Dec 9, 2021 · 2 comments

Comments

@caugner
Copy link

caugner commented Dec 9, 2021

When I run just composer update --lock to update my root composer.lock's content-hash, the post-update-cmd is invoked and basically updates all vendor-bin dependencies, not just their lock files.

// composer.json (extract)
  "scripts": {
    "bin": "echo 'bin not installed'",
    "post-install-cmd": [
      "@composer bin all install --ansi"
    ],
    "post-update-cmd": [
      "@composer bin all update --ansi"
    ]
  }

This doesn't seem right, so either (a) Composer shouldn't run the post-update-cmd on update --lock, or (b) the Composer-bin-plugin should/could detect this somehow and only run update --lock as well (maybe Composer passes the parameter in an ENV variable or so?).

Obviously, a workaround for us would be to remove the post-update-cmd, because we can call bin all update manually if we need to.

@caugner
Copy link
Author

caugner commented Dec 9, 2021

Unfortunately, Composer always runs the event scripts, except if the --no-scripts option is provided:

https://github.com/composer/composer/blob/62dfd0af231996b7d3afc306700e026cb0b4aae4/src/Composer/Command/UpdateCommand.php#L128

The event script is then called here:

https://github.com/composer/composer/blob/005117dda39a6356e72f6cbf589a586751c022b3/src/Composer/Installer.php#L369-L373

However, Composer's EventDispatcher cannot distinguish between --lock and other update invocations.

@caugner
Copy link
Author

caugner commented Feb 23, 2022

Fixed by #67.

@caugner caugner closed this as completed Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant