|
1 | 1 | #!/usr/bin/env php
|
2 | 2 | <?php
|
3 | 3 |
|
| 4 | +/* |
| 5 | + * This file is part of the Symfony package. |
| 6 | + * |
| 7 | + * (c) Fabien Potencier <[email protected]> |
| 8 | + * |
| 9 | + * For the full copyright and license information, please view the LICENSE |
| 10 | + * file that was distributed with this source code. |
| 11 | + */ |
| 12 | + |
4 | 13 | use Symfony\Component\Finder\Finder;
|
5 | 14 |
|
6 | 15 | require __DIR__.'/../vendor/autoload.php';
|
| 16 | + |
7 | 17 | $composerData = json_decode(file_get_contents(__DIR__.'/../composer.json'), true);
|
8 | 18 |
|
9 |
| -$finder = new Finder(); |
10 |
| -$finder->in(__DIR__.'/../../src') |
| 19 | +$packageDirectories = (new Finder()) |
| 20 | + ->in([ |
| 21 | + __DIR__.'/../../src', |
| 22 | + __DIR__.'/../../src/Map/src/Bridge', |
| 23 | + ]) |
11 | 24 | ->depth('== 0')
|
12 | 25 | ->directories();
|
13 | 26 |
|
14 |
| -$repositories = []; |
15 |
| -foreach ($finder as $packageDirectory) { |
16 |
| - $repositories[] = [ |
17 |
| - 'type' => 'path', |
18 |
| - 'url' => $packageDirectory->getRealPath() |
19 |
| - ]; |
20 |
| -} |
21 |
| -$composerData['repositories'] = $repositories; |
| 27 | +$composerData['repositories'] = array_map( |
| 28 | + fn ($directory) => ['type' => 'path', 'url' => $directory->getRealPath()], |
| 29 | + iterator_to_array($packageDirectories), |
| 30 | +); |
22 | 31 |
|
23 | 32 | foreach ($composerData['require'] as $package => $version) {
|
24 |
| - if (!str_starts_with($package, 'symfony/ux-')) { |
25 |
| - continue; |
| 33 | + if (str_starts_with($package, 'symfony/ux-') || 'symfony/stimulus-bundle' === $package) { |
| 34 | + $composerData['require'][$package] = '2.x-dev'; |
26 | 35 | }
|
27 |
| - |
28 |
| - $composerData['require'][$package] = '2.x-dev'; |
29 | 36 | }
|
30 | 37 |
|
31 |
| -file_put_contents(__DIR__.'/../composer.json', json_encode($composerData, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); |
32 |
| -echo "composer.json updatded to point to local UX packages\n"; |
33 |
| -echo "Run 'composer update' then 'yarn install --force'\n"; |
| 38 | +file_put_contents(__DIR__.'/../composer.json', json_encode($composerData, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); |
| 39 | + |
| 40 | +echo "composer.json updated to point to local UX packages\n\n"; |
| 41 | +echo "Run 'composer update'\n\n"; |
0 commit comments