moondesk 0.13.2 → 0.13.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 +1 -1
- package/npm/install-binary.js +66 -1
- package/npm/moondesk.js +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ Your code stays on your machine unless a tool you run sends it somewhere else.
|
|
|
52
52
|
| **Permissions** | Use full local tools or a reduced read-only mode. |
|
|
53
53
|
| **Verified installs** | Download the matching native binary on first run and verify it against the release SHA-256. |
|
|
54
54
|
|
|
55
|
-
MoonDesk runs on **Windows, macOS, and Linux**.
|
|
55
|
+
MoonDesk runs on **Windows, macOS, and Linux**. Prebuilt Linux binaries are currently provided for x64/arm64 systems with **glibc 2.34 or newer**; musl-based distributions such as Alpine are not yet supported.
|
|
56
56
|
|
|
57
57
|
## Why MoonDesk?
|
|
58
58
|
|
package/npm/install-binary.js
CHANGED
|
@@ -28,10 +28,71 @@ const supportedTargets = new Set([
|
|
|
28
28
|
"win32-x64",
|
|
29
29
|
]);
|
|
30
30
|
|
|
31
|
+
const MIN_LINUX_GLIBC_VERSION = "2.34";
|
|
32
|
+
const UNSUPPORTED_RUNTIME_ERROR_CODE = "MOONDESK_UNSUPPORTED_RUNTIME";
|
|
33
|
+
|
|
34
|
+
function unsupportedRuntimeError(message) {
|
|
35
|
+
const error = new Error(message);
|
|
36
|
+
error.code = UNSUPPORTED_RUNTIME_ERROR_CODE;
|
|
37
|
+
return error;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function parseLibcVersion(value) {
|
|
41
|
+
if (typeof value !== "string") return null;
|
|
42
|
+
const match = /^(\d+)\.(\d+)(?:\.(\d+))?$/.exec(value.trim());
|
|
43
|
+
if (!match) return null;
|
|
44
|
+
return match.slice(1).map((part) => Number(part ?? 0));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function compareLibcVersions(left, right) {
|
|
48
|
+
const a = parseLibcVersion(left);
|
|
49
|
+
const b = parseLibcVersion(right);
|
|
50
|
+
if (!a || !b) return null;
|
|
51
|
+
for (let index = 0; index < Math.max(a.length, b.length); index += 1) {
|
|
52
|
+
const leftPart = a[index] ?? 0;
|
|
53
|
+
const rightPart = b[index] ?? 0;
|
|
54
|
+
if (leftPart < rightPart) return -1;
|
|
55
|
+
if (leftPart > rightPart) return 1;
|
|
56
|
+
}
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function detectedLinuxGlibcVersion(processReport = process.report) {
|
|
61
|
+
try {
|
|
62
|
+
if (!processReport || typeof processReport.getReport !== "function") return null;
|
|
63
|
+
const version = processReport.getReport().header?.glibcVersionRuntime;
|
|
64
|
+
return typeof version === "string" ? version : null;
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function assertLinuxRuntimeCompatibility(platform = process.platform, options = {}) {
|
|
71
|
+
if (platform !== "linux") return null;
|
|
72
|
+
|
|
73
|
+
const glibcVersion = Object.prototype.hasOwnProperty.call(options, "glibcVersion")
|
|
74
|
+
? options.glibcVersion
|
|
75
|
+
: detectedLinuxGlibcVersion(options.processReport);
|
|
76
|
+
|
|
77
|
+
if (!parseLibcVersion(glibcVersion)) {
|
|
78
|
+
throw unsupportedRuntimeError(
|
|
79
|
+
`MoonDesk prebuilt Linux binaries require detectable glibc ${MIN_LINUX_GLIBC_VERSION} or newer; musl-based or unknown-libc environments such as Alpine are not currently supported.`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (compareLibcVersions(glibcVersion, MIN_LINUX_GLIBC_VERSION) < 0) {
|
|
84
|
+
throw unsupportedRuntimeError(
|
|
85
|
+
`MoonDesk prebuilt Linux binaries require glibc ${MIN_LINUX_GLIBC_VERSION} or newer; detected glibc ${glibcVersion}.`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return glibcVersion;
|
|
90
|
+
}
|
|
91
|
+
|
|
31
92
|
function resolveTarget(platform = process.platform, arch = process.arch) {
|
|
32
93
|
const target = `${platform}-${arch}`;
|
|
33
94
|
if (!supportedTargets.has(target)) {
|
|
34
|
-
throw
|
|
95
|
+
throw unsupportedRuntimeError(
|
|
35
96
|
`MoonDesk does not provide a prebuilt binary for ${target}. Supported targets: ${Array.from(supportedTargets).join(", ")}`,
|
|
36
97
|
);
|
|
37
98
|
}
|
|
@@ -343,6 +404,7 @@ async function acquireInstallLock(
|
|
|
343
404
|
|
|
344
405
|
async function ensureBinary(options = {}) {
|
|
345
406
|
const targetInfo = resolveTarget(options.platform, options.arch);
|
|
407
|
+
assertLinuxRuntimeCompatibility(targetInfo.platform, options);
|
|
346
408
|
const installDir = options.installDir ?? defaultInstallDir(targetInfo.target);
|
|
347
409
|
const releaseBaseUrl = options.releaseBaseUrl ?? defaultReleaseBaseUrl;
|
|
348
410
|
const fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
@@ -496,6 +558,9 @@ function createDownloadProgressReporter(writer = process.stderr) {
|
|
|
496
558
|
}
|
|
497
559
|
|
|
498
560
|
module.exports = {
|
|
561
|
+
MIN_LINUX_GLIBC_VERSION,
|
|
562
|
+
UNSUPPORTED_RUNTIME_ERROR_CODE,
|
|
563
|
+
assertLinuxRuntimeCompatibility,
|
|
499
564
|
cleanupOldBinaryVersions,
|
|
500
565
|
createDownloadProgressReporter,
|
|
501
566
|
ensureBinary,
|
package/npm/moondesk.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const fs = require("node:fs");
|
|
4
4
|
const { spawn } = require("node:child_process");
|
|
5
5
|
const {
|
|
6
|
+
UNSUPPORTED_RUNTIME_ERROR_CODE,
|
|
6
7
|
cleanupOldBinaryVersions,
|
|
7
8
|
createDownloadProgressReporter,
|
|
8
9
|
ensureBinary,
|
|
@@ -187,9 +188,11 @@ async function orchestrate(options = {}) {
|
|
|
187
188
|
stopUpdateMonitor();
|
|
188
189
|
cleanupEphemeralUpdateFiles(updateStatePath, updateRequestPath);
|
|
189
190
|
logger.error(`MoonDesk could not prepare its native binary: ${error.message}`);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
if (error?.code !== UNSUPPORTED_RUNTIME_ERROR_CODE) {
|
|
192
|
+
logger.error(
|
|
193
|
+
"Check your network connection and the matching GitHub Release, then run MoonDesk again.",
|
|
194
|
+
);
|
|
195
|
+
}
|
|
193
196
|
return { code: 1, signal: null };
|
|
194
197
|
}
|
|
195
198
|
|