mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-01 14:02:13 -04:00
31 lines
781 B
TypeScript
31 lines
781 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
|
|
}
|
|
|
|
export function getNodeArtifactAddress ({
|
|
version,
|
|
baseUrl,
|
|
platform,
|
|
arch,
|
|
}: GetNodeArtifactAddressOptions): NodeArtifactAddress {
|
|
const isWindowsPlatform = platform === 'win32'
|
|
const normalizedPlatform = isWindowsPlatform ? 'win' : platform
|
|
const normalizedArch = getNormalizedArch(platform, arch, version)
|
|
return {
|
|
dirname: `${baseUrl}v${version}`,
|
|
basename: `node-v${version}-${normalizedPlatform}-${normalizedArch}`,
|
|
extname: isWindowsPlatform ? '.zip' : '.tar.gz',
|
|
}
|
|
}
|