Skip to content

Commit

Permalink
deps: npm-install-checks@6.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Mar 23, 2023
1 parent 704cd1e commit d5ce7ca
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
23 changes: 22 additions & 1 deletion node_modules/npm-install-checks/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const checkEngine = (target, npmVer, nodeVer, force = false) => {
}
}

const isMusl = (file) => file.includes('libc.musl-') || file.includes('ld-musl-')

const checkPlatform = (target, force = false) => {
if (force) {
return
Expand All @@ -30,16 +32,35 @@ const checkPlatform = (target, force = false) => {
const osOk = target.os ? checkList(platform, target.os) : true
const cpuOk = target.cpu ? checkList(arch, target.cpu) : true

if (!osOk || !cpuOk) {
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 (platform !== 'linux') {
libcOk = false
} else {
const report = process.report.getReport()
if (report.header?.glibcRuntimeVersion) {
libcFamily = 'glibc'
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
libcFamily = 'musl'
}
libcOk = libcFamily ? checkList(libcFamily, target.libc) : false
}
}

if (!osOk || !cpuOk || !libcOk) {
throw Object.assign(new Error('Unsupported platform'), {
pkgid: target._id,
current: {
os: platform,
cpu: arch,
libc: libcFamily,
},
required: {
os: target.os,
cpu: target.cpu,
libc: target.libc,
},
code: 'EBADPLATFORM',
})
Expand Down
8 changes: 4 additions & 4 deletions node_modules/npm-install-checks/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "npm-install-checks",
"version": "6.0.0",
"version": "6.1.0",
"description": "Check the engines and platform fields in package.json",
"main": "lib/index.js",
"dependencies": {
"semver": "^7.1.1"
},
"devDependencies": {
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "4.5.1",
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.12.0",
"tap": "^16.0.1"
},
"scripts": {
Expand Down Expand Up @@ -39,7 +39,7 @@
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.5.1"
"version": "4.12.0"
},
"tap": {
"nyc-arg": [
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"node-gyp": "^9.3.1",
"nopt": "^7.1.0",
"npm-audit-report": "^4.0.0",
"npm-install-checks": "^6.0.0",
"npm-install-checks": "^6.1.0",
"npm-package-arg": "^10.1.0",
"npm-pick-manifest": "^8.0.1",
"npm-profile": "^7.0.1",
Expand Down Expand Up @@ -9346,9 +9346,9 @@
}
},
"node_modules/npm-install-checks": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.0.0.tgz",
"integrity": "sha512-SBU9oFglRVZnfElwAtF14NivyulDqF1VKqqwNsFW9HDcbHMAPHpRSsVFgKuwFGq/hVvWZExz62Th0kvxn/XE7Q==",
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.1.0.tgz",
"integrity": "sha512-udSGENih/5xKh3Ex+L0PtZcOt0Pa+6ppDLnpG5D49/EhMja3LupaY9E/DtJTxyFBwE09ot7Fc+H4DywnZNWTVA==",
"inBundle": true,
"dependencies": {
"semver": "^7.1.1"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"node-gyp": "^9.3.1",
"nopt": "^7.1.0",
"npm-audit-report": "^4.0.0",
"npm-install-checks": "^6.0.0",
"npm-install-checks": "^6.1.0",
"npm-package-arg": "^10.1.0",
"npm-pick-manifest": "^8.0.1",
"npm-profile": "^7.0.1",
Expand Down

0 comments on commit d5ce7ca

Please sign in to comment.