File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55namespace Leaf \Console ;
66
77use Leaf \Console \Utils \Package ;
8- use RuntimeException ;
98use Leaf \FS ;
109use Leaf \Sprout \Command ;
1110
@@ -106,8 +105,12 @@ protected function handle(): int
106105 $ commands = [];
107106 $ directory = path ($ this ->projectName !== '. ' ? getcwd () . '/ ' . $ this ->projectName : getcwd ())->normalize ();
108107
109- if (!$ this ->option ('force ' )) {
110- $ this ->verifyApplicationDoesntExist ($ directory );
108+ if (!$ this ->option ('force ' ) && $ this ->applicationExists ($ directory )) {
109+ $ this ->writeln ('' );
110+ $ this ->error ('" ' . basename ($ directory ) . '" already exists in ./ ' . basename (dirname ($ directory )));
111+ $ this ->writeln ('Choose a different name, or re-run with <info>--force</info> to build in the existing folder. ' );
112+
113+ return 1 ;
111114 }
112115
113116 $ this ->writeln (
@@ -312,15 +315,10 @@ protected function handle(): int
312315 }
313316
314317 /**
315- * Verify that the application does not already exist.
316- *
317- * @param string $directory
318- * @return void
318+ * Check whether something already exists at the target directory.
319319 */
320- protected function verifyApplicationDoesntExist (string $ directory )
320+ protected function applicationExists (string $ directory ): bool
321321 {
322- if ((is_dir ($ directory ) || is_file ($ directory )) && $ directory != getcwd ()) {
323- throw new RuntimeException ('Application already exists! ' );
324- }
322+ return (is_dir ($ directory ) || is_file ($ directory )) && $ directory != getcwd ();
325323 }
326324}
Original file line number Diff line number Diff line change 1+ /* Your app's CSS entry. Loaded through Vite via the @vite directive. */
Original file line number Diff line number Diff line change 1+ // Your app's JavaScript entry. Anything imported here is bundled by Vite.
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import leaf from '@leafphp/vite-plugin';
44export default defineConfig ( {
55 plugins : [
66 leaf ( {
7- input : [ 'js/app.js' , 'css/app.css' ] ,
7+ input : [ 'views/ js/app.js' , 'views/ css/app.css' ] ,
88 refresh : true ,
99 } ) ,
1010 ] ,
You can’t perform that action at this time.
0 commit comments