Closed duncanmcclean closed 2 years ago
Hey Duncan. This should be possible with the new starter kit install hooks.
<?php
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
class StarterKitPostInstall
{
public function handle($console)
{
if ($console->confirm('Do you want to install npm dependencies?', true)) {
$process = new Process(['npm', 'i']);
try {
$process->mustRun();
$console->info('Dependencies installed.');
} catch (ProcessFailedException $exception) {
$console->info($exception->getMessage());
}
}
}
}
Ooh, that's nice - exactly what I needed! Thanks for noticing 🎉
Like how the CLI asks if you want to create a user when creating a fresh site with the Statamic CLI, it could be nice if it also asked you if you wanted it to run
npm install
for you.Feel free to transfer this to statamic/ideas if that's a better place for this kind of thing - wasn't sure as it's CLI related, not Core related (I assume anyways).