mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-29 20:41:47 -04:00
13 lines
558 B
TypeScript
13 lines
558 B
TypeScript
import { Config } from '@pnpm/config'
|
|
|
|
export default function getNodeMirror (rawConfig: Config['rawConfig'], releaseDir: string): string {
|
|
// This is a dynamic lookup since the 'use-node-version' option is allowed to be '<releaseDir>/<version>'
|
|
const configKey = `node-mirror:${releaseDir}`
|
|
const nodeMirror = rawConfig[configKey] ?? `https://nodejs.org/download/${releaseDir}/`
|
|
return normalizeNodeMirror(nodeMirror)
|
|
}
|
|
|
|
function normalizeNodeMirror (nodeMirror: string): string {
|
|
return nodeMirror.endsWith('/') ? nodeMirror : `${nodeMirror}/`
|
|
}
|