moth-cli 0.3.1 → 0.4.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/README.md CHANGED
@@ -25,7 +25,11 @@ curl -fsSL https://raw.githubusercontent.com/nikolasgioannou/moth/main/install.s
25
25
  npm install -g moth-cli
26
26
  ```
27
27
 
28
- Or grab a binary from [releases](https://github.com/nikolasgioannou/moth/releases). macOS, Linux and Windows.
28
+ The npm launcher starts Node before it starts moth, which adds roughly 30ms per invocation. Homebrew and the install script give you the binary itself, so prefer them if you are running moth in a loop.
29
+
30
+ Or grab a binary from [releases](https://github.com/nikolasgioannou/moth/releases). macOS, Linux and Windows, glibc and musl.
31
+
32
+ On Alpine, the binary needs `libstdc++`, which the base image does not carry: `apk add libstdc++`. Node's Alpine images already have it.
29
33
 
30
34
  ## Use it
31
35
 
package/bin/moth.cjs CHANGED
@@ -1,11 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- // Finds the binary npm installed for this platform and runs it. Only the
4
- // matching platform package is downloaded, so nobody pays for five binaries.
5
3
  const { spawnSync } = require("node:child_process");
6
4
 
7
5
  const platform = process.platform === "win32" ? "windows" : process.platform;
8
- const name = "moth-cli-" + platform + "-" + process.arch;
6
+ // A glibc binary cannot load on a musl system at all, so the two Linux builds
7
+ // are separate packages. Node reports a glibc version only when it is running
8
+ // against glibc, which is how detect-libc tells them apart.
9
+ let libc = "";
10
+ if (process.platform === "linux") {
11
+ try {
12
+ libc = process.report.getReport().header.glibcVersionRuntime ? "" : "-musl";
13
+ } catch {}
14
+ }
15
+ const name = "moth-cli-" + platform + "-" + process.arch + libc;
9
16
  const binary = process.platform === "win32" ? "moth.exe" : "moth";
10
17
 
11
18
  let executable;
@@ -24,4 +31,9 @@ if (result.error) {
24
31
  console.error("moth: " + result.error.message);
25
32
  process.exit(1);
26
33
  }
34
+ // 127 from the dynamic loader, not from moth. Alpine ships neither libstdc++
35
+ // nor libgcc, which the binary needs, and the loader's own message is opaque.
36
+ if (result.status === 127 && libc === "-musl") {
37
+ console.error("moth: the binary could not load its shared libraries. Try: apk add libstdc++");
38
+ }
27
39
  process.exit(result.status === null ? 1 : result.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moth-cli",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "An opinionated issue tracker that lives in your repo. Tickets are markdown files with an enforced schema.",
5
5
  "keywords": [
6
6
  "issue-tracker",
@@ -22,10 +22,12 @@
22
22
  "bin"
23
23
  ],
24
24
  "optionalDependencies": {
25
- "moth-cli-darwin-arm64": "0.3.1",
26
- "moth-cli-darwin-x64": "0.3.1",
27
- "moth-cli-linux-arm64": "0.3.1",
28
- "moth-cli-linux-x64": "0.3.1",
29
- "moth-cli-windows-x64": "0.3.1"
25
+ "moth-cli-darwin-arm64": "0.4.0",
26
+ "moth-cli-darwin-x64": "0.4.0",
27
+ "moth-cli-linux-arm64": "0.4.0",
28
+ "moth-cli-linux-x64": "0.4.0",
29
+ "moth-cli-linux-arm64-musl": "0.4.0",
30
+ "moth-cli-linux-x64-musl": "0.4.0",
31
+ "moth-cli-windows-x64": "0.4.0"
30
32
  }
31
33
  }