* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Deployer; set('bin/npm', function () { return run('which npm'); }); desc('Install npm packages'); task('npm:install', function () { if (has('previous_release')) { if (test('[ -d {{previous_release}}/node_modules ]')) { run('cp -R {{previous_release}}/node_modules {{release_path}}'); // If package.json is unmodified, then skip running `npm install` if (!run('diff {{previous_release}}/package.json {{release_path}}/package.json')) { return; } } } run("cd {{release_path}} && {{bin/npm}} install"); }); desc('Install npm packages with a clean slate'); task('npm:ci', function () { run("cd {{release_path}} && {{bin/npm}} ci"); });