Skip to content

Commit

Permalink
add option to indicate whether Breeze should be scaffolded with TypeS…
Browse files Browse the repository at this point in the history
…cript support (#271)

* add option to indicate whether Breeze should be scaffolded with Typescript support

* add "experimental" wording and adjust option position to match breeze installer

* fix typo in TypeScript

* Update NewCommand.php

* Update NewCommand.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
daleweaver777 and taylorotwell authored Aug 11, 2023
1 parent fb2002a commit 2dc782c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ protected function configure()
->addOption('organization', null, InputOption::VALUE_REQUIRED, 'The GitHub organization to create the new repository for')
->addOption('breeze', null, InputOption::VALUE_NONE, 'Installs the Laravel Breeze scaffolding')
->addOption('dark', null, InputOption::VALUE_NONE, 'Indicate whether Breeze or Jetstream should be scaffolded with dark mode support')
->addOption('typescript', null, InputOption::VALUE_NONE, 'Indicate whether Breeze should be scaffolded with TypeScript support (Experimental)')
->addOption('ssr', null, InputOption::VALUE_NONE, 'Indicate whether Breeze should be scaffolded with Inertia SSR support')
->addOption('jet', null, InputOption::VALUE_NONE, 'Installs the Laravel Jetstream scaffolding')
->addOption('stack', null, InputOption::VALUE_OPTIONAL, 'The Breeze / Jetstream stack that should be installed')
Expand Down Expand Up @@ -232,6 +233,7 @@ protected function installBreeze(string $directory, InputInterface $input, Outpu
trim(sprintf(
'"'.PHP_BINARY.'" artisan breeze:install %s %s %s %s',
$input->getOption('stack'),
$input->getOption('typescript') ? '--typescript' : '',
$input->getOption('pest') ? '--pest' : '',
$input->getOption('dark') ? '--dark' : '',
$input->getOption('ssr') ? '--ssr' : '',
Expand Down Expand Up @@ -297,10 +299,12 @@ protected function promptForBreezeOptions(InputInterface $input)
options: [
'dark' => 'Dark mode',
'ssr' => 'Inertia SSR',
'typescript' => 'TypeScript (experimental)',
],
default: array_filter([
$input->getOption('dark') ? 'dark' : null,
$input->getOption('ssr') ? 'ssr' : null,
$input->getOption('typescript') ? 'typescript' : null,
]),
))->each(fn ($option) => $input->setOption($option, true));
} elseif ($input->getOption('stack') === 'blade' && ! $input->getOption('dark')) {
Expand Down

0 comments on commit 2dc782c

Please sign in to comment.