-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Add option to run bump after update #11942
Add option to run bump after update #11942
Conversation
6903fb0
to
cc20ff5
Compare
I can see that the PHP 8.4 tests are failing but the failures seem unrelated to these changes and they also seem to happen in the main branch |
0d8312d
to
0d9f1b9
Compare
{ | ||
$this->initTempComposer($composerJson); | ||
|
||
if ($createLock) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bump command needs that a lock file exists, so when testing the bump-after-update
version we need to create one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, after a quick review just one comment but I'll need to take a closer look when I'm back at my desk :)
doc/06-config.md
Outdated
@@ -476,4 +476,9 @@ throw, but you can set this config option to `["example.org"]` to allow using sv | |||
URLs on that hostname. This is a better/safer alternative to disabling `secure-http` | |||
altogether. | |||
|
|||
## bump-after-update | |||
|
|||
Defaults to false. If set to true, Composer will run the Bump command after running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be a string|bool that also accepts "no-dev" and "dev" as values to configure the *-only
flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suggestion sounds good. I'll wait until you come back and are able to take a deeper look. If you still feel this is the way to go, I'll modify the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please :) Definitely feel like this would be an improvement.
src/Composer/Command/BumpCommand.php
Outdated
bool $noDevOnly, | ||
bool $dryRun, | ||
array $packagesFilter, | ||
bool $calledFromUpdate = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unused and unnecessary?
|
||
if ($bumpAfterUpdate) { | ||
if ($result === 0) { | ||
$io->writeError('<info>Running Bump after Update.</info>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$io->writeError('<info>Running Bump after Update.</info>'); | |
$io->writeError('<info>Bumping dependencies</info>'); |
} else { | ||
$io->writeError('<warning>Not running Bump after Update because the update command did not finish successfully.</warning>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed.
} else { | |
$io->writeError('<warning>Not running Bump after Update because the update command did not finish successfully.</warning>'); |
0d9f1b9
to
1d13727
Compare
Hi @Seldaek, is there a reason why this GitHub pull request was not receive a (re)review the past four months? Has this perhaps been lost sight of? No rush, I saw other GitHub pull requests being reviewed/merged. So I was wondering how this works within your available time. Of course an answer of no time/priority is also completely valid. |
It's just targetting 2.8 and I was focused on shipping patch releases for 2.7 so far.. kinda buffering 2.8 PRs until I'm ready to work on those because once I branch it out then I need to merge 2.7 into 2.8 which is more work for me. |
Oh, thanks for this PR. I had spare time, and decided to try to fix my issue. And I totally miss your PR :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly found some minor wording style issues, and one minor edge case in the code, overall pretty solid PR thanks! And sorry for the delay :)
@@ -663,6 +663,10 @@ | |||
"type": ["boolean", "string"], | |||
"description": "Defaults to \"php-only\" which checks only the PHP version. Setting to true will also check the presence of required PHP extensions. If set to false, Composer will not create and require a platform_check.php file as part of the autoloader bootstrap." | |||
}, | |||
"bump-after-update": { | |||
"type": ["string", "boolean"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should use enum
to restrict the supported strings
Bumping dependencies | ||
<warning>Warning: Bumping dependency constraints is not recommended for libraries as it will narrow down your dependencies and may cause problems for your users.</warning> | ||
<warning>If your package is not a library, you can explicitly specify the "type" by using "composer config type project".</warning> | ||
<warning>Alternatively you can use --dev-only to only bump dependencies within "require-dev".</warning> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this --dev-only
option is confusing when running this as part of composer update
instead of composer bump
@@ -85,6 +85,7 @@ protected function configure() | |||
new InputOption('minimal-changes', 'm', InputOption::VALUE_NONE, 'During a partial update with -w/-W, only perform absolutely necessary changes to transitive dependencies (can also be set via the COMPOSER_MINIMAL_CHANGES=1 env var).'), | |||
new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'), | |||
new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'), | |||
new InputOption('bump-after-update', null, InputOption::VALUE_OPTIONAL, 'Runs bump after performing the update.', false, ['dev', 'no-dev', 'all']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using InputOption::VALUE_OPTIONAL
is confusing here, because it makes composer update --bump-after-update
valid during argument validation, but this would still make it use the default value (i.e. false
). This should probably be using VALUE_REQUIRED
instead.
bump-after-update
config parameterbump-after-update
option to the update commandIf the
bump-after-update
config parameter is set or thebump-after-update
option is passed to theupdate
command, it will run thebump
command after finishing the update. This command will only be run if the update finishes successfullyIf the config parameter or the option are set to
dev
orno-dev
then only the corresponding dependencies will be bumped.The
dry-run
option passed to theupdate
command will also be used for thebump
commandIf any packages are listed in the
update
command, this same package list will be used by thebump
command.Includes updates to the documentation and new tests
Fixes #11906