Skip to content

Commit b83d18e

Browse files
Add npm option to fix no-interaction installs (#402)
* Add npm option * Update NewCommand.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 2f267ba commit b83d18e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/NewCommand.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ protected function configure()
5454
->addOption('workos', null, InputOption::VALUE_NONE, 'Use WorkOS for authentication')
5555
->addOption('pest', null, InputOption::VALUE_NONE, 'Install the Pest testing framework')
5656
->addOption('phpunit', null, InputOption::VALUE_NONE, 'Install the PHPUnit testing framework')
57+
->addOption('npm', null, InputOption::VALUE_NONE, 'Install and build NPM dependencies')
5758
->addOption('force', 'f', InputOption::VALUE_NONE, 'Forces install even if the directory already exists');
5859
}
5960

@@ -297,9 +298,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
297298
$output->writeln('');
298299
}
299300

300-
$runNpm = confirm(
301-
label: 'Would you like to run <options=bold>npm install</> and <options=bold>npm run build</>?'
302-
);
301+
$runNpm = $input->getOption('npm');
302+
303+
if (! $input->getOption('npm') && $input->isInteractive()) {
304+
$runNpm = confirm(
305+
label: 'Would you like to run <options=bold>npm install</> and <options=bold>npm run build</>?'
306+
);
307+
}
303308

304309
if ($runNpm) {
305310
$this->runCommands(['npm install', 'npm run build'], $input, $output, workingPath: $directory);

0 commit comments

Comments
 (0)