diff --git a/packages/@biomejs/biome/bin/biome b/packages/@biomejs/biome/bin/biome index 1f083650770c..a96a18e25a59 100644 --- a/packages/@biomejs/biome/bin/biome +++ b/packages/@biomejs/biome/bin/biome @@ -1,5 +1,21 @@ #!/usr/bin/env node const { platform, arch, env, version, release } = process; +const { execSync } = require("child_process"); + +function isMusl() { + let stderr; + try { + stderr = execSync("ldd --version", { + stdio: ['pipe', 'pipe', 'pipe'] + }); + } catch (err) { + stderr = err.stderr; + } + if (stderr.indexOf("musl") > -1) { + return true; + } + return false; +} const PLATFORMS = { win32: { @@ -14,12 +30,21 @@ const PLATFORMS = { x64: "@biomejs/cli-linux-x64/biome", arm64: "@biomejs/cli-linux-arm64/biome", }, + "linux-musl": { + x64: "@biomejs/cli-linux-x64-musl/biome", + arm64: "@biomejs/cli-linux-arm64-musl/biome", + }, }; if (env.ROME_BINARY) { console.warn(`[WARN] The environment variable "ROME_BINARY" is deprecated. Use "BIOME_BINARY" instead.`) } -const binPath = env.BIOME_BINARY || env.ROME_BINARY || PLATFORMS?.[platform]?.[arch]; +const binPath = env.BIOME_BINARY || env.ROME_BINARY || + (platform === "linux" && isMusl() + ? PLATFORMS?.["linux-musl"]?.[arch] + : PLATFORMS?.[platform]?.[arch] + ); + if (binPath) { const packageManager = detectPackageManager(); const result = require("child_process").spawnSync(