Socket
Socket
Sign inDemoInstall

npm-install-all

Package Overview
Dependencies
14
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.13 to 1.1.14

10

example/demo-project/file1.js

@@ -1,1 +0,9 @@

var _ = require("underscore"); var calendars = [1, "String", {}, 1.1, true], newArray = []; _.each(calendars, function (item, index) { newArray.push(item); }); console.log(newArray);
var _ = require("underscore");
var calendars = [1, "String", {}, 1.1, true],
newArray = [];
_.each(calendars, function (item, index) {
newArray.push(item);
});
console.log(newArray);

@@ -1,1 +0,8 @@

var express = require('express'); var app = express(); app.get('/', function (req, res) { res.send('Hello World') }) app.listen(3000)
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World')
})
app.listen(3000)

4

example/demo-project/sub-folder/file3.js

@@ -1,1 +0,3 @@

var chalk = require('chalk'); chalk.green('Hello') + 'World' + chalk.red('!');
var chalk = require('chalk');
chalk.green('Hello') + 'World' + chalk.red('!');

@@ -1,1 +0,9 @@

var express = require('express'); var Pormise = require('bluebird'); var app = express(); app.get('/', function (req, res) { res.send('Hello World') }) app.listen(3000)
var express = require('express');
var Pormise = require('bluebird');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World')
})
app.listen(3000)

@@ -1,1 +0,104 @@

#!/usr/bin/env node var lineReader = require('line-reader'); var exec = require('child_process').exec; var Promise = require('bluebird'); var Handlebars = require('handlebars'); var dir = require('node-dir'); var execSync = require("sync-exec"); var fs = require('fs'); var moduleArr = []; var fileName = process.argv[2]; var fileNames = []; function storingModuleNames(fn){ return new Promise(function(resolve, reject){ var eachLine = Promise.promisify(lineReader.eachLine); if(process.argv[2]==null){ fileName = fn; } eachLine(fileName, function(line) { var regex = /require\(([^.\/)]+)\)/g; var mat = regex.exec(line); if(mat != null){ mat[1] = mat[1].replace(/'/g, ''); if (moduleArr.indexOf(mat[1]) == -1) { moduleArr.push(mat[1]); } } }).then(function(){ resolve(); }) .catch(function(err) { console.error(err); reject(); }); }); }; function runningCommand(modules){ console.log('\nINSTALLING THE FOLLOWING MODULES:'); for (var module in modules){ var localCommand = 'npm install '+modules[module]+' --save'; console.log('├── ',modules[module]); execSync(localCommand); } console.log('\nMODULES INSTALLED AND SAVED INTO package.json...'); }; function checkPackageJSON(){ fs.stat('package.json', function(err, stat) { if(err == null) { //console.log('File exists'); } else if(err.code == 'ENOENT') { function puts(error, stdout, stderr) { var globalModulesPath = stdout; var packageTemplatePath = globalModulesPath.trim() + '\\node_modules\\npm-install-all\\template\\template-package-json.hbs'; var template = fs.readFileSync(packageTemplatePath).toString(); var compiledTemplate = Handlebars.compile(template); var packagejson = JSON.parse(compiledTemplate()); fs.writeFile('package.json', JSON.stringify(packagejson, null, "\t")); } var globalPathPrefixCommand = 'npm config get prefix'; exec(globalPathPrefixCommand, puts); return; } else { console.log('Some other error: ', err.code); } }); } var compute = function() { if(fileName!=null){ checkPackageJSON(); setTimeout(function(){ storingModuleNames().then(function(){ runningCommand(moduleArr); }); }, 3000); } else{ dir.readFiles('./', { match: /.js$/, excludeDir: ['node_modules'] }, function(err, content, next) { if (err) throw err; next(); }, function(err, files){ if (err) throw err; fileNames = files; checkPackageJSON(); for (var file in fileNames){ storingModuleNames(fileNames[file]); } setTimeout(function(){ runningCommand(moduleArr); }, 3000); }); } }; compute();
#!/usr/bin/env node
var lineReader = require('line-reader');
var exec = require('child_process').exec;
var Promise = require('bluebird');
var Handlebars = require('handlebars');
var dir = require('node-dir');
var execSync = require("sync-exec");
var fs = require('fs');
var moduleArr = [];
var fileName = process.argv[2];
var fileNames = [];
function storingModuleNames(fn){
return new Promise(function(resolve, reject){
var eachLine = Promise.promisify(lineReader.eachLine);
if(process.argv[2]==null){
fileName = fn;
}
eachLine(fileName, function(line) {
var regex = /require\(([^.\/)]+)\)/g;
var mat = regex.exec(line);
if(mat != null){
mat[1] = mat[1].replace(/'/g, '');
if (moduleArr.indexOf(mat[1]) == -1) {
moduleArr.push(mat[1]);
}
}
}).then(function(){
resolve();
})
.catch(function(err) {
console.error(err);
reject();
});
});
};
function runningCommand(modules){
console.log('\nINSTALLING THE FOLLOWING MODULES:');
for (var module in modules){
var localCommand = 'npm install '+modules[module]+' --save';
console.log('├── ',modules[module]);
execSync(localCommand);
}
console.log('\nMODULES INSTALLED AND SAVED INTO package.json...');
};
function checkPackageJSON(){
fs.stat('package.json', function(err, stat) {
if(err == null) {
//console.log('File exists');
} else if(err.code == 'ENOENT') {
function puts(error, stdout, stderr) {
var globalModulesPath = stdout;
var packageTemplatePath = globalModulesPath.trim() + '\\node_modules\\npm-install-all\\template\\template-package-json.hbs';
var template = fs.readFileSync(packageTemplatePath).toString();
var compiledTemplate = Handlebars.compile(template);
var packagejson = JSON.parse(compiledTemplate());
fs.writeFile('package.json', JSON.stringify(packagejson, null, "\t"));
}
var globalPathPrefixCommand = 'npm config get prefix';
exec(globalPathPrefixCommand, puts);
return;
} else {
console.log('Some other error: ', err.code);
}
});
}
var compute = function() {
if(fileName!=null){
checkPackageJSON();
setTimeout(function(){
storingModuleNames().then(function(){
runningCommand(moduleArr);
});
}, 1000);
}
else{
dir.readFiles('./', {
match: /.js$/,
excludeDir: ['node_modules']
}, function(err, content, next) {
if (err) throw err;
next();
},
function(err, files){
if (err) throw err;
fileNames = files;
checkPackageJSON();
for (var file in fileNames){
storingModuleNames(fileNames[file]);
}
setTimeout(function(){
runningCommand(moduleArr);
}, 1000);
});
}
};
compute();

