Skip to content

Commit

Permalink
Remove NPM install option (required for backup system)
Browse files Browse the repository at this point in the history
  • Loading branch information
Muetze42 committed Jun 19, 2022
1 parent 16f2420 commit 95f526a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ php artisan nova:custom-assets
composer reinstall laravel/nova
```

If you want to skip NPM install use this command:

```
php artisan nova:custom-assets --without-npm-install
```

## Notice

After a Nova update, you need to check your resource files to see if they are still compatible.
Expand Down
15 changes: 7 additions & 8 deletions src/Console/Commands/CustomAssetsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ class CustomAssetsCommand extends Command
{
protected string $novaPath = 'vendor/laravel/nova';
protected Process $process;
protected string $composerCommand = 'composer';
protected string $npmCommand = 'npm';

/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'nova:custom-assets {--without-npm-install}';
protected $signature = 'nova:custom-assets';

/**
* The console command description.
Expand All @@ -30,16 +32,13 @@ class CustomAssetsCommand extends Command
*/
public function handle(): int
{
$npmInstall = !$this->option('without-npm-install');
$this->process = new Process;
$this->novaPath = base_path($this->novaPath);

$this->reinstallNova();
$this->replaceComponents();
$this->webpack();
if ($npmInstall) {
$this->npmInstall();
}
$this->npmInstall();
$this->npmProduction();
$this->publishNovaAssets();

Expand All @@ -58,7 +57,7 @@ protected function publishNovaAssets()
protected function npmProduction()
{
$this->info('Run NPM production');
$command = 'cd '.$this->novaPath.' && npm run production';
$command = 'cd '.$this->novaPath.' && '.$this->npmCommand.' run production';
$this->process->runCommand($command);
foreach ($this->process->getOutput() as $output) {
$this->line($output);
Expand All @@ -68,7 +67,7 @@ protected function npmProduction()
protected function reinstallNova()
{
$this->info('Reinstall laravel/nova');
$this->process->runCommand('composer reinstall laravel/nova');
$this->process->runCommand($this->composerCommand.' reinstall laravel/nova');
foreach ($this->process->getOutput() as $output) {
$this->line($output);
}
Expand Down Expand Up @@ -110,7 +109,7 @@ protected function replaceComponents($path = 'Nova')
protected function npmInstall()
{
$this->info('Run NPM install');
$this->process->runCommand('cd '.$this->novaPath.' && npm i');
$this->process->runCommand('cd '.$this->novaPath.' && '.$this->npmCommand.' i');
foreach ($this->process->getOutput() as $output) {
$this->line($output);
}
Expand Down

0 comments on commit 95f526a

Please sign in to comment.