@omnidist/omnidist 0.0.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/omnidist.js +42 -0
- package/package.json +21 -0
package/omnidist.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
const platform = os.platform();
|
|
6
|
+
const arch = os.arch();
|
|
7
|
+
|
|
8
|
+
const platformMap = {
|
|
9
|
+
'darwin': { x64: 'darwin-x64', arm64: 'darwin-arm64' },
|
|
10
|
+
'linux': { x64: 'linux-x64', arm64: 'linux-arm64' },
|
|
11
|
+
'win32': { x64: 'win32-x64' }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const archMap = { x64: 'x64', arm64: 'arm64', ia32: 'x86' };
|
|
15
|
+
const cpu = archMap[arch] || arch;
|
|
16
|
+
|
|
17
|
+
const osKey = platform === 'win32' ? 'win32' : platform;
|
|
18
|
+
const platformKey = platformMap[osKey]?.[cpu];
|
|
19
|
+
|
|
20
|
+
if (!platformKey) {
|
|
21
|
+
console.error('Unsupported platform: ' + platform + '/' + cpu);
|
|
22
|
+
console.error('Expected package: omnidist-<os>-<cpu>');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const packageName = '@omnidist/omnidist-' + platformKey;
|
|
27
|
+
const binDir = path.join(__dirname, '..', packageName, 'bin');
|
|
28
|
+
const binaryName = platform === 'win32' ? 'omnidist.exe' : 'omnidist';
|
|
29
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const { execFileSync } = require('child_process');
|
|
33
|
+
process.exit(execFileSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' }));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
if (e.code === 'ENOENT') {
|
|
36
|
+
console.error('Binary not found: ' + binaryPath);
|
|
37
|
+
console.error('Expected platform package: ' + packageName);
|
|
38
|
+
console.error('This may be an unsupported platform or installation issue.');
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
process.exit(e.status || 1);
|
|
42
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bin": {
|
|
3
|
+
"omnidist": "omnidist.js"
|
|
4
|
+
},
|
|
5
|
+
"description": "Meta package for omnidist",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": "\u003e=16"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"omnidist.js"
|
|
11
|
+
],
|
|
12
|
+
"name": "@omnidist/omnidist",
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@omnidist/omnidist-darwin-arm64": "0.0.0",
|
|
15
|
+
"@omnidist/omnidist-darwin-x64": "0.0.0",
|
|
16
|
+
"@omnidist/omnidist-linux-arm64": "0.0.0",
|
|
17
|
+
"@omnidist/omnidist-linux-x64": "0.0.0",
|
|
18
|
+
"@omnidist/omnidist-win32-x64": "0.0.0"
|
|
19
|
+
},
|
|
20
|
+
"version": "0.0.0"
|
|
21
|
+
}
|