npm-install-checks
Advanced tools
Comparing version 7.0.0 to 7.1.0
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`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11570
6
261
37
1