From 82b31f708178b6605c2f6314863a25c520ddcde5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Thu, 31 Oct 2024 01:16:58 +0100 Subject: [PATCH] [Site] Update `bin/link-locally` Add missing packages * stimulus-bundle * ux-map bridges Remove yarn evocation --- ux.symfony.com/bin/link-locally | 42 ++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/ux.symfony.com/bin/link-locally b/ux.symfony.com/bin/link-locally index 300e9d17c5c..83b7a07622a 100644 --- a/ux.symfony.com/bin/link-locally +++ b/ux.symfony.com/bin/link-locally @@ -1,33 +1,41 @@ #!/usr/bin/env php + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Symfony\Component\Finder\Finder; require __DIR__.'/../vendor/autoload.php'; + $composerData = json_decode(file_get_contents(__DIR__.'/../composer.json'), true); -$finder = new Finder(); -$finder->in(__DIR__.'/../../src') +$packageDirectories = (new Finder()) + ->in([ + __DIR__.'/../../src', + __DIR__.'/../../src/Map/src/Bridge', + ]) ->depth('== 0') ->directories(); -$repositories = []; -foreach ($finder as $packageDirectory) { - $repositories[] = [ - 'type' => 'path', - 'url' => $packageDirectory->getRealPath() - ]; -} -$composerData['repositories'] = $repositories; +$composerData['repositories'] = array_map( + fn ($directory) => ['type' => 'path', 'url' => $directory->getRealPath()], + iterator_to_array($packageDirectories), +); foreach ($composerData['require'] as $package => $version) { - if (!str_starts_with($package, 'symfony/ux-')) { - continue; + if (str_starts_with($package, 'symfony/ux-') || 'symfony/stimulus-bundle' === $package) { + $composerData['require'][$package] = '2.x-dev'; } - - $composerData['require'][$package] = '2.x-dev'; } -file_put_contents(__DIR__.'/../composer.json', json_encode($composerData, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); -echo "composer.json updatded to point to local UX packages\n"; -echo "Run 'composer update' then 'yarn install --force'\n"; +file_put_contents(__DIR__.'/../composer.json', json_encode($composerData, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); + +echo "composer.json updated to point to local UX packages\n\n"; +echo "Run 'composer update'\n\n";