From d4a61dc0926405badb4e0f8978523cdf786e175f Mon Sep 17 00:00:00 2001 From: Sjors Smits Date: Mon, 16 Oct 2023 17:30:33 +0200 Subject: [PATCH 1/2] Add option for using the bun js runtime --- src/Commands/StartSsr.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Commands/StartSsr.php b/src/Commands/StartSsr.php index e2b5d84b..8857cd84 100644 --- a/src/Commands/StartSsr.php +++ b/src/Commands/StartSsr.php @@ -14,7 +14,7 @@ class StartSsr extends Command * * @var string */ - protected $name = 'inertia:start-ssr'; + protected $signature = 'inertia:start-ssr {--runtime=node}'; /** * The console command description. @@ -50,9 +50,16 @@ public function handle(): int $this->warn('Using a default bundle instead: "'.$bundle.'"'); } + $runtime = $this->option('runtime'); + + if (! in_array($runtime, ['node', 'bun'])) { + $this->error('Unsupported runtime "'.$runtime.'". Supported runtimes are node and bun.'); + return self::INVALID; + } + $this->callSilently('inertia:stop-ssr'); - $process = new Process(['node', $bundle]); + $process = new Process([$runtime, $bundle]); $process->setTimeout(null); $process->start(); From 5c794ea0852240c489ca297f1fbbef8ae431d7bf Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Thu, 26 Oct 2023 20:02:24 -0400 Subject: [PATCH 2/2] Tweak wording --- src/Commands/StartSsr.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Commands/StartSsr.php b/src/Commands/StartSsr.php index 8857cd84..a065b198 100644 --- a/src/Commands/StartSsr.php +++ b/src/Commands/StartSsr.php @@ -14,7 +14,7 @@ class StartSsr extends Command * * @var string */ - protected $signature = 'inertia:start-ssr {--runtime=node}'; + protected $signature = 'inertia:start-ssr {--runtime=node : The runtime to use (`node` or `bun`)}'; /** * The console command description. @@ -53,7 +53,8 @@ public function handle(): int $runtime = $this->option('runtime'); if (! in_array($runtime, ['node', 'bun'])) { - $this->error('Unsupported runtime "'.$runtime.'". Supported runtimes are node and bun.'); + $this->error('Unsupported runtime: "'.$runtime.'". Supported runtimes are `node` and `bun`.'); + return self::INVALID; }