hadome 0.0.0-stage → 0.5.2

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/hadome.js ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ // Runs the hadome binary of the platform package npm installed next to this one. Each platform
3
+ // package declares its os and cpu, so npm installs only the one that matches. Windows on ARM64 runs
4
+ // the x86-64 package, which declares both CPUs, through the emulation Windows 11 provides.
5
+ "use strict";
6
+
7
+ const { spawnSync } = require("node:child_process");
8
+
9
+ const platforms = {
10
+ "linux x64": "hadome-linux-x64",
11
+ "linux arm64": "hadome-linux-arm64",
12
+ "darwin x64": "hadome-darwin-x64",
13
+ "darwin arm64": "hadome-darwin-arm64",
14
+ "win32 x64": "hadome-win32-x64",
15
+ "win32 arm64": "hadome-win32-x64",
16
+ };
17
+
18
+ const key = `${process.platform} ${process.arch}`;
19
+ const pkg = platforms[key];
20
+ if (!pkg) {
21
+ console.error(`hadome: no prebuilt binary for ${key}. Supported: ${Object.keys(platforms).join(", ")}.`);
22
+ process.exit(2);
23
+ }
24
+
25
+ let binary;
26
+ try {
27
+ binary = require.resolve(`${pkg}/bin/hadome${process.platform === "win32" ? ".exe" : ""}`);
28
+ } catch {
29
+ console.error(`hadome: the package ${pkg} is not installed. It is an optional dependency of hadome; ` +
30
+ "reinstall without --no-optional (or --omit=optional).");
31
+ process.exit(2);
32
+ }
33
+
34
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
35
+ if (result.error) {
36
+ console.error(`hadome: cannot run ${binary}: ${result.error.message}`);
37
+ process.exit(2);
38
+ }
39
+ process.exit(result.status === null ? 2 : result.status);
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "hadome",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.5.2",
4
+ "license": "MIT",
5
+ "homepage": "https://github.com/rerorets/hadome",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/rerorets/hadome.git"
9
+ },
10
+ "description": "Reports the violations a change adds and the tests it weakens.",
11
+ "bin": {
12
+ "hadome": "bin/hadome.js"
13
+ },
14
+ "files": [
15
+ "bin",
16
+ "README.md",
17
+ "LICENSE",
18
+ "THIRD_PARTY_NOTICES"
19
+ ],
20
+ "optionalDependencies": {
21
+ "hadome-linux-x64": "0.5.2",
22
+ "hadome-linux-arm64": "0.5.2",
23
+ "hadome-darwin-x64": "0.5.2",
24
+ "hadome-darwin-arm64": "0.5.2",
25
+ "hadome-win32-x64": "0.5.2"
26
+ },
27
+ "engines": {
28
+ "node": ">=18"
29
+ }
30
+ }