2 namespace Robo\Task\Npm;
4 use Robo\Task\BaseTask;
5 use Robo\Exception\TaskException;
7 abstract class Base extends BaseTask
9 use \Robo\Common\ExecOneCommand;
14 protected $command = '';
24 protected $action = '';
27 * adds `production` option to npm
31 public function noDev()
33 $this->option('production');
38 * @param null|string $pathToNpm
40 * @throws \Robo\Exception\TaskException
42 public function __construct($pathToNpm = null)
44 $this->command = $pathToNpm;
45 if (!$this->command) {
46 $this->command = $this->findExecutable('npm');
48 if (!$this->command) {
49 throw new TaskException(__CLASS__, "Npm executable not found.");
56 public function getCommand()
58 return "{$this->command} {$this->action}{$this->arguments}";