Skip to content

Commit 75054e7

Browse files
committed
minor #2310 [Site] Update bin/link-locally (smnandre)
This PR was merged into the 2.x branch. Discussion ---------- [Site] Update `bin/link-locally` Add missing packages * stimulus-bundle * ux-map bridges Remove yarn evocation Commits ------- 82b31f7 [Site] Update `bin/link-locally`
2 parents ed3dc44 + 82b31f7 commit 75054e7

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

ux.symfony.com/bin/link-locally

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
11
#!/usr/bin/env php
22
<?php
33

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+
413
use Symfony\Component\Finder\Finder;
514

615
require __DIR__.'/../vendor/autoload.php';
16+
717
$composerData = json_decode(file_get_contents(__DIR__.'/../composer.json'), true);
818

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+
])
1124
->depth('== 0')
1225
->directories();
1326

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+
);
2231

2332
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';
2635
}
27-
28-
$composerData['require'][$package] = '2.x-dev';
2936
}
3037

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

Comments
 (0)