PHP Deployment Scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
neatoDeploy/app/utils/npm.php

36 lines
1.2 KiB

<?php
namespace utils;
class npm {
public static function install($program) {
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_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_local_bin . 'npm list -g ' . safe_cmd($program), $output, $exit_code);
if ($display === true) {
check_for_error($exit_code, "npm package not installed: {$program}");
}
return $exit_code;
}
public static function update($program) {
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;
}
}