@@ -1,1 +0,36 @@

{ "name": "npm-install-all", "version": "1.1.13", "description": "This is a npm module to install all dependent npm packages for a particular file or folder or a project and save it in package.json.", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", "url": "git+https://github.com/abinpal/npm-install-all.git" }, "author": { "name": "Abin Pal" }, "license": "MIT", "bugs": { "url": "https://github.com/abinpal/npm-install-all/issues" }, "homepage": "https://github.com/abinpal/npm-install-all#readme", "dependencies": { "bluebird": "^3.3.1", "handlebars": "^4.0.5", "line-reader": "^0.3.0", "node-dir": "^0.1.12", "sync-exec": "^0.6.2" }, "bin": { "npm-install-all": "index.js" }, "keywords": [ "node", "npm", "installer" ] }
{
"name": "npm-install-all",
"version": "1.1.14",
"description": "This is a npm module to install all dependent npm packages for a particular file or folder or a project and save it in package.json.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/abinpal/npm-install-all.git"
},
"author": {
"name": "Abin Pal"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/abinpal/npm-install-all/issues"
},
"homepage": "https://github.com/abinpal/npm-install-all#readme",
"dependencies": {
"bluebird": "^3.3.1",
"handlebars": "^4.0.5",
"line-reader": "^0.3.0",
"node-dir": "^0.1.12",
"sync-exec": "^0.6.2"
},
"bin": {
"npm-install-all": "index.js"
},
"keywords": [
"node",
"npm",
"installer"
]
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc