From 19b0cecfb7feaedd74d5fff1259db8d5669f1f79 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Fri, 30 Aug 2024 12:38:38 +0100 Subject: [PATCH 1/2] Alt implementation --- src/Commands/BuildCommand.php | 6 +++++- src/Commands/DevelopCommand.php | 5 ++++- src/Traits/InstallsAppIcon.php | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/Traits/InstallsAppIcon.php diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index 7732e692..369a3fa9 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -7,12 +7,14 @@ use Illuminate\Support\Str; use Native\Electron\Concerns\LocatesPhpBinary; use Native\Electron\Facades\Updater; +use Native\Electron\Traits\InstallsAppIcon; use Native\Electron\Traits\OsAndArch; class BuildCommand extends Command { use LocatesPhpBinary; use OsAndArch; + use InstallsAppIcon; protected $signature = 'native:build {os? : The operating system to build for (all, linux, mac, win)} @@ -40,13 +42,15 @@ public function handle(): void // Added checks for correct input for os and arch $os = $this->selectOs($this->argument('os')); + $this->installIcon(); + $buildCommand = 'build'; if ($os != 'all') { $arch = $this->selectArchitectureForOs($os, $this->argument('arch')); $os .= $arch != 'all' ? "-{$arch}" : ''; - // Wether to publish the app or not + // Should we publish? if ($publish = ($this->option('publish'))) { $buildCommand = 'publish'; } diff --git a/src/Commands/DevelopCommand.php b/src/Commands/DevelopCommand.php index ed6954d8..faa9f712 100644 --- a/src/Commands/DevelopCommand.php +++ b/src/Commands/DevelopCommand.php @@ -5,13 +5,14 @@ use Illuminate\Console\Command; use Native\Electron\Traits\Developer; use Native\Electron\Traits\Installer; +use Native\Electron\Traits\InstallsAppIcon; use function Laravel\Prompts\intro; use function Laravel\Prompts\note; class DevelopCommand extends Command { - use Developer, Installer; + use Developer, Installer, InstallsAppIcon; protected $signature = 'native:serve {--no-queue} {--D|no-dependencies} {--installer=npm}'; @@ -36,6 +37,8 @@ public function handle(): void $this->patchPackageJson(); + $this->installIcon(); + $this->runDeveloper(installer: $this->option('installer'), skip_queue: $this->option('no-queue')); } diff --git a/src/Traits/InstallsAppIcon.php b/src/Traits/InstallsAppIcon.php new file mode 100644 index 00000000..d8e18e57 --- /dev/null +++ b/src/Traits/InstallsAppIcon.php @@ -0,0 +1,20 @@ + Date: Fri, 30 Aug 2024 11:39:03 +0000 Subject: [PATCH 2/2] Fix styling --- src/Commands/BuildCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index 369a3fa9..4adce24a 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -12,9 +12,9 @@ class BuildCommand extends Command { + use InstallsAppIcon; use LocatesPhpBinary; use OsAndArch; - use InstallsAppIcon; protected $signature = 'native:build {os? : The operating system to build for (all, linux, mac, win)}