toktrack 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.js +24 -3
- package/bin/toktrack-darwin-arm64 +0 -0
- package/bin/toktrack-darwin-x64 +0 -0
- package/bin/toktrack-linux-arm64 +0 -0
- package/bin/toktrack-linux-musl-arm64 +0 -0
- package/bin/toktrack-linux-musl-x64 +0 -0
- package/bin/toktrack-linux-x64 +0 -0
- package/bin/toktrack-win32-x64.exe +0 -0
- package/package.json +1 -1
package/bin/run.js
CHANGED
|
@@ -1,26 +1,47 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { execFileSync } = require('child_process');
|
|
3
|
+
const fs = require('fs');
|
|
3
4
|
const path = require('path');
|
|
4
5
|
const os = require('os');
|
|
5
6
|
|
|
6
7
|
const platform = os.platform();
|
|
7
8
|
const arch = os.arch();
|
|
8
9
|
|
|
10
|
+
function isMusl() {
|
|
11
|
+
if (platform !== 'linux') return false;
|
|
12
|
+
try {
|
|
13
|
+
// Check for musl dynamic linker
|
|
14
|
+
const files = fs.readdirSync('/lib');
|
|
15
|
+
if (files.some(f => f.startsWith('ld-musl-'))) return true;
|
|
16
|
+
} catch {}
|
|
17
|
+
try {
|
|
18
|
+
const lddOutput = execFileSync('ldd', ['--version'], { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
19
|
+
if (lddOutput.toLowerCase().includes('musl')) return true;
|
|
20
|
+
} catch (e) {
|
|
21
|
+
// ldd --version writes to stderr on musl systems
|
|
22
|
+
if (e.stderr && e.stderr.toString().toLowerCase().includes('musl')) return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
9
27
|
// Platform mapping to binary names
|
|
10
28
|
const platformMap = {
|
|
11
29
|
'darwin-arm64': 'toktrack-darwin-arm64',
|
|
12
30
|
'darwin-x64': 'toktrack-darwin-x64',
|
|
13
31
|
'linux-x64': 'toktrack-linux-x64',
|
|
14
32
|
'linux-arm64': 'toktrack-linux-arm64',
|
|
33
|
+
'linux-musl-x64': 'toktrack-linux-musl-x64',
|
|
34
|
+
'linux-musl-arm64': 'toktrack-linux-musl-arm64',
|
|
15
35
|
'win32-x64': 'toktrack-win32-x64.exe',
|
|
16
36
|
};
|
|
17
37
|
|
|
18
|
-
const
|
|
38
|
+
const libc = isMusl() ? 'musl-' : '';
|
|
39
|
+
const key = `${platform}-${libc}${arch}`;
|
|
19
40
|
const binaryName = platformMap[key];
|
|
20
41
|
|
|
21
42
|
if (!binaryName) {
|
|
22
|
-
console.error(`Unsupported platform: ${
|
|
23
|
-
console.error('Supported platforms: darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64');
|
|
43
|
+
console.error(`Unsupported platform: ${key}`);
|
|
44
|
+
console.error('Supported platforms: darwin-arm64, darwin-x64, linux-x64, linux-arm64, linux-musl-x64, linux-musl-arm64, win32-x64');
|
|
24
45
|
process.exit(1);
|
|
25
46
|
}
|
|
26
47
|
|
|
Binary file
|
package/bin/toktrack-darwin-x64
CHANGED
|
Binary file
|
package/bin/toktrack-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/toktrack-linux-x64
CHANGED
|
Binary file
|
|
Binary file
|