Skip to content

Commit d5ce7ca

Browse files
committedMar 23, 2023
deps: npm-install-checks@6.1.0
1 parent 704cd1e commit d5ce7ca

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed
 

‎node_modules/npm-install-checks/lib/index.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const checkEngine = (target, npmVer, nodeVer, force = false) => {
2020
}
2121
}
2222

23+
const isMusl = (file) => file.includes('libc.musl-') || file.includes('ld-musl-')
24+
2325
const checkPlatform = (target, force = false) => {
2426
if (force) {
2527
return
@@ -30,16 +32,35 @@ const checkPlatform = (target, force = false) => {
3032
const osOk = target.os ? checkList(platform, target.os) : true
3133
const cpuOk = target.cpu ? checkList(arch, target.cpu) : true
3234

33-
if (!osOk || !cpuOk) {
35+
let libcOk = true
36+
let libcFamily = null
37+
if (target.libc) {
38+
// libc checks only work in linux, any value is a failure if we aren't
39+
if (platform !== 'linux') {
40+
libcOk = false
41+
} else {
42+
const report = process.report.getReport()
43+
if (report.header?.glibcRuntimeVersion) {
44+
libcFamily = 'glibc'
45+
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
46+
libcFamily = 'musl'
47+
}
48+
libcOk = libcFamily ? checkList(libcFamily, target.libc) : false
49+
}
50+
}
51+
52+
if (!osOk || !cpuOk || !libcOk) {
3453
throw Object.assign(new Error('Unsupported platform'), {
3554
pkgid: target._id,
3655
current: {
3756
os: platform,
3857
cpu: arch,
58+
libc: libcFamily,
3959
},
4060
required: {
4161
os: target.os,
4262
cpu: target.cpu,
63+
libc: target.libc,
4364
},
4465
code: 'EBADPLATFORM',
4566
})

‎node_modules/npm-install-checks/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "npm-install-checks",
3-
"version": "6.0.0",
3+
"version": "6.1.0",
44
"description": "Check the engines and platform fields in package.json",
55
"main": "lib/index.js",
66
"dependencies": {
77
"semver": "^7.1.1"
88
},
99
"devDependencies": {
10-
"@npmcli/eslint-config": "^3.0.1",
11-
"@npmcli/template-oss": "4.5.1",
10+
"@npmcli/eslint-config": "^4.0.0",
11+
"@npmcli/template-oss": "4.12.0",
1212
"tap": "^16.0.1"
1313
},
1414
"scripts": {
@@ -39,7 +39,7 @@
3939
"author": "GitHub Inc.",
4040
"templateOSS": {
4141
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
42-
"version": "4.5.1"
42+
"version": "4.12.0"
4343
},
4444
"tap": {
4545
"nyc-arg": [

‎package-lock.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"node-gyp": "^9.3.1",
126126
"nopt": "^7.1.0",
127127
"npm-audit-report": "^4.0.0",
128-
"npm-install-checks": "^6.0.0",
128+
"npm-install-checks": "^6.1.0",
129129
"npm-package-arg": "^10.1.0",
130130
"npm-pick-manifest": "^8.0.1",
131131
"npm-profile": "^7.0.1",
@@ -9346,9 +9346,9 @@
93469346
}
93479347
},
93489348
"node_modules/npm-install-checks": {
9349-
"version": "6.0.0",
9350-
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.0.0.tgz",
9351-
"integrity": "sha512-SBU9oFglRVZnfElwAtF14NivyulDqF1VKqqwNsFW9HDcbHMAPHpRSsVFgKuwFGq/hVvWZExz62Th0kvxn/XE7Q==",
9349+
"version": "6.1.0",
9350+
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.1.0.tgz",
9351+
"integrity": "sha512-udSGENih/5xKh3Ex+L0PtZcOt0Pa+6ppDLnpG5D49/EhMja3LupaY9E/DtJTxyFBwE09ot7Fc+H4DywnZNWTVA==",
93529352
"inBundle": true,
93539353
"dependencies": {
93549354
"semver": "^7.1.1"

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"node-gyp": "^9.3.1",
9595
"nopt": "^7.1.0",
9696
"npm-audit-report": "^4.0.0",
97-
"npm-install-checks": "^6.0.0",
97+
"npm-install-checks": "^6.1.0",
9898
"npm-package-arg": "^10.1.0",
9999
"npm-pick-manifest": "^8.0.1",
100100
"npm-profile": "^7.0.1",

0 commit comments

Comments
 (0)
Please sign in to comment.