Socket
Socket
Sign inDemoInstall

npm-install-checks

Package Overview
Dependencies
Maintainers
6
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-install-checks - npm Package Compare versions

Comparing version 7.0.0 to 7.1.0

lib/current-env.js

41

lib/index.js
const semver = require('semver')
const currentEnv = require('./current-env')
const { checkDevEngines } = require('./dev-engines')

@@ -23,4 +25,2 @@ const checkEngine = (target, npmVer, nodeVer, force = false) => {

const isMusl = (file) => file.includes('libc.musl-') || file.includes('ld-musl-')
const checkPlatform = (target, force = false, environment = {}) => {

@@ -31,24 +31,11 @@ if (force) {

const platform = environment.os || process.platform
const arch = environment.cpu || process.arch
const osOk = target.os ? checkList(platform, target.os) : true
const cpuOk = target.cpu ? checkList(arch, target.cpu) : true
const os = environment.os || currentEnv.os()
const cpu = environment.cpu || currentEnv.cpu()
const libc = environment.libc || currentEnv.libc(os)
let libcOk = true
let libcFamily = null
if (target.libc) {
// libc checks only work in linux, any value is a failure if we aren't
if (environment.libc) {
libcOk = checkList(environment.libc, target.libc)
} else if (platform !== 'linux') {
libcOk = false
} else {
const report = process.report.getReport()
if (report.header?.glibcVersionRuntime) {
libcFamily = 'glibc'
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
libcFamily = 'musl'
}
libcOk = libcFamily ? checkList(libcFamily, target.libc) : false
}
const osOk = target.os ? checkList(os, target.os) : true
const cpuOk = target.cpu ? checkList(cpu, target.cpu) : true
let libcOk = target.libc ? checkList(libc, target.libc) : true
if (target.libc && !libc) {
libcOk = false
}

@@ -60,5 +47,5 @@

current: {
os: platform,
cpu: arch,
libc: libcFamily,
os,
cpu,
libc,
},

@@ -104,2 +91,4 @@ required: {

checkPlatform,
checkDevEngines,
currentEnv,
}
{
"name": "npm-install-checks",
"version": "7.0.0",
"version": "7.1.0",
"description": "Check the engines and platform fields in package.json",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -31,1 +31,8 @@ # npm-install-checks

Error code: 'EBADPLATFORM'
### .checkDevEngines(wanted, current, opts)
Check if a package's `devEngines` property matches the current system environment.
Returns an array of `Error` objects, some of which may be warnings, this can be checked with `.isError` and `.isWarn`. Errors correspond to an error for a given "engine" failure, reasons for each engine "dependency" failure can be found within `.errors`.
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