Skip to content

Commit 7c4b0a8

Browse files
committed
cs
1 parent 69f5f0d commit 7c4b0a8

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ This command opens up 5 versions to their next nearest step, e.g.:
104104
"require": {
105105
"php": "^7.4",
106106
- "symfony/console": "5.1.*"
107-
+ "symfony/console": "5.2.*|5.2.*"
107+
+ "symfony/console": "5.1.*|5.2.*"
108108
},
109109
"require-dev": {
110110
- "phpunit/phpunit": "^9.0"
@@ -132,6 +132,14 @@ vendor/bin/jack open-versions --limit 3
132132

133133
<br>
134134

135+
To upgrade only specific group of packages, use ``--package-prefix` option:
136+
137+
```bash
138+
vendor/bin/jack open-versions --package-prefix symfony
139+
```
140+
141+
<br>
142+
135143
To preview changes without modifying `composer.json`, use:
136144

137145
```bash

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"composer/semver": "^3.4",
1111
"illuminate/container": "^12.0",
1212
"nette/utils": "^4.0",
13-
"symfony/console": "^6.4",
13+
^6.4|7.0.*,
1414
"symfony/finder": "^7.2",
1515
"symfony/process": "^7.2",
1616
"webmozart/assert": "^1.11"
@@ -65,3 +65,6 @@
6565
}
6666
}
6767

68+
69+
70+

src/Command/OpenVersionsCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8888
$limit = (int) $input->getOption('limit');
8989
$isDryRun = (bool) $input->getOption('dry-run');
9090
$onlyDev = (bool) $input->getOption('dev');
91+
$packagePrefix = $input->getOption('package-prefix');
9192

9293
$composerJsonContents = FileSystem::read($composerJsonFilePath);
9394

94-
$outdatedPackages = $outdatedComposer->getPackagesShuffled($onlyDev);
95+
$outdatedPackages = $outdatedComposer->getPackagesShuffled($onlyDev, $packagePrefix);
9596

9697
$openedPackageCount = 0;
9798
foreach ($outdatedPackages as $outdatedPackage) {

src/ValueObject/OutdatedComposer.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,22 @@ public function getPackages(bool $onlyDev = false): array
6464
/**
6565
* @return OutdatedPackage[]
6666
*/
67-
public function getPackagesShuffled(bool $onlyDev = false): array
67+
public function getPackagesShuffled(bool $onlyDev, ?string $packagePrefix): array
6868
{
6969
// adds random effect, not to always update by A-Z, as would force too narrow pattern
7070
// this is also more fun :)
7171
$outdatedPackages = $onlyDev ? $this->getDevPackages() : $this->outdatedPackages;
7272

7373
shuffle($outdatedPackages);
7474

75+
// filter only package starting with specific prefix
76+
if ($packagePrefix !== null) {
77+
$outdatedPackages = array_filter(
78+
$outdatedPackages,
79+
fn (OutdatedPackage $outdatedPackage): bool => str_starts_with($outdatedPackage->getName(), $packagePrefix)
80+
);
81+
}
82+
7583
return $outdatedPackages;
7684
}
7785
}

0 commit comments

Comments
 (0)