Skip to content

Commit

Permalink
optional npm build on deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona committed Nov 8, 2024
1 parent 2ae995a commit aece607
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions app/Recipes/Laravel/Commands/Deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,37 @@ public function handle(DockerService $docker_service, TerminalService $terminal)
}
}

if (!$this->task("Installing NPM packages", function () use ($docker_service, $terminal) {
if(env('RUN_NPM_ON_DEPLOY', true)) {
if (!$this->task("Installing NPM packages", function() use ($docker_service, $terminal) {

$commands = [
"npm",
"install",
];

return $docker_service->service('node')->run($terminal, $commands, null, false);
})) {
return false;
}

if (!$this->task("Compiling Assets", function () use ($docker_service, $terminal) {
if ($this->is_production()) {
$commands = [
"npm",
"run",
"prod",
];
} else {
$commands = [
"npm",
"run",
"dev",
"install",
];

return $docker_service->service('node')->run($terminal, $commands, null, false);
})) {
return false;
}

if (!$this->task("Compiling Assets", function() use ($docker_service, $terminal) {
if ($this->is_production()) {
$commands = [
"npm",
"run",
"prod",
];
} else {
$commands = [
"npm",
"run",
"dev",
];
}
return $docker_service->service('node')->run($terminal, $commands, null, false);
})) {
return false;
}
return $docker_service->service('node')->run($terminal, $commands, null, false);
})) {
return false;
}


Expand Down

0 comments on commit aece607

Please sign in to comment.