44
55use Illuminate \Console \Command ;
66use Native \Electron \Traits \CleansEnvFile ;
7- use Native \Laravel \NativeServiceProvider ;
87use Symfony \Component \Finder \Finder ;
98use ZipArchive ;
109
@@ -17,14 +16,16 @@ class BundleCommand extends Command
1716 protected $ description = 'Bundle your application for distribution. ' ;
1817
1918 private ?string $ key ;
19+
2020 private string $ zipPath ;
21+
2122 private string $ zipName ;
2223
2324 public function handle ()
2425 {
2526 $ this ->key = config ('nativephp-internal.zephpyr.key ' );
2627
27- if (!$ this ->key ) {
28+ if (! $ this ->key ) {
2829 $ this ->line ('' );
2930 $ this ->warn ('No ZEPHPYR_SECRET found. Cannot bundle! ' );
3031 $ this ->line ('' );
@@ -41,12 +42,14 @@ public function handle()
4142 // Package the app up into a zip
4243 if (! $ this ->zipApplication ()) {
4344 $ this ->error ("Failed to create zip archive at {$ this ->zipPath }. " );
45+
4446 return static ::FAILURE ;
4547 }
4648
4749 // Send the zip file
4850 if (! $ this ->sendToZephpyr ()) {
4951 $ this ->error ("Failed to upload zip [ {$ this ->zipPath }] to Zephpyr. " );
52+
5053 return static ::FAILURE ;
5154 }
5255
@@ -55,7 +58,7 @@ public function handle()
5558
5659 private function zipApplication (): bool
5760 {
58- $ this ->zipName = 'app_ ' . str ()->random (8 ) . '.zip ' ;
61+ $ this ->zipName = 'app_ ' . str ()->random (8 ). '.zip ' ;
5962 $ this ->zipPath = storage_path ($ this ->zipName );
6063
6164 $ zip = new ZipArchive ;
@@ -77,7 +80,7 @@ private function zipApplication(): bool
7780
7881 private function addFilesToZip (ZipArchive $ zip ): void
7982 {
80- $ app = (new Finder () )->files ()
83+ $ app = (new Finder )->files ()
8184 ->followLinks ()
8285 ->ignoreVCSIgnored (true )
8386 ->in (base_path ())
@@ -88,20 +91,20 @@ private function addFilesToZip(ZipArchive $zip): void
8891
8992 $ this ->finderToZip ($ app , $ zip );
9093
91- $ vendor = (new Finder () )->files ()
94+ $ vendor = (new Finder )->files ()
9295 ->exclude ([
9396 'vendor/nativephp/php-bin ' ,
9497 ])
9598 ->in (base_path ('vendor ' ));
9699
97100 $ this ->finderToZip ($ vendor , $ zip );
98101
99- $ nodeModules = (new Finder () )->files ()
102+ $ nodeModules = (new Finder )->files ()
100103 ->in (base_path ('node_modules ' ));
101104
102105 $ this ->finderToZip ($ nodeModules , $ zip );
103106
104- $ env = (new Finder () )->files ()
107+ $ env = (new Finder )->files ()
105108 ->ignoreDotFiles (false )
106109 ->name ('.env ' )
107110 ->in (base_path ());
0 commit comments