Socket
Socket
Sign inDemoInstall

@contrast/library-analysis

Package Overview
Dependencies
Maintainers
9
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrast/library-analysis - npm Package Compare versions

Comparing version 1.12.1 to 1.13.0

25

lib/install/library-reporting/list-installed.js

@@ -20,3 +20,3 @@ /*

const VERSION_REGEX = /^npm@(\S+)\s+(\S+[\s\S]*)$/m;
const VERSION_REGEX = /^npm@(\S+)\s+(\S+)$/m;
const isWin32 = process.platform === 'win32';

@@ -41,3 +41,2 @@

*/
// eslint-disable-next-line complexity
module.exports = async function listInstalled(cwd, logger, npmVersionRange) {

@@ -64,13 +63,8 @@ const execFileOpts = {

const [, version, location] = stdout.match(VERSION_REGEX) || [];
if (!version)
throw new Error(
"Unable to locate `npm`. `npm` is required for your application's libraries to be reported to Contrast for analysis. Please enable debug level logs for more information."
);
if (!version) {
throw new Error("Unable to locate `npm`. `npm` is required for your application's libraries to be reported to Contrast for analysis. Please enable debug or trace level logs for more information.");
}
logger.debug('using npm version %s at %s', version, location);
const lsArgs = ['ls', '--json', '--long'];
// This will be needs to be updated once node 14 is no longer LTS
if (semver.gte(version, '8.0.0')) lsArgs.push('--all');
if (!semver.satisfies(version, npmVersionRange))
if (!semver.satisfies(version, npmVersionRange)) {
logger.warn(

@@ -82,3 +76,8 @@ 'The installed version of npm (%s at %s) can cause unexpected behavior. Please install a version that satisfies %s',

);
}
const lsArgs = ['ls', '--json', '--long'];
// This will be needs to be updated once node 14 is no longer LTS
if (semver.gte(version, '8.0.0')) lsArgs.push('--all');
try {

@@ -96,6 +95,4 @@ const result = await execFile('npm', lsArgs, execFileOpts);

logger.trace({ err }, 'parsing the output of `npm ls` failed');
throw new Error(
'`npm ls` failed to provide a list of installed dependencies. Please enable trace level logs for more information.'
);
throw new Error('`npm ls` failed to provide a list of installed dependencies. Please enable trace level logs for more information.');
}
};
{
"name": "@contrast/library-analysis",
"version": "1.12.1",
"version": "1.13.0",
"description": "Handles library reporting and library usage analysis",

@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE",

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