1

I'm using cweagans/composer-patches to apply patches to my project (Magento 2). To minimise changes, I'd like composer to only apply the patch and not update any dependencies to the latest versions.

Patching is triggered at the end of a composer update command, and the new extra.patches section in the composer file lists patches which should be applied to packages. As far as I understand, the composer update will try to update all dependencies.

I think I can reduce the behaviour by doing a composer update [vendor]/[package] where [vendor]/[package] is the package I want to patch.

Is there any way of running the composer update command without triggering an update.

Dom
  • 2,980
  • 2
  • 28
  • 41
  • Did you tried `composer update --lock`? – rob006 Jan 23 '21 at 16:02
  • You can get the answer in here bro https://stackoverflow.com/questions/40914114/how-to-install-a-specific-version-of-package-using-composer – Phạm Thế Hùng Jan 23 '21 at 16:42
  • @rob006 I've not tried that but according to the official docs, `--lock` only updates the lock file hash to suppress warning about the lock file being out of date, which doesn't sound like it would work, but I'll give it a go anyway. – Dom Jan 23 '21 at 20:00
  • @PhạmThếHùng all the answers on that page talk about `require`, not `update`. I do not believe that specifying a version with require will lock the dependency versions. – Dom Jan 23 '21 at 20:02
  • `composer update --lock` should already do this, but you may also use `composer install` after `composer update --lock` - `cweagans/composer-patches` should reinstall package if it detects different patch settings between installed version and `composer.lock`. – rob006 Jan 23 '21 at 22:38
  • 1
    @Dom composer install may be the one you want – Phạm Thế Hùng Jan 24 '21 at 03:45

2 Answers2

0

You can use --dry-run option of composer update command.

Look at options section of this doc https://getcomposer.org/doc/03-cli.md#update-u

greeflas
  • 825
  • 1
  • 8
  • 20
0

composer install worked for me , thanks Is it possible to run composer update command without actually updating anything

Hayden Thring
  • 1,718
  • 17
  • 25