From 7dc291df70e115bf021240d0ea2616dffe28d9c8 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Fri, 24 Jul 2026 10:36:44 +0200 Subject: windows: npmrc-win wieder entfernt, prefix beim Kopieren auskommentieren statt zweite Datei zu pflegen Copy-Npmrc liest npm/npmrc jetzt zeilenweise und kommentiert die prefix=${HOME}/.local-Zeile beim Schreiben nach %USERPROFILE%\.npmrc aus, statt eine separate npm/npmrc-win zu unterhalten. Nur eine npmrc-Datei zu pflegen war der ausdrueckliche Wunsch. --- install-win.ps1 | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'install-win.ps1') diff --git a/install-win.ps1 b/install-win.ps1 index e52c0cb..15f39e4 100644 --- a/install-win.ps1 +++ b/install-win.ps1 @@ -41,7 +41,7 @@ $GitUp2partsSrc = Join-Path $RepoRoot "git\config-up2parts" $GitXdgDir = Join-Path $env:USERPROFILE ".config\git" $GitUp2partsDst = Join-Path $GitXdgDir "config-up2parts" -$NpmrcSrc = Join-Path $RepoRoot "npm\npmrc-win" +$NpmrcSrc = Join-Path $RepoRoot "npm\npmrc" $NpmrcDst = Join-Path $env:USERPROFILE ".npmrc" function Copy-NvimConfig { @@ -75,8 +75,22 @@ function Copy-Npmrc { return } - Write-Step "npm\npmrc-win -> $NpmrcDst" - Copy-Item -Force $NpmrcSrc $NpmrcDst + # npm/npmrc setzt "prefix=${HOME}/.local", damit globale npm-Installationen + # unter POSIX ohne sudo/root ins Home-Verzeichnis gehen. HOME ist unter + # Windows i.d.R. nicht gesetzt, ${HOME} wuerde also nicht expandieren. + # Der Grund fuer die Einstellung entfaellt unter Windows ohnehin (npm + # nutzt dort schon von Haus aus %APPDATA%\npm, automatisch im PATH) - + # die Zeile wird beim Kopieren einfach auskommentiert, statt eine zweite + # npmrc-Datei zu pflegen. + Write-Step "npm\npmrc -> $NpmrcDst (prefix-Zeile auskommentiert)" + $lines = Get-Content -Path $NpmrcSrc | ForEach-Object { + if ($_ -match "^\s*prefix\s*=") { + "; $_ (unter Windows auskommentiert, siehe install-win.ps1: Copy-Npmrc)" + } else { + $_ + } + } + Set-Content -Path $NpmrcDst -Value $lines Write-Ok $NpmrcDst } -- cgit v1.3