Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(dev-config): activate Node via nvm instead of conflicting MSI install (#55) #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
primetimetank21 wants to merge 4 commits into microsoft:main
base: main
Choose a base branch
Loading
from primetimetank21:squad/55-nvm-activation
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some comments aren't visible on the classic Files Changed page.

11 changes: 5 additions & 6 deletions src/windows-dev-config/README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The configuration is idempotent, so it is safe to re-run after reboot or at any

## What this configures

- **13 apps** via winget (PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, Node.js LTS, NVM for Windows, Windows Application CLI, plus optional Oh My Posh and PowerToys).
- **11 core apps** (plus 2 optional: Oh My Posh and PowerToys) via winget (Windows Terminal, PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, NVM for Windows (activates Node 24), Windows Application CLI).
- **WSL + Ubuntu**, installed via 3 transitional script resources that bracket a reboot (Phase 2/3/4 below).
- **~24 registry settings** for theme/OS, Explorer, Taskbar, Search, Start, Notifications, Edge, Sudo, and the Widget service.
- **Cascadia Code & Cascadia Mono Nerd Fonts** downloaded from the `microsoft/cascadia-code` GitHub release and registered per-user.
Expand All @@ -123,7 +123,7 @@ The configuration is idempotent, so it is safe to re-run after reboot or at any

All resources are dscv3 (`$schema: .../DSC/main/schemas/2023/08/config/document.json`, `metadata.winget.processor.identifier: dscv3`). Every resource that touches HKLM or runs elevated tools depends on `ElevationCheck`.

Package resources use `Microsoft.WinGet/Package` with `source: winget` and `useLatest: true` (except `Python.Python.3.14`, `Microsoft.dotnet.SDK.10`, and `OpenJS.NodeJS.LTS`, which are pinned by id).
Package resources use `Microsoft.WinGet/Package` with `source: winget` and `useLatest: true` (except `Python.Python.3.14` and `Microsoft.dotnet.SDK.10`, which are pinned by id). Node 24 is activated via nvm (`NvmActivateNode`).

### Phase resources (elevation + WSL)

Expand All @@ -148,8 +148,7 @@ All app resources that need WSL present depend on `InstallUbuntu` so the OS work
| `DotnetSdk` | `Microsoft.dotnet.SDK.10` | Pinned to v10. |
| `Python` | `Python.Python.3.14` | Pinned to 3.14. |
| `UV` | `astral-sh.uv` | |
| `NodeJS` | `OpenJS.NodeJS.LTS` | Pinned to the LTS line (currently Node 24 LTS). |
| `nvmForNode` | `CoreyButler.NVMforWindows` | Node version manager for Windows. |
| `nvmForNode` | `CoreyButler.NVMforWindows` | Node version manager for Windows. `NvmActivateNode` runs `nvm install 24` + `nvm use 24` after install. |
| `OhMyPosh` | `JanDeDobbeleer.OhMyPosh` | Marked Optional in the comments. Triggers `ohMyPoshProfileSet`. |
| `winappCli` | `Microsoft.winappcli` | Windows Application CLI. |
| `PowerToys` | `Microsoft.PowerToys` | Marked Optional. Followed by `PowerToysAOT` which disables AOT notifications via registry. |
Expand Down Expand Up @@ -242,7 +241,7 @@ HKLM policies, applied via `Microsoft.Windows/Registry`:
## Customization

- **Pick and choose packages.** Comment out any `Microsoft.WinGet/Package` block to skip that install — most have no `dependsOn` chain beyond `InstallUbuntu` (exceptions: `GitHubCLI` and `GitHubCopilot` depend on `Git`; `PowerToysAOT` depends on `PowerToys`; `ohMyPoshProfileSet` depends on `OhMyPosh`).
- **Pin or unpin versions.** Switch `id: Python.Python.3.14` (pinned) to `id: Python.Python.3` if you want to drift forward, or switch `OpenJS.NodeJS.LTS` to `OpenJS.NodeJS` for current. Vice versa for the unpinned packages.
- **Pin or unpin versions.** Switch `id: Python.Python.3.14` (pinned) to `id: Python.Python.3` if you want to drift forward. Vice versa for other unpinned packages. To change the activated Node version, update the `nvm install` and `nvm use` arguments in `NvmActivateNode`.
- **Toggle registry values.** Most settings are `DWord: 0` or `DWord: 1`; flip the value to invert the behavior.
- **Re-enable commented-out tweaks.** `HideDesktopIcons` ships commented out (it over-fires on some user setups). Uncomment to enable.
- **Change the WSL distro.** Edit the `wsl --install -d Ubuntu --no-launch` line inside the `InstallUbuntu` resource.
Expand All @@ -258,7 +257,7 @@ HKLM policies, applied via `Microsoft.Windows/Registry`:
| `Microsoft.DSC.Transitional/WindowsPowerShellScript` (not `PSDscResources/Script`) | The dscv3 transitional resource is the supported equivalent under the new processor. |
| Self-relaunch elevated from `ElevationCheck` | A user can double-click into an unelevated shell and the DSC will UAC-prompt itself rather than failing. |
| Reboot + RunOnce inside the DSC | The DSC owns the reboot and the resume, so the user only invokes `winget configure` once. The throw after `Restart-Computer -Force` is required because `Restart-Computer` returns immediately after signalling shutdown; without the throw DSC would treat the resource as succeeded and continue. |
| `useLatest: true` on most packages | Cloud PC parity tracks "current" tools. Pinned ids (`Python.Python.3.14`, `Microsoft.dotnet.SDK.10`, `OpenJS.NodeJS.LTS`) are used where a major-version line matters. |
| `useLatest: true` on most packages | Cloud PC parity tracks "current" tools. Pinned ids (`Python.Python.3.14`, `Microsoft.dotnet.SDK.10`) are used where a major-version line matters. Node version is pinned explicitly in the `NvmActivateNode` activation script (`nvm install 24`). |
| Dark theme via `dark.theme` file (not registry) | Applying the shipped `.theme` file flips both `AppsUseLightTheme` and `SystemUsesLightTheme` *and* applies the matching color scheme/cursors atomically, which the broadcast-message dance you'd otherwise need from a registry-only approach often misses. |
| Per-user font install | Avoids requiring admin for the font step and keeps the font registration under `HKCU`, which is what modern Windows + Terminal expect. |
| `RunCommandOnSet` to mutate `settings.json` | Windows Terminal's settings are JSON-based and not registry-mapped; a small pwsh fragment is the cleanest way. |
Expand Down
51 changes: 41 additions & 10 deletions src/windows-dev-config/dev-config.winget
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -851,25 +851,56 @@ resources:
securityContext: elevated

- type: Microsoft.WinGet/Package
name: NodeJS
name: nvmForNode
properties:
id: OpenJS.NodeJS.LTS
id: CoreyButler.NVMforWindows
source: winget
useLatest: true
installMode: silent
metadata:
description: Install Node.js 24 LTS
description: Install NVM
securityContext: elevated

- type: Microsoft.WinGet/Package
name: nvmForNode
- type: Microsoft.DSC.Transitional/PowerShellScript
name: NvmActivateNode
dependsOn:
- PowerShell
- nvmForNode
properties:
id: CoreyButler.NVMforWindows
source: winget
useLatest: true
installMode: silent
getScript: |
$machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
$user = [System.Environment]::GetEnvironmentVariable('Path', 'User')
$env:Path = (($machine, $user) | Where-Object { $_ }) -join ';'
$nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue)
$ver = if (Get-Command node -ErrorAction SilentlyContinue) { node --version 2>$null } else { '' }
return @{ nvm = $nvmOk; nodeVersion = [string]$ver }
testScript: |
$machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
$user = [System.Environment]::GetEnvironmentVariable('Path', 'User')
$env:Path = (($machine, $user) | Where-Object { $_ }) -join ';'
$nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue)
$nodeOk = (Get-Command node -ErrorAction SilentlyContinue) -and ((node --version 2>$null) -match '^v24\.')
return ($nvmOk -and $nodeOk)
setScript: |
$machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
$user = [System.Environment]::GetEnvironmentVariable('Path', 'User')
$env:Path = (($machine, $user) | Where-Object { $_ }) -join ';'
if (-not (Get-Command nvm -ErrorAction SilentlyContinue)) {
throw 'nvm not on PATH. Verify CoreyButler.NVMforWindows installed correctly.'
}

& nvm install 24
if ($LASTEXITCODE -ne 0) { throw "nvm install 24 failed (exit $LASTEXITCODE)" }
& nvm use 24
if ($LASTEXITCODE -ne 0) { throw "nvm use 24 failed (exit $LASTEXITCODE)" }

$machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
$user = [System.Environment]::GetEnvironmentVariable('Path', 'User')
$env:Path = (($machine, $user) | Where-Object { $_ }) -join ';'

Write-Information "node $(node --version) activated via nvm" -InformationAction Continue
metadata:
description: Install NVM
description: Activate Node 24 via nvm (nvm install 24 + nvm use 24)
securityContext: elevated

- type: Microsoft.WinGet/Package
Expand Down

AltStyle によって変換されたページ (->オリジナル) /