From 41ff72655975bd51cab0327fa583b6e92b6d3061 Mon Sep 17 00:00:00 2001 From: Adrian Riedel Date: Wed, 8 Oct 2025 01:48:14 -0700 Subject: [PATCH] feat: support installation from custom NPM registry (#179) copy .npmrc from GitHub workspace if it exists so that PNPM respects custom registry configurations when self-installing --- dist/index.js | Bin 271300 -> 271535 bytes src/install-pnpm/run.ts | 13 ++++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index ce27906534c7ad63b4f7052966c4eefffb741433..425614add2445a8d0b2ac242b37b7d1ae4e14bac 100644 GIT binary patch delta 295 zcmX?dTwwi4fekbHRFm`bic6~9JwrS~o#Mm&gS>+S9GzXQQfh4rit>|Fi;MMA^U5aA z;EQBToBWB-97t;MD+XnzX{2aYmlRc2CzdB>mS`C0$BBfMmxNm~10hz*w+(tza)> WbD(g0pfDp4GXXL4_CR5lI6(lW { const { version, dest, packageJsonFile, standalone } = inputs + const { GITHUB_WORKSPACE } = process.env // prepare self install await rm(dest, { recursive: true, force: true }) @@ -19,6 +20,16 @@ export async function runSelfInstaller(inputs: Inputs): Promise { // we have ensured the dest directory exists, we can write the file directly await writeFile(pkgJson, JSON.stringify({ private: true })) + // copy .npmrc if it exists to install from custom registry + if (GITHUB_WORKSPACE) { + try { + await copyFile(path.join(GITHUB_WORKSPACE, '.npmrc'), path.join(dest, '.npmrc')) + } catch (error) { + // Swallow error if .npmrc doesn't exist + if (!util.types.isNativeError(error) || !('code' in error) || error.code !== 'ENOENT') throw error + } + } + // prepare target pnpm const target = await readTarget({ version, packageJsonFile, standalone }) const cp = spawn(execPath, [path.join(__dirname, 'pnpm.cjs'), 'install', target, '--no-lockfile'], {