hermes-test 0.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.
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execFileSync } = require("child_process");
5
+ const path = require("path");
6
+ const os = require("os");
7
+
8
+ const platform = os.platform();
9
+ const arch = os.arch();
10
+
11
+ const pkgMap = {
12
+ "darwin-arm64": "@hermes-test/darwin-arm64",
13
+ "darwin-x64": "@hermes-test/darwin-x64",
14
+ "linux-x64": "@hermes-test/linux-x64",
15
+ };
16
+
17
+ const key = `${platform}-${arch}`;
18
+ const pkg = pkgMap[key];
19
+
20
+ if (!pkg) {
21
+ console.error(`hermes-test: unsupported platform ${key}`);
22
+ console.error(`Supported: ${Object.keys(pkgMap).join(", ")}`);
23
+ process.exit(1);
24
+ }
25
+
26
+ let binPath;
27
+ try {
28
+ binPath = path.join(require.resolve(`${pkg}/package.json`), "..", "bin", "hermes-test");
29
+ } catch {
30
+ console.error(`hermes-test: platform package ${pkg} not installed.`);
31
+ console.error(`Run: npm install --save-dev ${pkg}`);
32
+ process.exit(1);
33
+ }
34
+
35
+ try {
36
+ execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
37
+ } catch (e) {
38
+ process.exit(e.status ?? 1);
39
+ }