Skip to content

Commit

Permalink
Use Default NPM Package Manager of User if Lock File Exists In Base P…
Browse files Browse the repository at this point in the history
…ath (#224)

* modified:   src/Console/InstallsBladeStack.php
	modified:   src/Console/InstallsInertiaStacks.php

* Update InstallsBladeStack.php

* Update InstallsInertiaStacks.php

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
andrewdwallo and taylorotwell authored Dec 5, 2022
1 parent e2b658a commit 5dd0f87
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/Console/InstallsBladeStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ protected function installBladeStack()
copy(__DIR__.'/../../stubs/default/resources/css/app.css', resource_path('css/app.css'));
copy(__DIR__.'/../../stubs/default/resources/js/app.js', resource_path('js/app.js'));

$this->runCommands(['npm install', 'npm run build']);
if (file_exists(base_path('pnpm-lock.yaml'))) {
$this->runCommands(['pnpm install', 'pnpm run build']);
} elseif (file_exists(base_path('yarn.lock'))) {
$this->runCommands(['yarn install', 'yarn run build']);
} else {
$this->runCommands(['npm install', 'npm run build']);
}

$this->line('');
$this->components->info('Breeze scaffolding installed successfully.');
Expand Down
16 changes: 14 additions & 2 deletions src/Console/InstallsInertiaStacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ protected function installInertiaVueStack()
$this->installInertiaVueSsrStack();
}

$this->runCommands(['npm install', 'npm run build']);
if (file_exists(base_path('pnpm-lock.yaml'))) {
$this->runCommands(['pnpm install', 'pnpm run build']);
} elseif (file_exists(base_path('yarn.lock'))) {
$this->runCommands(['yarn install', 'yarn run build']);
} else {
$this->runCommands(['npm install', 'npm run build']);
}

$this->line('');
$this->components->info('Breeze scaffolding installed successfully.');
Expand Down Expand Up @@ -219,7 +225,13 @@ protected function installInertiaReactStack()
$this->installInertiaReactSsrStack();
}

$this->runCommands(['npm install', 'npm run build']);
if (file_exists(base_path('pnpm-lock.yaml'))) {
$this->runCommands(['pnpm install', 'pnpm run build']);
} elseif (file_exists(base_path('yarn.lock'))) {
$this->runCommands(['yarn install', 'yarn run build']);
} else {
$this->runCommands(['npm install', 'npm run build']);
}

$this->line('');
$this->components->info('Breeze scaffolding installed successfully.');
Expand Down

0 comments on commit 5dd0f87

Please sign in to comment.