[CB-3542] Commit bin/node_modules so that it doesn't need to be npm installed.

This commit is contained in:
Andrew Grieve
2013-09-10 16:58:28 -04:00
parent 437daa368a
commit 7be1f018aa
16 changed files with 2679 additions and 29 deletions
+7 -28
View File
@@ -20,34 +20,13 @@
*/
var path = require('path');
var args = process.argv;
var create = require('./lib/create');
try {
require.resolve("shelljs");
create();
} catch(e) {
console.log('Shelljs module was not found, running \'npm install\'.....');
var exec = require('child_process').exec;
var cwd = process.cwd();
process.chdir(__dirname);
exec('npm install', function (error, stdout, stderr) {
if (error !== null) {
console.error('ERROR : running \'npm install\' is npm installed? ' + error);
console.error(stderr);
process.exit(error.code);
}
process.chdir(cwd);
create();
});
// Support basic help commands
if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
create.help();
} else {
create.run(args[2], args[3], args[4], args[5]);
}
function create() {
var create = require('./lib/create');
// Support basic help commands
if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
create.help();
} else {
create.run(args[2], args[3], args[4], args[5]);
process.exit(0);
}
}