MCPcopy Create free account
hub / github.com/alibaba/open-code-review / getPlatformPackageName

Function getPlatformPackageName

scripts/platform.js:21–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19};
20
21function getPlatformPackageName() {
22 const key = `${process.platform}-${process.arch}`;
23
24 try {
25 const parentPkg = JSON.parse(
26 fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8")
27 );
28 const optDeps = parentPkg.optionalDependencies || {};
29 for (const name of Object.keys(optDeps)) {
30 if (name.endsWith(`-${key}`)) {
31 return name;
32 }
33 }
34 } catch (_) {}
35
36 return PLATFORM_PKG[key] || null;
37}
38
39function resolveNativeBinary() {
40 const pkgName = getPlatformPackageName();

Callers 1

resolveNativeBinaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected