|
4 | 4 |
|
5 | 5 | namespace OpenForgeProject\MageForge\Console\Command; |
6 | 6 |
|
| 7 | +use Dotenv\Regex\Success; |
7 | 8 | use Laravel\Prompts\MultiSelectPrompt; |
8 | 9 | use OpenForgeProject\MageForge\Model\ThemeList; |
9 | 10 | use OpenForgeProject\MageForge\Model\ThemePath; |
@@ -38,10 +39,37 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
38 | 39 |
|
39 | 40 | $output->writeln('Running npm outdated...'); |
40 | 41 | exec('npm outdated', $npmOutput, $returnValue); |
| 42 | + |
| 43 | + if ($returnValue !== 0 || !empty($npmOutput)) { |
| 44 | + $io = new SymfonyStyle($input, $output); |
| 45 | + $io->warning('Outdated packages found!'); |
| 46 | + } else { |
| 47 | + $io = new SymfonyStyle($input, $output); |
| 48 | + $io->success('No outdated packages found, proceeding with installation.'); |
| 49 | + } |
| 50 | + |
41 | 51 | foreach ($npmOutput as $line) { |
42 | 52 | $output->writeln($line); |
43 | 53 | } |
44 | 54 |
|
| 55 | + |
| 56 | + |
| 57 | + sleep(2); |
| 58 | + |
| 59 | + $output->writeln('Running npm install...'); |
| 60 | + exec('npm install', $npmOutput, $returnValue); |
| 61 | + foreach ($npmOutput as $line) { |
| 62 | + $output->writeln($line); |
| 63 | + } |
| 64 | + |
| 65 | + if ($returnValue !== 0) { |
| 66 | + $io = new SymfonyStyle($input, $output); |
| 67 | + $io->error('Npm install failed!'); |
| 68 | + return Command::FAILURE; |
| 69 | + } |
| 70 | + |
| 71 | + $io->success('Npm install completed successfully.'); |
| 72 | + |
45 | 73 | return Command::SUCCESS; |
46 | 74 | } |
47 | 75 |
|
|
0 commit comments