-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (23 loc) · 790 Bytes
/
index.js
File metadata and controls
27 lines (23 loc) · 790 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
const os = require("os");
const supportedPlatforms = ["linux", "darwin", "win32"];
const supportedArches = ["x64", "arm64"];
const platform = os.platform();
const arch = os.arch();
for (const platform of supportedPlatforms) {
if (!supportedPlatforms.includes(platform)) {
console.error(`Unsupported platform: ${platform}`);
process.exit(1);
}
}
for (const arch of supportedArches) {
if (!supportedArches.includes(arch)) {
console.error(`Unsupported arch: ${arch}`);
process.exit(1);
}
}
if (platform === "win32" && arch === "arm64") {
console.error(`Unsupported platform-arch: ${platform}-${arch}`);
process.exit(1);
}
let nativePackageName = `@rgb-tools/rgb-lib-${platform}-${arch}`;
module.exports = require(nativePackageName);