Skip to content

Instantly share code, notes, and snippets.

@jakub-g
Created January 12, 2017 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakub-g/17cb54694a72dd968dd4daf1f98b0832 to your computer and use it in GitHub Desktop.
Save jakub-g/17cb54694a72dd968dd4daf1f98b0832 to your computer and use it in GitHub Desktop.
node and npm from maven
#!/usr/bin/env node
var path = require('path');
// note this is required on maven BEFORE npm install so it can not be outsourced to ng-scripts
var execWithEnv = require('./execWithEnv');
var exec = function(command) {
command = command + ' --no-color';
var cwd = process.cwd();
var customNodePath = path.join(__dirname, '../node');
var customNpmPath = path.join(__dirname, '../node/maven-npm-bin');
var PATH = [customNodePath, path.delimiter, customNpmPath, path.delimiter, process.env.PATH].join('');
console.log('\n----------------------------------------------------------------------------');
console.log('Running "' + command + '" in ' + cwd);
console.log('----------------------------------------------------------------------------');
execWithEnv(command, {
PATH: PATH
}, {
verbose: false
});
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var gitRoot = path.join(__dirname, '../');
process.chdir(gitRoot);
exec('node --version');
exec('npm install');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment