$ show nvm-windows/nvm
NVM for Windows is a Node.js version manager for Windows, providing CLI, shim/link mode, background sync, and Windows-native integrations (Event Log, Registry, Notifications). The repository contains the build system, installer (Inno Setup with extensive Pascal scripting), and a Zig-based elevated migration helper. The actual application logic (CLI, shim, sync) resides in separate submodules (cli, shim, sync, common) not included in this analysis. The visible code demonstrates high craftsmanship: the installer handles complex migration from v1, ACL hardening, silent install policies, and scheduled task management. The Zig updater is a clean, self-contained elevated cleanup tool. The build scripts are well-structured PowerShell with parameterized steps and CI/CD integration. The project is actively maintained with a recent v2 rewrite, modern CI workflows, and a large user base.
The LLM identified 3 files worth highlighting for reuse:
The Inno Setup installer script is a comprehensive, production-grade installer with extensive Pascal code for v1-to-v2 migration, Node.js storage location selection, ACL hardening, silent install policies, environment variable management, scheduled task creation, and uninstall cleanup. It demonstrates advanced Windows installer patterns including registry manipulation, process management, and user interaction. The code is well-structured with helper functions, logging, and error handling. This component is reusable as a template for complex Windows application installers requiring migration and security hardening.
A self-contained Zig executable that performs privileged v1-to-v2 migration cleanup: removing registry values (NVM_HOME, NVM_SYMLINK), cleaning PATH entries, deleting old install directories, removing uninstall entries, registering Event Log source, normalizing Node executables, and running reshim. It uses raw Win32 API calls (no external dependencies) and is designed to be called once by the installer with UAC elevation. The code is clean, well-commented, and demonstrates safe memory management in Zig. This pattern is reusable for any Windows application needing a one-time elevated cleanup helper.
The main build script orchestrates building all components (CLI, shims, sync, installer) with parameterized architecture, component selection, and signing. It uses a modular step-based approach with status tracking and error handling. The script is well-structured with clear separation of concerns and supports both local development and CI/CD pipelines. While project-specific, the pattern of a PowerShell build orchestrator with step modules is reusable for multi-component Windows builds.