@daml-tools/daml-lint 0.3.4 → 0.3.5
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 +3 -0
- package/bin/daml-lint.cjs +31 -6
- package/package.json +5 -5
package/README.md
CHANGED
package/bin/daml-lint.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-lint-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-lint 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-lint is not distributed for ${process.platform}/${process.arch}. ` +
|
|
29
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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-lint 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
|
-
|
|
79
|
+
if (isLinuxMusl()) {
|
|
80
|
+
console.error(linuxLibcMessage());
|
|
81
|
+
} else {
|
|
82
|
+
console.error(`Failed to start daml-lint: ${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-lint",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "npm-distributed daml-lint CLI",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"directory": "crates/daml-lint/npm/cli"
|
|
10
10
|
},
|
|
11
11
|
"bin": {
|
|
12
|
-
"daml-lint": "
|
|
12
|
+
"daml-lint": "bin/daml-lint.cjs"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"bin",
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
18
|
"optionalDependencies": {
|
|
19
|
-
"@daml-tools/daml-lint-darwin-arm64": "0.3.
|
|
20
|
-
"@daml-tools/daml-lint-linux-x64": "0.3.
|
|
21
|
-
"@daml-tools/daml-lint-win32-x64": "0.3.
|
|
19
|
+
"@daml-tools/daml-lint-darwin-arm64": "0.3.5",
|
|
20
|
+
"@daml-tools/daml-lint-linux-x64": "0.3.5",
|
|
21
|
+
"@daml-tools/daml-lint-win32-x64": "0.3.5"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|