Skip to content

Commit b07c0d9

Browse files
committed
♻️ Apply refactoring
1 parent c82413a commit b07c0d9

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

.gitignore

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
/.phpunit.cache
2+
/public/storage
3+
/storage/*.key
14
/vendor
5+
/node_modules
6+
.env
7+
.env.backup
8+
.env.production
9+
.phpunit.result.cache
10+
Homestead.json
11+
Homestead.yaml
12+
npm-debug.log
13+
yarn-error.log
214
/.fleet
315
/.idea
416
/.vscode
5-
.env.example
6-
composer.lock
7-
phpunit.xml
8-
.phpunit.result.cache

projects/default/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/public/storage
33
/storage/*.key
44
/vendor
5+
/node_modules
56
.env
67
.env.backup
78
.env.production

skeleton/Commands/GenerateProject.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Symfony\Component\Console\Input\InputOption;
1212
use Symfony\Component\Console\Output\OutputInterface;
1313
use Symfony\Component\Filesystem\Filesystem;
14+
use Symfony\Component\Finder\Finder;
1415

1516
final class GenerateProject extends Command
1617
{
@@ -49,20 +50,12 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
4950

5051
$output->write(PHP_EOL.' <fg=green>Generating project...</>'.PHP_EOL.PHP_EOL);
5152

52-
$folders = [
53-
"core",
54-
"app",
55-
"bootstrap",
56-
"config",
57-
"database",
58-
"lang",
59-
"public",
60-
"resources",
61-
"routes",
62-
"storage",
63-
"stubs",
64-
"tests",
65-
];
53+
$finder = new Finder();
54+
$folders = $finder->in(getcwd())
55+
->directories()
56+
->exclude(['skeleton', 'vendor', 'node_modules', 'projects'])
57+
->depth(0)
58+
->getIterator();
6659

6760
$files = [
6861
".editorconfig",
@@ -82,7 +75,11 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
8275
$output->write(PHP_EOL.' <fg=white>Copying Laravel folders...</>'.PHP_EOL.PHP_EOL);
8376

8477
foreach ($folders as $folder) {
85-
(new Filesystem)->mirror(__DIR__.'/../../'.$folder, $project.'/'.$folder, null, ['override' => true]);
78+
(new Filesystem)->mirror(
79+
originDir: $folder->getRelativePathname(),
80+
targetDir: $project.'/'.$folder->getRelativePathname(),
81+
options: ['override' => true]
82+
);
8683
}
8784

8885
$output->write(PHP_EOL.' <fg=white>Copying Laravel files...</>'.PHP_EOL.PHP_EOL);

0 commit comments

Comments
 (0)