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

@medic/audit-dependencies

Package Overview
Dependencies
Maintainers
9
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@medic/audit-dependencies - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

src/cli.js

5

package.json
{
"name": "@medic/audit-dependencies",
"version": "0.0.1",
"version": "0.0.2",
"description": "Caches the results of npm audit so it only runs if the package-lock.json changes.",
"bin": {
"audit": "src/bin/audit.js",
"check": "src/bin/check.js"
"audit-dependencies": "src/cli.js"
},

@@ -9,0 +8,0 @@ "scripts": {

30

src/bin/audit.js

@@ -52,5 +52,3 @@ const { spawn } = require('child_process');

if (error.length) {
console.error(`${error.length} unpermitted vulnerabilities found.`);
console.log(`Run 'npm audit' for more information then fix the issue or add the ID to the '.auditrc.json' 'permitted' array.`);
return callback(null, false);
return callback(new Error(`${error.length} unpermitted vulnerabilities found.`));
}

@@ -62,4 +60,3 @@ cache.permitted = warn;

}
console.warn(`${warn.length} permitted vulnerabilities found.`);
callback(null, true)
callback();
});

@@ -69,3 +66,3 @@ });

const run = callback => {
module.exports = callback => {
audit((err, audit) => {

@@ -75,17 +72,10 @@ if (err) {

}
check(audit, callback);
check(audit, err => {
if (err) {
return callback(err);
}
console.log('No unpermitted vulnerabilities found.');
return callback();
});
});
};
run((err, passed) => {
if (err) {
console.error(err);
process.exit(1);
return;
}
if (!passed) {
process.exit(1);
return;
}
console.log('✓ No unpermitted vulnerabilities found');
});

@@ -5,7 +5,13 @@ const { getCache, getPackageLockHash } = require('../lib/utils');

getPackageLockHash((err, current) => {
callback(err, cache.verified_hash === current);
if (err) {
return callback(err);
}
if (cache.verified_hash !== current) {
return callback(new Error('The "package-lock.json" has not been verified. Run `npx @medic/audit-dependencies audit` to verify your dependencies.'));
}
callback();
});
};
const run = callback => {
module.exports = callback => {
getCache((err, cache) => {

@@ -15,18 +21,10 @@ if (err) {

}
validatePackageLock(cache, callback);
validatePackageLock(cache, err => {
if (err) {
return callback(err);
}
console.log('The "package-lock.json" matches the previously verified version.');
callback();
});
});
};
run((err, valid) => {
if (err) {
console.error(err);
process.exit(1);
return;
}
if (!valid) {
console.error('✗ The "package-lock.json" has not been verified. Run `npx @medic/audit-dependencies audit` to verify your dependencies.');
process.exit(1);
return;
}
console.log('✓ The "package-lock.json" matches the previously verified version.');
});
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