Skip to content

Commit 1a26bb5

Browse files
authored
Merge pull request #4 from Kocal/fix/enable-tty-if-supported
2 parents 05af236 + 02a2413 commit 1a26bb5

File tree

5 files changed

+65
-11
lines changed

5 files changed

+65
-11
lines changed

.github/workflows/ci.yaml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,55 @@ jobs:
9999
run: symfony php vendor/bin/phpstan analyze
100100

101101
- name: Run PHPUnit
102-
run: symfony php vendor/bin/phpunit
102+
run: symfony php vendor/bin/phpunit
103+
104+
e2e:
105+
name: E2E
106+
runs-on: ubuntu-latest
107+
steps:
108+
- uses: actions/checkout@v4
109+
110+
- name: Install PHP
111+
uses: shivammathur/setup-php@v2
112+
with:
113+
php-version: 8.2
114+
tools: symfony-cli
115+
116+
- name: Install Composer dependencies
117+
run: symfony composer install --prefer-dist --no-interaction --no-progress
118+
119+
- name: Create a new Symfony project and install kocal/biome-js-bundle
120+
run: |
121+
git config --global user.email "[email protected]"
122+
git config --global user.name "Hugo Alliaume"
123+
symfony new my_app --webapp
124+
cd my_app
125+
symfony composer config minimum-stability dev
126+
symfony composer config repositories.biome-js-bundle '{"type":"path", "url":"../","options":{"symlink":true}}'
127+
symfony composer require 'kocal/biome-js-bundle:*' --dev
128+
cat << EOF > biome.json
129+
{
130+
"files": {
131+
"ignore": [
132+
"composer.json",
133+
"assets/vendor/*",
134+
"vendor/*",
135+
"public/bundles/*"
136+
]
137+
}
138+
}
139+
EOF
140+
141+
- name: Run Biome CI, which should fails
142+
run: symfony console biome:ci .
143+
continue-on-error: true
144+
working-directory: my_app
145+
146+
- name: Run Biome Check, and apply fixes
147+
run: symfony console biome:check . --apply
148+
working-directory: my_app
149+
150+
- name: Run Biome CI, which should now pass
151+
run: symfony console biome:ci .
152+
working-directory: my_app
153+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/vendor/
22
composer.lock
33
.phpunit.result.cache
4+
5+
my_app/

config/services.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
use Kocal\BiomeJsBundle\Command\BiomeJsCheckCommand;
66
use Kocal\BiomeJsBundle\Command\BiomeJsCiCommand;
77
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
8+
use Symfony\Component\Process\Process;
89
use function Symfony\Component\DependencyInjection\Loader\Configurator\abstract_arg;
910
use function Symfony\Component\DependencyInjection\Loader\Configurator\param;
1011
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
1112

1213
return static function (ContainerConfigurator $container): void {
1314
$container->parameters()
1415
// Internal parameter to enable/disable TTY mode, useful for tests (if someone has a better idea, feel free to suggest it!)
15-
->set('biomejs.use_tty', true)
16+
->set('biomejs.use_tty', Process::isTtySupported())
1617
;
1718

1819
$container->services()
@@ -40,4 +41,4 @@
4041
service('biomejs'),
4142
])
4243
->tag('console.command');
43-
};
44+
};

src/BiomeJs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct(
1717
) {
1818
}
1919

20-
public function setOutput(SymfonyStyle|null $output): void
20+
public function setOutput(?SymfonyStyle $output): void
2121
{
2222
$this->output = $output;
2323
}
@@ -33,7 +33,7 @@ public function check(
3333
bool $organizeImportsEnabled,
3434
bool $staged,
3535
bool $changed,
36-
string|null $since,
36+
?string $since,
3737
array $path,
3838
): Process {
3939
$arguments = [];
@@ -81,7 +81,7 @@ public function ci(
8181
bool $linterEnabled,
8282
bool $organizeImportsEnabled,
8383
bool $changed,
84-
string|null $since,
84+
?string $since,
8585
array $path,
8686
): Process {
8787
$arguments = [];

src/BiomeJsBinary.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111

1212
final class BiomeJsBinary
1313
{
14-
private SymfonyStyle|null $output = null;
14+
private ?SymfonyStyle $output = null;
1515
private HttpClientInterface $httpClient;
16-
private string|null $cachedVersion = null;
16+
private ?string $cachedVersion = null;
1717

1818
public function __construct(
1919
private readonly string $cwd,
2020
private readonly string $binaryDownloadDir,
21-
private readonly string|null $binaryVersion,
22-
HttpClientInterface|null $httpClient = null,
21+
private readonly ?string $binaryVersion,
22+
?HttpClientInterface $httpClient = null,
2323
) {
2424
$this->httpClient = $httpClient ?? HttpClient::create();
2525
}
2626

27-
public function setOutput(SymfonyStyle|null $output): void
27+
public function setOutput(?SymfonyStyle $output): void
2828
{
2929
$this->output = $output;
3030
}

0 commit comments

Comments
 (0)