Skip to content

Commit a1b8451

Browse files
committed
feat: update commands to latest version
1 parent 32a983b commit a1b8451

File tree

5 files changed

+20
-22
lines changed

5 files changed

+20
-22
lines changed

bin/leaf

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,14 @@ $app = sprout()->createApp([
2121
]);
2222

2323
// $app->register(Leaf\Console\CreateCommand::class);
24-
// $app->register(Leaf\Console\UpdateCommand::class);
25-
// $app->register(Leaf\Console\TestCommand::class);
26-
// $app->register(Leaf\Console\TestSetupCommand::class);
27-
// $app->register(Leaf\Console\InstallCommand::class);
28-
// $app->register(Leaf\Console\UninstallCommand::class);
29-
// $app->register(Leaf\Console\ServeCommand::class);
30-
// $app->register(Leaf\Console\DeployCommand::class);
24+
$app->register(Leaf\Console\UpdateCommand::class);
25+
$app->register(Leaf\Console\InstallCommand::class);
26+
$app->register(Leaf\Console\UninstallCommand::class);
27+
$app->register(Leaf\Console\ServeCommand::class);
3128
$app->register(Leaf\Console\InteractCommand::class);
32-
// $app->register(Leaf\Console\RunCommand::class);
33-
// $app->register(Leaf\Console\UICommand::class);
34-
// $app->register(Leaf\Console\ViewBuildCommand::class);
35-
// $app->register(Leaf\Console\ViewDevCommand::class);
29+
$app->register(Leaf\Console\RunCommand::class);
30+
$app->register(Leaf\Console\UICommand::class);
31+
$app->register(Leaf\Console\ViewBuildCommand::class);
3632
// $app->register(Leaf\Console\ViewInstallCommand::class);
3733

3834
$app->run();

src/ServeCommand.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ServeCommand extends Command
1111
protected $signature = 'serve
1212
{filename? : The PHP script to run}
1313
{--p|port=5500 : Port to run app on}
14-
{--nc|no-concurrent : Run PHP server without Vite server}';
14+
{--nc|no-concurrent? : Run PHP server without Vite server}';
1515

1616
protected $description = 'Run a server to serve your Leaf app';
1717

@@ -37,12 +37,13 @@ protected function handle(): int
3737

3838
$port = $this->option('port');
3939
$isDockerProject = file_exists(getcwd() . '/docker-compose.yml');
40-
$useConcurrent = !$this->option('no-concurrent') && file_exists(getcwd() . '/vite.config.js');
40+
$useConcurrent = !$this->option('no-concurrent') && (file_exists(getcwd() . '/vite.config.js') && file_exists(getcwd() . '/package.json'));
4141
$serveCommand = !$useConcurrent ? "php -S localhost:$port" : "npx concurrently -c \"#3eaf7c,#bd34fe\" \"php -S localhost:$port\" \"npm run dev\" --names=server,vite --colors";
4242

43-
return sprout()->process(
44-
$isDockerProject ? 'docker compose up' : $serveCommand
45-
)->run();
43+
return sprout()
44+
->process($isDockerProject ? 'docker compose up' : $serveCommand)
45+
->setTimeout(null)
46+
->run();
4647
}
4748

4849
protected function isMVCApp()

src/UICommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88

99
class UICommand extends Command
1010
{
11-
protected $signature = 'ui {--port=3001}';
11+
protected $signature = 'ui {--p|port=3001}';
1212

1313
protected $description = 'Open up the Leaf CLI GUI';
1414

1515
protected function execute(): int
1616
{
1717
$port = $this->option('port');
18+
1819
$uiDirectory = __DIR__ . '/ui/dist';
1920
$serveCommand = "cd $uiDirectory && php -S localhost:$port";
2021

src/UpdateCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class UpdateCommand extends Command
1414

1515
protected function handle(): int
1616
{
17-
if (sprout()->composer(true)->remove('cli --no-update --no-install')->isSuccessful()) {
17+
if (sprout()->composer(true)->remove('leafs/cli --no-update --no-install --ansi')->isSuccessful()) {
1818
sleep(1);
1919

20-
if (sprout()->composer(true)->install('cli')->isSuccessful()) {
20+
if (sprout()->composer(true)->install('leafs/cli --ansi')->isSuccessful()) {
2121
$this->writeln('<info>Leaf CLI installed successfully!</info>');
2222
return 0;
2323
}

src/ViewBuildCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ class ViewBuildCommand extends Command
1212

1313
protected $description = 'Build your frontend assets';
1414

15-
protected function execute(): int
15+
protected function handle(): int
1616
{
17-
if (!sprout()->npm($this->option('pm'))->json()) {
17+
if (!sprout()->npm()->json()) {
1818
$this->writeln('<error>No package.json found in the current directory.</error>');
1919
return 1;
2020
}
2121

22-
if (!sprout()->npm($this->option('pm'))->hasDependencies()) {
22+
if (!sprout()->npm()->hasDependencies()) {
2323
$this->writeln('<info>Installing dependencies...</info>');
2424

2525
if (!sprout()->npm($this->option('pm'))->install()->isSuccessful()) {

0 commit comments

Comments
 (0)