tombi 1.1.4 → 1.1.6

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/tombi CHANGED
@@ -43,29 +43,43 @@ const binPath =
43
43
  : PLATFORMS?.[platform]?.[arch]);
44
44
 
45
45
  if (binPath) {
46
- const packageManager = detectPackageManager();
47
- const result = require("node:child_process").spawnSync(
48
- require.resolve(binPath),
49
- process.argv.slice(2),
50
- {
51
- shell: false,
52
- stdio: "inherit",
53
- env: {
54
- ...env,
55
- JS_RUNTIME_VERSION: version,
56
- JS_RUNTIME_NAME: release.name,
57
- ...(packageManager != null
58
- ? { NODE_PACKAGE_MANAGER: packageManager }
59
- : {}),
46
+ let resolvedBinPath;
47
+ try {
48
+ resolvedBinPath = require.resolve(binPath);
49
+ } catch {
50
+ console.error(
51
+ `The Tombi CLI binary "${binPath}" could not be found. ` +
52
+ "The platform-specific optional package may not be installed. " +
53
+ "Please reinstall tombi with optional dependencies enabled.",
54
+ );
55
+ process.exitCode = 1;
56
+ }
57
+
58
+ if (resolvedBinPath) {
59
+ const packageManager = detectPackageManager();
60
+ const result = require("node:child_process").spawnSync(
61
+ resolvedBinPath,
62
+ process.argv.slice(2),
63
+ {
64
+ shell: false,
65
+ stdio: "inherit",
66
+ env: {
67
+ ...env,
68
+ JS_RUNTIME_VERSION: version,
69
+ JS_RUNTIME_NAME: release.name,
70
+ ...(packageManager != null
71
+ ? { NODE_PACKAGE_MANAGER: packageManager }
72
+ : {}),
73
+ },
60
74
  },
61
- },
62
- );
75
+ );
63
76
 
64
- if (result.error) {
65
- throw result.error;
66
- }
77
+ if (result.error) {
78
+ throw result.error;
79
+ }
67
80
 
68
- process.exitCode = result.status;
81
+ process.exitCode = result.status;
82
+ }
69
83
  } else {
70
84
  console.error(
71
85
  "The Tombi CLI package doesn't ship with prebuilt binaries for your platform yet. " +
package/package.json CHANGED
@@ -1,19 +1,15 @@
1
1
  {
2
2
  "name": "tombi",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "🦅 TOML Toolkit 🦅",
5
5
  "bin": {
6
6
  "tombi": "bin/tombi"
7
7
  },
8
8
  "files": [
9
9
  "bin/tombi",
10
- "scripts/postinstall.js",
11
10
  "README.md",
12
11
  "LICENSE"
13
12
  ],
14
- "scripts": {
15
- "postinstall": "node ./scripts/postinstall.js"
16
- },
17
13
  "keywords": [
18
14
  "toml",
19
15
  "cli",
@@ -40,13 +36,13 @@
40
36
  "provenance": true
41
37
  },
42
38
  "optionalDependencies": {
43
- "@tombi-toml/cli-win32-x64": "1.1.4",
44
- "@tombi-toml/cli-win32-arm64": "1.1.4",
45
- "@tombi-toml/cli-darwin-x64": "1.1.4",
46
- "@tombi-toml/cli-darwin-arm64": "1.1.4",
47
- "@tombi-toml/cli-linux-x64": "1.1.4",
48
- "@tombi-toml/cli-linux-arm64": "1.1.4",
49
- "@tombi-toml/cli-linux-x64-musl": "1.1.4",
50
- "@tombi-toml/cli-linux-arm64-musl": "1.1.4"
39
+ "@tombi-toml/cli-win32-x64": "1.1.6",
40
+ "@tombi-toml/cli-win32-arm64": "1.1.6",
41
+ "@tombi-toml/cli-darwin-x64": "1.1.6",
42
+ "@tombi-toml/cli-darwin-arm64": "1.1.6",
43
+ "@tombi-toml/cli-linux-x64": "1.1.6",
44
+ "@tombi-toml/cli-linux-arm64": "1.1.6",
45
+ "@tombi-toml/cli-linux-x64-musl": "1.1.6",
46
+ "@tombi-toml/cli-linux-arm64-musl": "1.1.6"
51
47
  }
52
48
  }
@@ -1,59 +0,0 @@
1
- const { platform, arch } = process;
2
- // tombi-ignore lint/style/useNodejsImportProtocol: would be a breaking change, consider bumping node version next major version
3
- const { execSync } = require("child_process");
4
-
5
- function isMusl() {
6
- let stderr;
7
- try {
8
- stderr = execSync("ldd --version", {
9
- stdio: ["pipe", "pipe", "pipe"],
10
- });
11
- } catch (err) {
12
- stderr = err.stderr;
13
- }
14
- if (stderr.indexOf("musl") > -1) {
15
- return true;
16
- }
17
- return false;
18
- }
19
-
20
- const PLATFORMS = {
21
- win32: {
22
- x64: "@tombi-toml/cli-win32-x64/tombi.exe",
23
- arm64: "@tombi-toml/cli-win32-arm64/tombi.exe",
24
- },
25
- darwin: {
26
- x64: "@tombi-toml/cli-darwin-x64/tombi",
27
- arm64: "@tombi-toml/cli-darwin-arm64/tombi",
28
- },
29
- linux: {
30
- x64: "@tombi-toml/cli-linux-x64/tombi",
31
- arm64: "@tombi-toml/cli-linux-arm64/tombi",
32
- },
33
- "linux-musl": {
34
- x64: "@tombi-toml/cli-linux-x64-musl/tombi",
35
- arm64: "@tombi-toml/cli-linux-arm64-musl/tombi",
36
- },
37
- };
38
-
39
- const binName =
40
- platform === "linux" && isMusl()
41
- ? PLATFORMS?.["linux-musl"]?.[arch]
42
- : PLATFORMS?.[platform]?.[arch];
43
-
44
- if (binName) {
45
- let binPath;
46
- try {
47
- binPath = require.resolve(binName);
48
- } catch {
49
- console.warn(
50
- `The Tombi CLI postinstall script failed to resolve the binary file "${binName}". Running Tombi from the npm package will probably not work correctly.`,
51
- );
52
- }
53
- } else {
54
- console.warn(
55
- "The Tombi CLI package doesn't ship with prebuilt binaries for your platform yet. " +
56
- "You can still use the CLI by cloning the tombi-toml/tombi repo from GitHub, " +
57
- "and follow the instructions there to build the CLI for your platform.",
58
- );
59
- }