forked from cdxgen/cdxgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pnpmfile.cjs
More file actions
34 lines (33 loc) · 954 Bytes
/
Copy path.pnpmfile.cjs
File metadata and controls
34 lines (33 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function readPackage(pkg) {
// pnpm fetched metadata doesn't include libc. So we patch it based on the name to reduce duplicate binaries
if (pkg.name?.includes("cdxgen-plugins-bin") && pkg.name.includes("linux")) {
if (pkg.name?.includes("linuxmusl-") && !pkg.libc) {
pkg.libc = "musl";
} else if (pkg.name?.includes("linux-") && !pkg.libc) {
pkg.libc = "glibc";
}
} else if (
pkg.name?.includes("resolver-binding") &&
pkg.name.includes("linux")
) {
if (pkg.name?.includes("musl") && !pkg.libc) {
pkg.libc = "musl";
} else if (pkg.name?.includes("gnu") && !pkg.libc) {
pkg.libc = "glibc";
}
} else if (pkg.name?.includes("@biomejs")) {
if (pkg.name?.includes("linux") && !pkg.libc) {
if (pkg.name?.includes("musl")) {
pkg.libc = "musl";
} else {
pkg.libc = "glibc";
}
}
}
return pkg;
}
module.exports = {
hooks: {
readPackage,
},
};