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 +++++++++++++++++--- neovim-windows-setup.md | 2 +- npm/npmrc-win | 26 -------------------------- 3 files changed, 18 insertions(+), 30 deletions(-) delete mode 100644 npm/npmrc-win 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 } diff --git a/neovim-windows-setup.md b/neovim-windows-setup.md index c5fc3fc..568638c 100644 --- a/neovim-windows-setup.md +++ b/neovim-windows-setup.md @@ -39,7 +39,7 @@ Es kopiert (keine Symlinks, keine Admin-Rechte nötig): - `nvim/` → `%LOCALAPPDATA%\nvim` - `git/config` → `%USERPROFILE%\.gitconfig` - `git/config-up2parts` → `%USERPROFILE%\.config\git\config-up2parts` (Pfad ist im `includeIf` von `git/config` hartkodiert) -- `npm/npmrc-win` → `%USERPROFILE%\.npmrc` (nur falls dort noch keine Datei existiert) – eigene Windows-Variante ohne `prefix=${HOME}/.local`: `HOME` ist unter Windows i. d. R. nicht gesetzt, npm nutzt dort ohnehin schon von Haus aus `%APPDATA%\npm` als Praefix +- `npm/npmrc` → `%USERPROFILE%\.npmrc` (nur falls dort noch keine Datei existiert) – die Zeile `prefix=${HOME}/.local` wird dabei auskommentiert: `HOME` ist unter Windows i. d. R. nicht gesetzt, npm nutzt dort ohnehin schon von Haus aus `%APPDATA%\npm` als Präfix Nach Änderungen im Repo `install-win.ps1` erneut ausführen, um die Kopien zu aktualisieren. diff --git a/npm/npmrc-win b/npm/npmrc-win deleted file mode 100644 index 3803390..0000000 --- a/npm/npmrc-win +++ /dev/null @@ -1,26 +0,0 @@ -; %USERPROFILE%\.npmrc (Windows) -; -; Kein "prefix" gesetzt, anders als in npm/npmrc (POSIX): dort dient -; prefix=${HOME}/.local dazu, globale Installationen ohne sudo/root ins -; Home-Verzeichnis zu legen. Unter Windows loest npm dieses Problem -; bereits selbst - der Standard-Praefix liegt ohnehin im Benutzerprofil -; (%APPDATA%\npm), von Node's eigenem Installer automatisch zum PATH -; hinzugefuegt. ${HOME} ist unter Windows i.d.R. nicht gesetzt und wuerde -; hier nicht expandieren. - -; default registry -registry=https://registry.npmjs.org/ - -; disable fund-spam -fund=false - -; suppresses notifications about new npm versions -update-notifier=false - -; reduce the attack surface for supply chain attacks -min-release-age=3 - -; disable pre- und post-scripts -ignore-scripts=true - -; vim: ft=dosini -- cgit v1.3