composer-patches icon indicating copy to clipboard operation
composer-patches copied to clipboard

Possibilities to give the command "patches-repatch" options for the composer install

Open saschabaecher-twocream opened this issue 1 year ago • 4 comments
trafficstars

Verification

  • [X] I have updated Composer to the most recent stable release (composer self-update)
  • [X] I have updated Composer Patches to the most recent stable release (composer update cweagans/composer-patches)
  • [X] I am using one of the supported PHP versions (8.0+)
  • [X] I have searched existing issues and discussions for my idea.

Is your feature request related to a problem?

Currently you have to use the command patches-repatch to execute the patches, which then executes the normal Composer install routine.

But now you have the problem that you can not use options like --no-dev.

Describe your proposed solution(s)

The possibility to pass the command patches-repatch a new parameter "install-options" with a string in the following format: "--no-dev --no-interactions"

From this you can then store the options in the ArrayInput with the value true with an explode to " ".

Describe alternatives

No response

Additional context

No response

saschabaecher-twocream avatar Mar 27 '24 16:03 saschabaecher-twocream

👋 Thanks for the idea! Please remember that this is an open source project - feature requests may or may not be implemented, and if they are, the timeline is unknown. If you need a guaranteed implementation or timeline, sponsorships are welcome!

github-actions[bot] avatar Mar 27 '24 16:03 github-actions[bot]

Seems reasonable! It'll be a bit until I can work on this, but if you open a PR in the mean time, I'd be glad to review!

cweagans avatar Mar 27 '24 18:03 cweagans

Hi @cweagans, with pleasure! PR is created.

saschabaecher-twocream avatar Apr 15 '24 01:04 saschabaecher-twocream

I was looking if an issue for this problem already exists or not and am lucky to see a PR already. I hope this gets released soon.

Another way to think about this would be a --pre-install option. In my projects I usually use two custom composer scripts which look like this:

"scripts": {
  "deploy-staging": [
    "git pull -p",
    "@composer validate",
    "@composer install --optimize-autoloader"
  ],
  "deploy": [
    "git pull -p",
    "@composer validate",
    "@composer install --no-dev --optimize-autoloader"
  ]
}

With the --pre-install option this would be possible:

"scripts": {
  "pre-install-cmd": [
    "@composer patches-repatch --pre-install"
  ],
  "deploy-staging": [
    "git pull -p",
    "@composer validate",
    "@composer install --optimize-autoloader"
  ],
  "deploy": [
    "git pull -p",
    "@composer validate",
    "@composer install --no-dev --optimize-autoloader"
  ]
}

This way patches-repatch would do its job as part of the composer install pre-hooks without executing the composer install by itself. Currently this is not possible because that would lead to an endless loop.

mfrieling avatar May 21 '24 11:05 mfrieling

any update on this?

alexchexes avatar Jul 24 '25 09:07 alexchexes