Skip to content

Commit

Permalink
PoC install nvm
Browse files Browse the repository at this point in the history
  • Loading branch information
kabalin committed Aug 20, 2024
1 parent 3842ad1 commit c288b82
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Installer/VendorInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,17 @@ public function installNode(): void
file_put_contents($this->moodle->directory . '/.nvmrc', $reqversion);
}

$nvmDir = getenv('NVM_DIR');
$cmd = ". $nvmDir/nvm.sh && nvm install && nvm use && echo \"NVM_BIN=\$NVM_BIN\"";
$nvmDir = "{$this->moodle->directory}/.nvm";
(new Filesystem())->mkdir($nvmDir);

Check failure on line 123 in src/Installer/VendorInstaller.php

View workflow job for this annotation

GitHub Actions / CI test (make validate)

UndefinedClass

src/Installer/VendorInstaller.php:123:14: UndefinedClass: Class, interface or enum named MoodlePluginCI\Installer\Filesystem does not exist (see https://psalm.dev/019)
$cmd = "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | NVM_DIR=\"{$nvmDir}\" bash";
$process = $this->execute->passThroughProcess(
Process::fromShellCommandline($cmd, $this->moodle->directory, null, null, null)
);
if (!$process->isSuccessful()) {
throw new \RuntimeException('nvm installation failed.');
}

$cmd = ". {$nvmDir}/nvm.sh && nvm install && nvm use && echo \"NVM_BIN=\$NVM_BIN\"";
$process = $this->execute->passThroughProcess(
Process::fromShellCommandline($cmd, $this->moodle->directory, null, null, null)
);
Expand Down

0 comments on commit c288b82

Please sign in to comment.