@@ -12,7 +12,7 @@ class PublishCommand extends Command
12
12
{
13
13
use LocatesPhpBinary;
14
14
15
- protected $ signature = 'native:publish {os=all : The operating system to build for (all, linux, mac, windows )} ' ;
15
+ protected $ signature = 'native:publish {os? : The operating system to build for (linux, mac, win )} ' ;
16
16
17
17
public function handle (): void
18
18
{
@@ -30,16 +30,19 @@ public function handle(): void
30
30
echo $ output ;
31
31
});
32
32
33
- $ buildCommand = 'npm run build ' ;
34
- if ($ this ->argument ('os ' )) {
35
- $ buildCommand .= ': ' .$ this ->argument ('os ' );
33
+ if (! $ os = $ this ->argument ('os ' )) {
34
+ $ os = select (
35
+ label: 'Please select the operating system to build for ' ,
36
+ options: ['win ' , 'linux ' , 'mac ' , 'all ' ],
37
+ default: $ this ->getDefaultOs (),
38
+ );
36
39
}
37
40
38
41
Process::path (__DIR__ .'/../../resources/js/ ' )
39
42
->env ($ this ->getEnvironmentVariables ())
40
43
->forever ()
41
44
->tty (PHP_OS_FAMILY != 'Windows ' && ! $ this ->option ('no-interaction ' ))
42
- ->run ($ buildCommand , function (string $ type , string $ output ) {
45
+ ->run (" npm run publish: { $ os }" , function (string $ type , string $ output ) {
43
46
echo $ output ;
44
47
});
45
48
}
@@ -62,4 +65,14 @@ protected function getEnvironmentVariables(): array
62
65
Updater::environmentVariables (),
63
66
);
64
67
}
68
+
69
+ protected function getDefaultOs (): string
70
+ {
71
+ return match (PHP_OS_FAMILY ) {
72
+ 'Windows ' => 'win ' ,
73
+ 'Darwin ' => 'mac ' ,
74
+ 'Linux ' => 'linux ' ,
75
+ default => 'all ' ,
76
+ };
77
+ }
65
78
}
0 commit comments