Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename --pretty option to --run-prettier to distinguish it better in build command #368

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 8 additions & 6 deletions src/Commands/HydeBuildStaticSiteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
* Hyde Command to run the Build Process.
*
* @see \Tests\Feature\Commands\BuildStaticSiteCommandTest
*
* @todo #361 Rename --pretty option to --run-prettier to distinguish it better
*/
class HydeBuildStaticSiteCommand extends Command
{
Expand All @@ -37,9 +35,10 @@ class HydeBuildStaticSiteCommand extends Command
protected $signature = 'build
{--run-dev : Run the NPM dev script after build}
{--run-prod : Run the NPM prod script after build}
{--pretty : Should the build files be prettified?}
{--pretty : Deprecated option, use --run-prettier instead}
{--run-prettier : Format the output using NPM Prettier}
{--pretty-urls : Should links in output use pretty URLs?}
{--no-api : Disable external API calls, such as Torchlight}';
{--no-api : Disable API calls, for example, Torchlight}';

/**
* The description of the command.
Expand Down Expand Up @@ -154,9 +153,12 @@ public function purge(): void
*/
public function postBuildActions(): void
{
if ($this->option('pretty')) {
if ($this->option('run-prettier') || $this->option('pretty')) {
if ($this->option('pretty')) {
$this->warn('<error>Warning:</> The --pretty option is deprecated, use --run-prettier instead');
}
$this->runNodeCommand(
'npx prettier '.Hyde::pathToRelative(Hyde::getSiteOutputPath($path)).'/ --write --bracket-same-line',
'npx prettier '.Hyde::pathToRelative(Hyde::getSiteOutputPath()).'/ --write --bracket-same-line',
'Prettifying code!',
'prettify code'
);
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Commands/BuildStaticSiteCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function test_handle_purge_method()

public function test_node_action_outputs()
{
$this->artisan('build --pretty --run-dev --run-prod')
$this->artisan('build --run-prettier --run-dev --run-prod')
->expectsOutput('Prettifying code! This may take a second.')
->expectsOutput('Building frontend assets for development! This may take a second.')
->expectsOutput('Building frontend assets for production! This may take a second.')
Expand Down