Skip to content

Commit 094f218

Browse files
committed
patching LiveComponents to use "in-repo" TwigComponent
Later, we can make this more sophisticated, like symfony/symfony
1 parent 59647bb commit 094f218

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

.github/build-packages.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
$dir = __DIR__.'/../src/LiveComponent';
4+
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
5+
6+
$json = ltrim(file_get_contents($dir.'/composer.json'));
7+
if (null === $package = json_decode($json)) {
8+
passthru("composer validate $dir/composer.json");
9+
exit(1);
10+
}
11+
12+
$package->repositories[] = [
13+
'type' => 'path',
14+
'url' => '../TwigComponent',
15+
];
16+
17+
$json = preg_replace('/\n "repositories": \[\n.*?\n \],/s', '', $json);
18+
$json = rtrim(json_encode(['repositories' => $package->repositories], $flags), "\n}").','.substr($json, 1);
19+
file_put_contents('composer.json', $json);
20+

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
php vendor/bin/simple-phpunit
6262
- name: LiveComponent
6363
run: |
64+
php .github/build-packages.php
6465
cd src/LiveComponent
6566
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
6667
php vendor/bin/simple-phpunit
@@ -104,6 +105,7 @@ jobs:
104105
php vendor/bin/simple-phpunit
105106
- name: LiveComponent
106107
run: |
108+
php .github/build-packages.php
107109
cd src/LiveComponent
108110
composer config platform.php 7.4.99
109111
composer update --prefer-dist --no-interaction --no-ansi --no-progress

src/LiveComponent/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@
5050
"name": "symfony/ux",
5151
"url": "https://github.com/symfony/ux"
5252
}
53-
}
53+
},
54+
"minimum-stability": "dev"
5455
}

src/TwigComponent/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@
4747
"name": "symfony/ux",
4848
"url": "https://github.com/symfony/ux"
4949
}
50-
}
50+
},
51+
"minimum-stability": "dev"
5152
}

0 commit comments

Comments
 (0)