4
4
5
5
use Illuminate \Console \Command ;
6
6
use Native \Electron \Traits \CleansEnvFile ;
7
- use Native \Laravel \NativeServiceProvider ;
8
7
use Symfony \Component \Finder \Finder ;
9
8
use ZipArchive ;
10
9
@@ -17,14 +16,16 @@ class BundleCommand extends Command
17
16
protected $ description = 'Bundle your application for distribution. ' ;
18
17
19
18
private ?string $ key ;
19
+
20
20
private string $ zipPath ;
21
+
21
22
private string $ zipName ;
22
23
23
24
public function handle ()
24
25
{
25
26
$ this ->key = config ('nativephp-internal.zephpyr.key ' );
26
27
27
- if (!$ this ->key ) {
28
+ if (! $ this ->key ) {
28
29
$ this ->line ('' );
29
30
$ this ->warn ('No ZEPHPYR_SECRET found. Cannot bundle! ' );
30
31
$ this ->line ('' );
@@ -41,12 +42,14 @@ public function handle()
41
42
// Package the app up into a zip
42
43
if (! $ this ->zipApplication ()) {
43
44
$ this ->error ("Failed to create zip archive at {$ this ->zipPath }. " );
45
+
44
46
return static ::FAILURE ;
45
47
}
46
48
47
49
// Send the zip file
48
50
if (! $ this ->sendToZephpyr ()) {
49
51
$ this ->error ("Failed to upload zip [ {$ this ->zipPath }] to Zephpyr. " );
52
+
50
53
return static ::FAILURE ;
51
54
}
52
55
@@ -55,7 +58,7 @@ public function handle()
55
58
56
59
private function zipApplication (): bool
57
60
{
58
- $ this ->zipName = 'app_ ' . str ()->random (8 ) . '.zip ' ;
61
+ $ this ->zipName = 'app_ ' . str ()->random (8 ). '.zip ' ;
59
62
$ this ->zipPath = storage_path ($ this ->zipName );
60
63
61
64
$ zip = new ZipArchive ;
@@ -77,7 +80,7 @@ private function zipApplication(): bool
77
80
78
81
private function addFilesToZip (ZipArchive $ zip ): void
79
82
{
80
- $ app = (new Finder () )->files ()
83
+ $ app = (new Finder )->files ()
81
84
->followLinks ()
82
85
->ignoreVCSIgnored (true )
83
86
->in (base_path ())
@@ -88,20 +91,20 @@ private function addFilesToZip(ZipArchive $zip): void
88
91
89
92
$ this ->finderToZip ($ app , $ zip );
90
93
91
- $ vendor = (new Finder () )->files ()
94
+ $ vendor = (new Finder )->files ()
92
95
->exclude ([
93
96
'vendor/nativephp/php-bin ' ,
94
97
])
95
98
->in (base_path ('vendor ' ));
96
99
97
100
$ this ->finderToZip ($ vendor , $ zip );
98
101
99
- $ nodeModules = (new Finder () )->files ()
102
+ $ nodeModules = (new Finder )->files ()
100
103
->in (base_path ('node_modules ' ));
101
104
102
105
$ this ->finderToZip ($ nodeModules , $ zip );
103
106
104
- $ env = (new Finder () )->files ()
107
+ $ env = (new Finder )->files ()
105
108
->ignoreDotFiles (false )
106
109
->name ('.env ' )
107
110
->in (base_path ());
0 commit comments