+40
-12
lines changedFilter options
+40
-12
lines changed Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1
1
const process = require('node:process')
2
2
const nodeOs = require('node:os')
3
+
const fs = require('node:fs')
3
4
4
5
function isMusl (file) {
5
6
return file.includes('libc.musl-') || file.includes('ld-musl-')
@@ -13,12 +14,23 @@ function cpu () {
13
14
return process.arch
14
15
}
15
16
16
-
function libc (osName) {
17
-
// this is to make it faster on non linux machines
18
-
if (osName !== 'linux') {
17
+
const LDD_PATH = '/usr/bin/ldd'
18
+
function getFamilyFromFilesystem () {
19
+
try {
20
+
const content = fs.readFileSync(LDD_PATH, 'utf-8')
21
+
if (content.includes('musl')) {
22
+
return 'musl'
23
+
}
24
+
if (content.includes('GNU C Library')) {
25
+
return 'glibc'
26
+
}
27
+
return null
28
+
} catch {
19
29
return undefined
20
30
}
21
-
let family
31
+
}
32
+
33
+
function getFamilyFromReport () {
22
34
const originalExclude = process.report.excludeNetwork
23
35
process.report.excludeNetwork = true
24
36
const report = process.report.getReport()
@@ -27,6 +39,22 @@ function libc (osName) {
27
39
family = 'glibc'
28
40
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
29
41
family = 'musl'
42
+
} else {
43
+
family = null
44
+
}
45
+
return family
46
+
}
47
+
48
+
let family
49
+
function libc (osName) {
50
+
if (osName !== 'linux') {
51
+
return undefined
52
+
}
53
+
if (family === undefined) {
54
+
family = getFamilyFromFilesystem()
55
+
if (family === undefined) {
56
+
family = getFamilyFromReport()
57
+
}
30
58
}
31
59
return family
32
60
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
1
1
{
2
2
"name": "npm-install-checks",
3
-
"version": "7.1.0",
3
+
"version": "7.1.1",
4
4
"description": "Check the engines and platform fields in package.json",
5
5
"main": "lib/index.js",
6
6
"dependencies": {
7
7
"semver": "^7.1.1"
8
8
},
9
9
"devDependencies": {
10
10
"@npmcli/eslint-config": "^5.0.0",
11
-
"@npmcli/template-oss": "4.23.3",
11
+
"@npmcli/template-oss": "4.23.4",
12
12
"tap": "^16.0.1"
13
13
},
14
14
"scripts": {
@@ -40,7 +40,7 @@
40
40
"author": "GitHub Inc.",
41
41
"templateOSS": {
42
42
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
43
-
"version": "4.23.3",
43
+
"version": "4.23.4",
44
44
"publish": "true"
45
45
},
46
46
"tap": {
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@
128
128
"nopt": "^8.0.0",
129
129
"normalize-package-data": "^7.0.0",
130
130
"npm-audit-report": "^6.0.0",
131
-
"npm-install-checks": "^7.1.0",
131
+
"npm-install-checks": "^7.1.1",
132
132
"npm-package-arg": "^12.0.0",
133
133
"npm-pick-manifest": "^10.0.0",
134
134
"npm-profile": "^11.0.1",
@@ -12167,9 +12167,9 @@
12167
12167
}
12168
12168
},
12169
12169
"node_modules/npm-install-checks": {
12170
-
"version": "7.1.0",
12171
-
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-7.1.0.tgz",
12172
-
"integrity": "sha512-bkTildVlofeMX7wiOaWk3PlW7YcBXAuEc7TWpOxwUgalG5ZvgT/ms+6OX9zt7iGLv4+VhKbRZhpOfgQJzk1YAw==",
12170
+
"version": "7.1.1",
12171
+
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-7.1.1.tgz",
12172
+
"integrity": "sha512-u6DCwbow5ynAX5BdiHQ9qvexme4U3qHW3MWe5NqH+NeBm0LbiH6zvGjNNew1fY+AZZUtVHbOPF3j7mJxbUzpXg==",
12173
12173
"inBundle": true,
12174
12174
"license": "BSD-2-Clause",
12175
12175
"dependencies": {
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@
95
95
"nopt": "^8.0.0",
96
96
"normalize-package-data": "^7.0.0",
97
97
"npm-audit-report": "^6.0.0",
98
-
"npm-install-checks": "^7.1.0",
98
+
"npm-install-checks": "^7.1.1",
99
99
"npm-package-arg": "^12.0.0",
100
100
"npm-pick-manifest": "^10.0.0",
101
101
"npm-profile": "^11.0.1",
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4