Skip to content

Commit ad24a55

Browse files
author
Shuo
committed
U: APP_NAME
1 parent 44d2a05 commit ad24a55

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

installer/OptionalPackages.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,12 @@ public function handleTypeLibrary()
170170
if ($this->composerDefinition['type'] !== 'library') {
171171
return;
172172
}
173+
// composer
173174
$analyse = $this->composerDefinition['scripts']['analyse'] ?? '';
174175
if ($analyse) {
175176
$this->composerDefinition['scripts']['analyse'] = str_replace(['/app', 'app/'], ['/src', 'src/'], $analyse);
176177
}
178+
// config
177179
$configDir = $this->projectRoot . 'config';
178180
$this->walkDir($configDir, function ($filename) {
179181
$content = file_get_contents($filename);
@@ -189,6 +191,13 @@ public function handleTypeLibrary()
189191
}
190192
return str_replace(' ', '', ucwords($name));
191193
}, $names);
194+
// .env
195+
$envFile = $this->projectRoot . '.env.example';
196+
$appName = implode('-', array_map('strtolower', $names));
197+
$content = file_get_contents($envFile);
198+
$content = str_replace('APP_NAME=skeleton', "APP_NAME=$appName", $content);
199+
file_put_contents($envFile, $content);
200+
// namespace
192201
$namespace = implode('\\', $names);
193202
$sourceDir = $this->projectRoot . 'app';
194203
$distDir = $this->projectRoot . 'src';

0 commit comments

Comments
 (0)