Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dependency-scanner

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependency-scanner - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

35

index.js

@@ -21,6 +21,2 @@ #!/usr/bin/env node

var packagePath = path.resolve('package.json');
loadDependencies(packagePath);
function logMessage(message) {

@@ -34,2 +30,14 @@ // don't log not truthy values, or in silent

function displayDependencies(deps) {
deps.sort().forEach(function (item) {
console.log(item.name);
})
}
function appendDependencies(arr, deps, depType) {
return (arr || {}).concat(Object.keys(deps).map(function (key) {
return { name: key, version: deps[key], depType };
}));
}
function loadDependencies(path) {

@@ -43,3 +51,3 @@ return fs.stat(path, function (err, stat) {

logMessage(VERBOSE && 'loading production dependencies');
deps = deps.concat(Object.keys(pkg.dependencies));
deps = appendDependencies(deps, pkg.dependencies, 'production');
}

@@ -49,3 +57,3 @@

logMessage(VERBOSE && 'loading dev dependencies');
deps = deps.concat(Object.keys(pkg.devDependencies));
deps = appendDependencies(deps, pkg.devDependencies, 'dev');
}

@@ -55,3 +63,3 @@

logMessage(VERBOSE && 'loading peer dependencies');
deps = deps.concat(Object.keys(pkg.peerDependencies));
deps = appendDependencies(deps, pkg.peerDependencies, 'peer');
}

@@ -62,3 +70,3 @@

logMessage(VERBOSE && 'loading bundled dependencies');
deps = deps.concat(Object.keys(pkg.bundledDependencies));
deps = appendDependencies(deps, pkg.bundledDependencies, 'bundled');
}

@@ -68,3 +76,3 @@

logMessage(VERBOSE && 'loading bundle dependencies');
deps = deps.concat(Object.keys(pkg.bundleDependencies));
deps = appendDependencies(deps, pkg.bundleDependencies, 'bundled');
}

@@ -75,3 +83,3 @@ }

logMessage(VERBOSE && 'loading optional dependencies');
deps = deps.concat(Object.keys(pkg.optionalDependencies));
deps = appendDependencies(deps, pkg.optionalDependencies, 'optional');
}

@@ -92,6 +100,3 @@

function displayDependencies(deps) {
deps.sort().forEach(function (item) {
console.log(item);
})
}
var packagePath = path.resolve('package.json');
loadDependencies(packagePath);
{
"name": "dependency-scanner",
"version": "1.0.3",
"version": "1.1.0",
"description": "Outputs dependancies from package.json provided",

@@ -5,0 +5,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc