Skip to content

Only do extra things in official starter kits / default laravel #415

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

Closed
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
15 changes: 10 additions & 5 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
}
}

if (! $input->getOption('phpunit') && ! $input->getOption('pest')) {
if (! $input->getOption('phpunit') && ! $input->getOption('pest') && ! $input->getOption('using')) {
$input->setOption('pest', select(
label: 'Which testing framework do you prefer?',
options: ['Pest', 'PHPUnit'],
Expand Down Expand Up @@ -240,10 +240,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$commands = [
$createProjectCommand,
$composer." run post-root-package-install -d \"$directory\"",
$phpBinary." \"$directory/artisan\" key:generate --ansi",
];

if ($this->usingLaravelStarterKit($input)) {
$commands = array_merge($commands, [
$composer." run post-root-package-install -d \"$directory\"",
$phpBinary." \"$directory/artisan\" key:generate --ansi",
]);
}

if ($directory != '.' && $input->getOption('force')) {
if (PHP_OS_FAMILY == 'Windows') {
array_unshift($commands, "(if exist \"$directory\" rd /s /q \"$directory\")");
Expand All @@ -256,7 +261,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$commands[] = "chmod 755 \"$directory/artisan\"";
}

if (($process = $this->runCommands($commands, $input, $output))->isSuccessful()) {
if (($process = $this->runCommands($commands, $input, $output))->isSuccessful() && $this->usingLaravelStarterKit($input)) {
if ($name !== '.') {
$this->replaceInFile(
'APP_URL=http://localhost',
Expand Down Expand Up @@ -758,7 +763,7 @@ protected function getStarterKit(InputInterface $input): ?string
$input->getOption('react') => 'laravel/react-starter-kit',
$input->getOption('vue') => 'laravel/vue-starter-kit',
$input->getOption('livewire') => 'laravel/livewire-starter-kit',
default => $input->getOption('using'),
default => $input->getOption('using') ?? 'laravel/laravel',
};
}

Expand Down