Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Classes/Lightwerk/SurfTasks/Task/Assets/NpmTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use TYPO3\Surf\Domain\Model\Deployment;
use TYPO3\Surf\Domain\Model\Node;
use TYPO3\Surf\Domain\Model\Task;
use TYPO3\Surf\Exception\InvalidConfigurationException;
use TYPO3\Surf\Exception\TaskExecutionException;

/**
Expand Down Expand Up @@ -46,7 +47,7 @@ public function simulate(Node $node, Application $application, Deployment $deplo
* @param Deployment $deployment
* @param array $options
*
* @throws TaskExecutionException
* @throws InvalidConfigurationException
*/
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
{
Expand All @@ -71,9 +72,12 @@ public function execute(Node $node, Application $application, Deployment $deploy

$commands = [];
$commands[] = 'cd '.escapeshellarg($rootPath);
$commands[] = 'if [ "`which npm`" != "" ] && [ -f "package.json" ]; then '.
$commands[] = 'if [ "`which npm`" != "" ] && [ -f "package.json" ] && [ ! -f "yarn.lock" ]; then '.
'npm install --loglevel error; '.
'fi';
$commands[] = 'if [ "`which yarn`" != "" ] && [ -f "yarn.lock" ]; then '.
'yarn install --production --non-interactive --ignore-engines; '.
'fi';

$this->shell->executeOrSimulate($commands, $node, $deployment);
}
Expand Down