1111use Symfony \Component \Console \Input \InputOption ;
1212use Symfony \Component \Console \Output \OutputInterface ;
1313use Symfony \Component \Filesystem \Filesystem ;
14+ use Symfony \Component \Finder \Finder ;
1415
1516final 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