mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-28 03:51:40 -04:00
The lockfile now includes musl Linux builds (sourced from unofficial-builds.nodejs.org) alongside the standard glibc variants, so that `node@runtime:` works out of the box on Alpine Linux and other musl-based distributions. `env use` can download node.js artifacts for systems that use musl.
34 lines
870 B
TypeScript
34 lines
870 B
TypeScript
import { getNormalizedArch } from './normalizeArch.js'
|
|
|
|
export interface NodeArtifactAddress {
|
|
basename: string
|
|
extname: string
|
|
dirname: string
|
|
}
|
|
|
|
export interface GetNodeArtifactAddressOptions {
|
|
version: string
|
|
baseUrl: string
|
|
platform: string
|
|
arch: string
|
|
libc?: string
|
|
}
|
|
|
|
export function getNodeArtifactAddress ({
|
|
version,
|
|
baseUrl,
|
|
platform,
|
|
arch,
|
|
libc,
|
|
}: GetNodeArtifactAddressOptions): NodeArtifactAddress {
|
|
const isWindowsPlatform = platform === 'win32'
|
|
const normalizedPlatform = isWindowsPlatform ? 'win' : platform
|
|
const normalizedArch = getNormalizedArch(platform, arch, version)
|
|
const archSuffix = libc === 'musl' ? '-musl' : ''
|
|
return {
|
|
dirname: `${baseUrl}v${version}`,
|
|
basename: `node-v${version}-${normalizedPlatform}-${normalizedArch}${archSuffix}`,
|
|
extname: isWindowsPlatform ? '.zip' : '.tar.gz',
|
|
}
|
|
}
|