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

Function getPlatformPackageName

scripts/platform.js:18–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

resolveNativeBinaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected