Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bbb41b0
scaffolded
joetannenbaum Jun 5, 2026
cb4f2eb
default command, except, only
joetannenbaum Jun 5, 2026
a1063a4
clear
joetannenbaum Jun 5, 2026
f9f957b
Update DevCommands.php
joetannenbaum Jun 5, 2026
0c6fb4b
first real pass at vendor prevention
joetannenbaum Jun 5, 2026
b42b98f
Update DevCommands.php
joetannenbaum Jun 5, 2026
8030780
Update DevCommands.php
joetannenbaum Jun 5, 2026
828814a
doc blocks
joetannenbaum Jun 5, 2026
4fdbdf6
Update DevCommands.php
joetannenbaum Jun 5, 2026
960112f
small fixes
joetannenbaum Jun 5, 2026
ddd625a
fixes
joetannenbaum Jun 5, 2026
a1f54da
better method names
joetannenbaum Jun 5, 2026
3b798a9
Update NodePackageManager.php
joetannenbaum Jun 5, 2026
6f6e47e
tests
joetannenbaum Jun 5, 2026
fa562eb
Update DevCommand.php
joetannenbaum Jun 5, 2026
8413dc4
pint
joetannenbaum Jun 5, 2026
fb87a90
Update FoundationDevCommandsTest.php
joetannenbaum Jun 5, 2026
1d7f0ad
Update SupportNodePackageManagerTest.php
joetannenbaum Jun 5, 2026
82d888b
colors -> enum
joetannenbaum Jun 5, 2026
437dfd8
Update DevCommand.php
joetannenbaum Jun 5, 2026
60d69e1
strstr instead of collect
joetannenbaum Jun 5, 2026
30e5aa4
Update src/Illuminate/Foundation/DevCommand.php
joetannenbaum Jun 5, 2026
dcec89e
Update src/Illuminate/Foundation/DevCommands.php
joetannenbaum Jun 5, 2026
023d952
use new color enum
joetannenbaum Jun 5, 2026
bb5bc73
Merge branch 'composer-dev-process' of github.com:laravel/framework i…
joetannenbaum Jun 5, 2026
f4b748b
Update DevCommand.php
joetannenbaum Jun 5, 2026
6770f5e
Update DevCommand.php
joetannenbaum Jun 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions src/Illuminate/Foundation/Console/DevCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

namespace Illuminate\Foundation\Console;

use Illuminate\Console\Command;
use Illuminate\Foundation\DevCommands;
use Illuminate\Support\NodePackageManager;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'dev')]
class DevCommand extends Command
Comment thread
joetannenbaum marked this conversation as resolved.
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'dev';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Run the dev processes';

/**
* Execute the console command.
*
* @return int
*
* @throws \Exception
*/
public function handle(NodePackageManager $packageManager)
{
$devCommands = DevCommands::commands();

$commands = array_column($devCommands, 'command');
$colors = array_column($devCommands, 'color');
$names = array_column($devCommands, 'name');

$longestName = max(array_map('strlen', $names));
Comment thread
joetannenbaum marked this conversation as resolved.
Outdated

$this->line('');

foreach ($devCommands as $devCommand) {
$this->line(
sprintf(
'<fg=%s>[%s]</>%s<fg=#888888>%s</>',
$devCommand['color'],
$devCommand['name'],
str_repeat(' ', ($longestName - strlen($devCommand['name'])) + 1),
$devCommand['command'],
),
);
}

$this->line('');

$command = $packageManager->getExecCommand(sprintf(
'concurrently -c "%s" "%s" --names=%s --kill-others',
implode(',', $colors),
implode('" "', $commands),
implode(',', $names)
));

if (extension_loaded('pcntl')) {
pcntl_exec('/usr/bin/env', ['sh', '-c', $command]);
}

passthru($command, $exitCode);

return $exitCode;
}
}
164 changes: 164 additions & 0 deletions src/Illuminate/Foundation/DevCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
<?php

namespace Illuminate\Foundation;

class DevCommand
{
/**
* Blue color.
*
* @var string
*/
public const BLUE = '#93c5fd';

/**
* Purple color.
*
* @var string
*/
public const PURPLE = '#c4b5fd';

/**
* Pink color.
*
* @var string
*/
public const PINK = '#fb7185';

/**
* Orange color.
*
* @var string
*/
public const ORANGE = '#fdba74';

/**
* Green color.
*
* @var string
*/
public const GREEN = '#86efac';

/**
* Yellow color.
*
* @var string
*/
public const YELLOW = '#fcd34d';
Comment thread
joetannenbaum marked this conversation as resolved.
Outdated

/**
* Color of the command when output to the console.
*
* @var string|null
*/
protected ?string $color = null;

/**
* Create a new DevCommand instance.
*
* @param string $command
* @param string|null $name
* @return void
*/
public function __construct(protected string $command, protected ?string $name = null)
{
$this->name ??= collect(explode(' ', $command))->first();
Comment thread
joetannenbaum marked this conversation as resolved.
Outdated
}

/**
* Get the command name.
*
* @return string
*/
public function name(): string
{
return $this->name;
}

/**
* Set the command color.
*
* @param string $color
* @return self
*/
public function color(string $color): self
{
$this->color = $color;

return $this;
}

/**
* Set the command color to blue.
*
* @return self
*/
public function blue(): self
{
return $this->color(self::BLUE);
}

/**
* Set the command color to purple.
*
* @return self
*/
public function purple(): self
{
return $this->color(self::PURPLE);
}

/**
* Set the command color to pink.
*
* @return self
*/
public function pink(): self
{
return $this->color(self::PINK);
}

/**
* Set the command color to orange.
*
* @return self
*/
public function orange(): self
{
return $this->color(self::ORANGE);
}

/**
* Set the command color to green.
*
* @return self
*/
public function green(): self
{
return $this->color(self::GREEN);
}

/**
* Set the command color to yellow.
*
* @return self
*/
public function yellow(): self
{
return $this->color(self::YELLOW);
}

/**
* Get the command as an array.
*
* @return array
Comment thread
joetannenbaum marked this conversation as resolved.
Outdated
*/
public function toArray(): array
{
return [
'command' => $this->command,
'name' => $this->name,
'color' => $this->color,
];
}
}
Loading