Skip to content

Commit

Permalink
chore: Optimize dotenv file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
marcreichel committed Jan 31, 2025
1 parent b834503 commit 0169617
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Command/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,14 @@ public function __invoke(): int
$webRoot = $defaultWebRoot;
}
$envUpdated = false;
if ($envExampleExists && !$envExists) {
if (!$envExists) {
$this->section('Environment Setup');

(new Process(['cp', '.env.example', '.env'], $directory))->run();
if ($envExampleExists) {
copy($directory . DIRECTORY_SEPARATOR . '.env.example', $directory . DIRECTORY_SEPARATOR . '.env');
} else {
copy($directory . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'module_system' . DIRECTORY_SEPARATOR . '.env.example.root', $directory . DIRECTORY_SEPARATOR . '.env');
}

$dbName = null;
if ($this->input->isInteractive()) {
Expand Down

0 comments on commit 0169617

Please sign in to comment.