@daml-tools/daml-fmt 0.2.2 → 0.2.4

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
@@ -9,3 +9,6 @@ npx daml-fmt --check ./daml
9
9
 
10
10
  The package installs a small JavaScript launcher plus an optional native
11
11
  platform package for the current operating system and CPU.
12
+
13
+ Supported npm platforms are macOS arm64, Linux x64 glibc 2.35 or newer, and
14
+ Windows x64.
package/bin/daml-fmt.cjs CHANGED
@@ -5,6 +5,8 @@ const { existsSync } = require("node:fs");
5
5
  const path = require("node:path");
6
6
  const { spawnSync } = require("node:child_process");
7
7
 
8
+ const supportedPlatforms = "Supported npm platforms are linux/x64 glibc 2.35+, darwin/arm64, and win32/x64.";
9
+
8
10
  const platformPackages = {
9
11
  "darwin:arm64": {
10
12
  name: "@daml-tools/daml-fmt-darwin-arm64",
@@ -23,10 +25,25 @@ const platformPackages = {
23
25
  const platformKey = `${process.platform}:${process.arch}`;
24
26
  const platformPackage = platformPackages[platformKey];
25
27
 
28
+ function isLinuxMusl() {
29
+ return (
30
+ process.platform === "linux" &&
31
+ process.report?.getReport &&
32
+ !process.report.getReport().header.glibcVersionRuntime
33
+ );
34
+ }
35
+
36
+ function linuxLibcMessage() {
37
+ return (
38
+ "daml-fmt is distributed for Linux x64 glibc 2.35+, but this host appears to use musl. " +
39
+ "Use the Cargo install path on Alpine/musl Linux."
40
+ );
41
+ }
42
+
26
43
  if (!platformPackage) {
27
44
  console.error(
28
45
  `daml-fmt is not distributed for ${process.platform}/${process.arch}. ` +
29
- "Supported npm platforms are linux/x64, darwin/arm64, and win32/x64.",
46
+ supportedPlatforms,
30
47
  );
31
48
  process.exit(1);
32
49
  }
@@ -37,10 +54,14 @@ try {
37
54
  const packageJsonPath = require.resolve(`${platformPackage.name}/package.json`);
38
55
  binaryPath = path.join(path.dirname(packageJsonPath), ...platformPackage.binary);
39
56
  } catch {
40
- console.error(
41
- `The native package ${platformPackage.name} is not installed. ` +
42
- "Reinstall @daml-tools/daml-fmt with optional dependencies enabled.",
43
- );
57
+ if (isLinuxMusl()) {
58
+ console.error(linuxLibcMessage());
59
+ } else {
60
+ console.error(
61
+ `The native package ${platformPackage.name} is not installed. ` +
62
+ "Reinstall @daml-tools/daml-fmt with optional dependencies enabled.",
63
+ );
64
+ }
44
65
  process.exit(1);
45
66
  }
46
67
 
@@ -55,7 +76,11 @@ const result = spawnSync(binaryPath, process.argv.slice(2), {
55
76
  });
56
77
 
57
78
  if (result.error) {
58
- console.error(`Failed to start daml-fmt: ${result.error.message}`);
79
+ if (isLinuxMusl()) {
80
+ console.error(linuxLibcMessage());
81
+ } else {
82
+ console.error(`Failed to start daml-fmt: ${result.error.message}`);
83
+ }
59
84
  process.exit(1);
60
85
  }
61
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daml-tools/daml-fmt",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "npm-distributed daml-fmt CLI",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -9,16 +9,16 @@
9
9
  "directory": "crates/daml-fmt/npm/cli"
10
10
  },
11
11
  "bin": {
12
- "daml-fmt": "./bin/daml-fmt.cjs"
12
+ "daml-fmt": "bin/daml-fmt.cjs"
13
13
  },
14
14
  "files": [
15
15
  "bin",
16
16
  "README.md"
17
17
  ],
18
18
  "optionalDependencies": {
19
- "@daml-tools/daml-fmt-darwin-arm64": "0.2.2",
20
- "@daml-tools/daml-fmt-linux-x64": "0.2.2",
21
- "@daml-tools/daml-fmt-win32-x64": "0.2.2"
19
+ "@daml-tools/daml-fmt-darwin-arm64": "0.2.4",
20
+ "@daml-tools/daml-fmt-linux-x64": "0.2.4",
21
+ "@daml-tools/daml-fmt-win32-x64": "0.2.4"
22
22
  },
23
23
  "publishConfig": {
24
24
  "access": "public"