Skip to content

Commit

Permalink
Merge pull request #2017 from hydephp/shorter-server-start-message
Browse files Browse the repository at this point in the history
Shorten the realtime compiler server start message
  • Loading branch information
caendesilva authored Nov 12, 2024
2 parents 25413d0 + a0bf7ad commit 4e3cd4d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This serves two purposes:
- Updated to HydeFront v3.4 in https://github.com/hydephp/develop/pull/1803
- Realtime Compiler: Virtual routes are now managed through the service container in https://github.com/hydephp/develop/pull/1858
- Realtime Compiler: Improved the dashboard layout in https://github.com/hydephp/develop/pull/1866
- Realtime Compiler: Shorten the realtime compiler server start message from "Press Ctrl+C to stop" to "Use Ctrl+C to stop" to better fit 80 column terminals in https://github.com/hydephp/develop/pull/2017

### Deprecated
- The `PostAuthor::getName()` method is now deprecated and will be removed in v2. (use `$author->name` instead) in https://github.com/hydephp/develop/pull/1794
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/src/Console/Commands/ServeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function configureOutput(): void
protected function printStartMessage(): void
{
$this->useBasicOutput()
? $this->output->writeln('<info>Starting the HydeRC server...</info> Press Ctrl+C to stop')
? $this->output->writeln('<info>Starting the HydeRC server...</info> Use Ctrl+C to stop')
: $this->console->printStartMessage($this->getHostSelection(), $this->getPortSelection(), $this->getEnvironmentVariables());
}

Expand Down
24 changes: 12 additions & 12 deletions packages/framework/tests/Feature/Commands/ServeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
public function testHydeServeCommand()
{
$this->artisan('serve --no-ansi')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S localhost:8080 {$this->binaryPath()}");
Expand All @@ -36,7 +36,7 @@ public function testHydeServeCommand()
public function testHydeServeCommandWithPortOption()
{
$this->artisan('serve --no-ansi --port=8081')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S localhost:8081 {$this->binaryPath()}");
Expand All @@ -45,7 +45,7 @@ public function testHydeServeCommandWithPortOption()
public function testHydeServeCommandWithHostOption()
{
$this->artisan('serve --no-ansi --host=foo')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S foo:8080 {$this->binaryPath()}");
Expand All @@ -54,7 +54,7 @@ public function testHydeServeCommandWithHostOption()
public function testHydeServeCommandWithPortAndHostOption()
{
$this->artisan('serve --no-ansi --port=8081 --host=foo')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S foo:8081 {$this->binaryPath()}");
Expand All @@ -65,7 +65,7 @@ public function testHydeServeCommandWithPortDefinedInConfig()
config(['hyde.server.port' => 8081]);

$this->artisan('serve --no-ansi')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S localhost:8081 {$this->binaryPath()}");
Expand All @@ -76,7 +76,7 @@ public function testHydeServeCommandWithPortDefinedInConfigAndPortOption()
config(['hyde.server.port' => 8081]);

$this->artisan('serve --no-ansi --port=8082')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S localhost:8082 {$this->binaryPath()}");
Expand All @@ -87,7 +87,7 @@ public function testHydeServeCommandWithPortMissingInConfigAndPortOption()
config(['hyde.server.port' => null]);

$this->artisan('serve --no-ansi --port=8081')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S localhost:8081 {$this->binaryPath()}");
Expand All @@ -98,7 +98,7 @@ public function testHydeServeCommandWithHostDefinedInConfig()
config(['hyde.server.host' => 'foo']);

$this->artisan('serve --no-ansi')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S foo:8080 {$this->binaryPath()}");
Expand All @@ -109,7 +109,7 @@ public function testHydeServeCommandWithHostDefinedInConfigAndHostOption()
config(['hyde.server.host' => 'foo']);

$this->artisan('serve --no-ansi --host=bar')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S bar:8080 {$this->binaryPath()}");
Expand All @@ -120,7 +120,7 @@ public function testHydeServeCommandWithHostMissingInConfigAndHostOption()
config(['hyde.server.host' => null]);

$this->artisan('serve --no-ansi --host=foo')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);

Process::assertRan("php -S foo:8080 {$this->binaryPath()}");
Expand All @@ -132,7 +132,7 @@ public function testHydeServeCommandWithInvalidConfigValue()
config(['hyde.server.port' => 'foo']);

$this->artisan('serve --no-ansi')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->assertExitCode(0);
}

Expand All @@ -158,7 +158,7 @@ public function testHydeServeCommandPassesThroughProcessOutput()
->andReturnSelf();

$this->artisan('serve --no-ansi')
->expectsOutput('Starting the HydeRC server... Press Ctrl+C to stop')
->expectsOutput('Starting the HydeRC server... Use Ctrl+C to stop')
->expectsOutput('foo')
->assertExitCode(0);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/realtime-compiler/src/ConsoleOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function formatLineForOutput(string $line): ?string

protected function formatServerStartedLine(string $line): string
{
return $this->formatLine(sprintf('PHP %s Development Server started. <span class="text-yellow-500">Press Ctrl+C to stop.</span>', PHP_VERSION), $this->parseDate($line), 'green-500');
return $this->formatLine(sprintf('PHP %s Development Server started. <span class="text-yellow-500">Use Ctrl+C to stop.</span>', PHP_VERSION), $this->parseDate($line), 'green-500');
}

protected function formatRequestLine(string $line): string
Expand Down

0 comments on commit 4e3cd4d

Please sign in to comment.