fnm@1.38.1: Remove leftovers when uninstall --purge, set FNM_DIR, persist some data (#6070)

* Added purge uninstall for fnm

* Must use Remove-Item, so using Test-Path too

* Updated fnm to 1.37.2

* Updated fnm

* Remove $schema

* Add suggestions by Lutra-Fs

* Added note about persistence

* Set FNM_HOME in process scope in post_install

* Removed workaround that was not needed
This commit is contained in:
Olav Rønnestad Birkeland 2025-08-13 14:08:18 +02:00 committed by GitHub
parent 49aa1e2ed2
commit 017b2701e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,14 +3,51 @@
"description": "Cross-platform Node.js version switcher",
"homepage": "https://github.com/Schniz/fnm",
"license": "GPL-3.0-only",
"notes": "Don't forget to add \"fnm env --use-on-cd | Out-String | Invoke-Expression\" to your powershell profile.",
"notes": [
"Don't forget to add \"fnm env --use-on-cd | Out-String | Invoke-Expression\" to your powershell profile.",
"The FNM_DIR environment variable has been set and the data persisted by Scoop since v1.38.1.",
"* Before: $env:APPDATA\\fnm",
"* After: $persist_dir\\fnm"
],
"architecture": {
"64bit": {
"url": "https://github.com/Schniz/fnm/releases/download/v1.38.1/fnm-windows.zip",
"hash": "377796e8f2f51eb8b5de8983974caa8922b83c167197b68b33962775703ad4a0"
}
},
"env_set": {
"FNM_DIR": "$dir"
},
"bin": "fnm.exe",
"persist": [
"aliases",
"node-versions"
],
"post_uninstall": [
"if ($purge) {",
" # Directories",
" $Directories = [string[]](",
" ('{0}\\fnm_multishells' -f $env:LOCALAPPDATA),",
" ('{0}\\fnm' -f $env:APPDATA)",
" )",
" $Directories.ForEach{",
" if (Test-Path -Path $_ -PathType 'Container') {",
" $null = Remove-Item -Path $_ -Recurse -Force",
" }",
" }",
" # Environment variables",
" $EnvScope = [string]$(if($global){'Machine'}else{'User'})",
" [System.Environment]::GetEnvironmentVariables($EnvScope).GetEnumerator().Where{",
" $_.'Name' -like 'FNM_*'",
" }.ForEach{",
" [System.Environment]::SetEnvironmentVariable(",
" $_.'Name',",
" $null,",
" $EnvScope",
" )",
" }",
"}"
],
"checkver": "github",
"autoupdate": {
"architecture": {