|
|
|
|
@ -5,21 +5,21 @@ namespace utils; |
|
|
|
|
class npm { |
|
|
|
|
|
|
|
|
|
public static function install($program) { |
|
|
|
|
exec(\neato::get_user_bin . 'npm install -g ' . safe_cmd($program), $output, $exit_code); |
|
|
|
|
exec(\neato::get_user_local_bin . 'npm install -g ' . safe_cmd($program), $output, $exit_code); |
|
|
|
|
display($output); |
|
|
|
|
check_for_error($exit_code, "Unable to run npm install command: {$program}"); |
|
|
|
|
return $exit_code; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function uninstall($program) { |
|
|
|
|
exec(\neato::get_user_bin . 'npm uninstall ' . safe_cmd($program), $output, $exit_code); |
|
|
|
|
exec(\neato::get_user_local_bin . 'npm uninstall ' . safe_cmd($program), $output, $exit_code); |
|
|
|
|
display($output); |
|
|
|
|
check_for_error($exit_code, "Unable to run npm uninstall command: {$program}"); |
|
|
|
|
return $exit_code; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function is_package_installed_globally($program, $display = false) { |
|
|
|
|
exec(\neato::get_user_bin . 'npm list -g ' . safe_cmd($program), $output, $exit_code); |
|
|
|
|
exec(\neato::get_user_local_bin . 'npm list -g ' . safe_cmd($program), $output, $exit_code); |
|
|
|
|
if ($display === true) { |
|
|
|
|
check_for_error($exit_code, "npm package not installed: {$program}"); |
|
|
|
|
} |
|
|
|
|
@ -27,7 +27,7 @@ class npm { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function update($program) { |
|
|
|
|
exec(\neato::get_user_bin . 'npm update -g ' . safe_cmd($program), $output, $exit_code); |
|
|
|
|
exec(\neato::get_user_local_bin . 'npm update -g ' . safe_cmd($program), $output, $exit_code); |
|
|
|
|
display($output); |
|
|
|
|
check_for_error($exit_code, "Unable to run npm update command: {$program}"); |
|
|
|
|
return $exit_code; |
|
|
|
|
|