Skip to content

Commit d66320d

Browse files
simonhampgithub-actions[bot]
authored andcommitted
Fix styling
1 parent ab99e94 commit d66320d

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

src/Commands/BuildCommand.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@ public function handle(): void
4444
if ($os != 'all') {
4545
$arch = $this->selectArchitectureForOs($os, $this->argument('arch'));
4646

47-
$os .= $arch != 'all' ? "-{$arch}": '';
47+
$os .= $arch != 'all' ? "-{$arch}" : '';
4848

4949
// Wether to publish the app or not
50-
if ($publish = ($this->option('publish'))){
50+
if ($publish = ($this->option('publish'))) {
5151
$buildCommand = 'publish';
5252
}
5353
}
54-
$this->info((($publish ?? false) ? "Publishing" : 'Building') . " for {$os}");
55-
54+
$this->info((($publish ?? false) ? 'Publishing' : 'Building')." for {$os}");
5655

5756
Process::path(__DIR__.'/../../resources/js/')
5857
->env($this->getEnvironmentVariables())
@@ -83,5 +82,4 @@ protected function getEnvironmentVariables(): array
8382
Updater::environmentVariables(),
8483
);
8584
}
86-
8785
}

src/Commands/PublishCommand.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
use Native\Electron\Concerns\LocatesPhpBinary;
88
use Native\Electron\Traits\OsAndArch;
99

10-
use function Laravel\Prompts\select;
11-
1210
class PublishCommand extends Command
1311
{
1412
use LocatesPhpBinary;
@@ -18,7 +16,6 @@ class PublishCommand extends Command
1816
{os? : The operating system to build for (linux, mac, win)}
1917
{arch? : The Processor Architecture to build for (x64, x86, arm64)}';
2018

21-
2219
protected array $availableOs = ['win', 'linux', 'mac'];
2320

2421
public function handle(): void
@@ -29,6 +26,6 @@ public function handle(): void
2926

3027
$arch = $this->selectArchitectureForOs($os, $this->argument('arch'));
3128

32-
Artisan::call("native:build", ['os'=>$os, 'arch' => $arch, '--publish' => true], $this->output);
29+
Artisan::call('native:build', ['os' => $os, 'arch' => $arch, '--publish' => true], $this->output);
3330
}
3431
}

src/Traits/OsAndArch.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php
2-
namespace Native\Electron\Traits;
32

4-
use Illuminate\Support\Facades\Storage;
3+
namespace Native\Electron\Traits;
54

65
use function Laravel\Prompts\select;
7-
trait OsAndArch {
86

7+
trait OsAndArch
8+
{
99
// Available OS in Build and Publish commands
10-
protected function getAvailableOs(): array {
10+
protected function getAvailableOs(): array
11+
{
1112
return $this->availableOs;
1213
}
1314

@@ -21,7 +22,8 @@ protected function getDefaultOs(): string
2122
};
2223
}
2324

24-
protected function selectOs(string|null $os): string {
25+
protected function selectOs(?string $os): string
26+
{
2527
$os = $os ?? false;
2628
if (! in_array($this->argument('os'), $this->getAvailableOs()) || ! $os) {
2729
$os = select(
@@ -30,6 +32,7 @@ protected function selectOs(string|null $os): string {
3032
default: $this->getDefaultOs(),
3133
);
3234
}
35+
3336
return $os;
3437
}
3538

@@ -38,25 +41,29 @@ protected function selectOs(string|null $os): string {
3841
*
3942
* Make this dynamic at some point
4043
*/
41-
protected function getArchitectureForOs(string $os): array {
44+
protected function getArchitectureForOs(string $os): array
45+
{
4246
$archs = match ($os) {
4347
'win' => ['x64'],
4448
'mac' => ['x86', 'arm64'],
4549
'linux' => ['x64']
4650
};
51+
4752
return [...$archs, 'all'];
4853
}
4954

5055
// Depends on the currenty available php executables
51-
protected function selectArchitectureForOs(string $os, string|null $arch): string {
56+
protected function selectArchitectureForOs(string $os, ?string $arch): string
57+
{
5258
$arch = $arch ?? false;
53-
if (!in_array($this->argument('arch'), ($a = $this->getArchitectureForOs($os))) || ! $arch) {
59+
if (! in_array($this->argument('arch'), ($a = $this->getArchitectureForOs($os))) || ! $arch) {
5460
$arch = select(
5561
label: 'Please select Processor Architecture',
5662
options: $a,
5763
default: 'all'
5864
);
5965
}
66+
6067
return $arch;
6168
}
6269
}

0 commit comments

Comments
 (0)