@@ -30,11 +30,13 @@ class NewCommand extends Command
3030 public $ relativePath ;
3131 public $ absolutePath ;
3232 public $ name ;
33+ public $ version ;
3334 public $ starterKit ;
3435 public $ starterKitVcs ;
3536 public $ starterKitLicense ;
3637 public $ local ;
3738 public $ withConfig ;
39+ public $ withoutDependencies ;
3840 public $ force ;
3941 public $ v2 ;
4042 public $ baseInstallSuccessful ;
@@ -56,6 +58,7 @@ protected function configure()
5658 ->addOption ('license ' , null , InputOption::VALUE_OPTIONAL , 'Optionally provide explicit starter kit license ' )
5759 ->addOption ('local ' , null , InputOption::VALUE_NONE , 'Optionally install from local repo configured in composer config.json ' )
5860 ->addOption ('with-config ' , null , InputOption::VALUE_NONE , 'Optionally copy starter-kit.yaml config for local development ' )
61+ ->addOption ('without-dependencies ' , null , InputOption::VALUE_NONE , 'Optionally install starter kit without dependencies ' )
5962 ->addOption ('v2 ' , null , InputOption::VALUE_NONE , 'Create a legacy Statamic v2 application (not recommended) ' )
6063 ->addOption ('force ' , 'f ' , InputOption::VALUE_NONE , 'Force install even if the directory already exists ' );
6164 }
@@ -158,10 +161,15 @@ protected function processArguments()
158161
159162 $ this ->name = pathinfo ($ this ->absolutePath )['basename ' ];
160163
164+ $ this ->version = $ this ->input ->getOption ('dev ' )
165+ ? 'dev-master '
166+ : '' ;
167+
161168 $ this ->starterKit = $ this ->input ->getArgument ('starter-kit ' );
162169 $ this ->starterKitLicense = $ this ->input ->getOption ('license ' );
163170 $ this ->local = $ this ->input ->getOption ('local ' );
164171 $ this ->withConfig = $ this ->input ->getOption ('with-config ' );
172+ $ this ->withoutDependencies = $ this ->input ->getOption ('without-dependencies ' );
165173
166174 $ this ->force = $ this ->input ->getOption ('force ' );
167175
@@ -206,6 +214,10 @@ protected function validateArguments()
206214 throw new RuntimeException ('Starter kit is required when using `--with-config` option! ' );
207215 }
208216
217+ if (! $ this ->starterKit && $ this ->withoutDependencies ) {
218+ throw new RuntimeException ('Starter kit is required when using `--without-dependencies` option! ' );
219+ }
220+
209221 return $ this ;
210222 }
211223
@@ -503,6 +515,10 @@ protected function installStarterKit()
503515 $ options [] = $ this ->starterKitLicense ;
504516 }
505517
518+ if ($ this ->withoutDependencies ) {
519+ $ options [] = '--without-dependencies ' ;
520+ }
521+
506522 $ statusCode = (new Please ($ this ->output ))
507523 ->cwd ($ this ->absolutePath )
508524 ->run ('starter-kit:install ' , $ this ->starterKit , ...$ options );
@@ -710,11 +726,9 @@ protected function createProjectCommand()
710726
711727 $ baseRepo = self ::BASE_REPO ;
712728
713- $ version = $ this ->getVersion ();
714-
715729 $ directory = $ this ->pathIsCwd () ? '. ' : $ this ->relativePath ;
716730
717- return $ composer ." create-project {$ baseRepo } \"{$ directory }\" {$ version } --remove-vcs --prefer-dist " ;
731+ return $ composer ." create-project {$ baseRepo } \"{$ directory }\" {$ this -> version } --remove-vcs --prefer-dist " ;
718732 }
719733
720734 /**
@@ -831,13 +845,4 @@ public function __call($method, $args)
831845 }
832846 };
833847 }
834-
835- protected function getVersion ()
836- {
837- if ($ this ->input ->getOption ('dev ' )) {
838- return 'dev-master ' ;
839- }
840-
841- return '' ;
842- }
843848}
0 commit comments