|
1 | 1 | # nvm-pl |
| 2 | + |
| 3 | +A fast, lightweight Perl-based Node.js version manager. Install, switch, and manage multiple Node.js versions with ease. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +- **Fast** - Written in Perl |
| 12 | +- **Cross-platform** - Works on Linux, macOS, and Windows |
| 13 | +- **Multi-shell support** - Bash, Zsh, Cmd, PowerShell |
| 14 | +- **Seamless switching** - Auto-updates shell configuration |
| 15 | +- **Smart caching** - Avoids re-downloading Node.js versions |
| 16 | +- **Well-tested** - 72+ tests with CI/CD on 3 platforms |
| 17 | + |
| 18 | +## Quick Start |
| 19 | + |
| 20 | +### Installation |
| 21 | + |
| 22 | +```bash |
| 23 | +# Install from CPAN |
| 24 | +cpanm NVMPL |
| 25 | + |
| 26 | +# Or clone and install manually |
| 27 | +git clone https://github.com/yourusername/nvm-pl.git |
| 28 | +cd nvm-pl |
| 29 | +cpanm --installdeps . |
| 30 | +sudo make install |
| 31 | +``` |
| 32 | + |
| 33 | +### Basic Usage |
| 34 | + |
| 35 | +```bash |
| 36 | +# Install a Node.js version |
| 37 | +nvm-pl install 25.1.0 |
| 38 | + |
| 39 | +# Use a specific version |
| 40 | +nvm-pl use 25.1.0 |
| 41 | + |
| 42 | +# List installed versions |
| 43 | +nvm-pl ls |
| 44 | + |
| 45 | +# List available remote versions |
| 46 | +nvm-pl ls-remote |
| 47 | + |
| 48 | +# Show current version |
| 49 | +nvm-pl current |
| 50 | + |
| 51 | +# Uninstall a version |
| 52 | +nvm-pl uninstall 25.1.0 |
| 53 | +``` |
| 54 | + |
| 55 | +## Supported Shells |
| 56 | + |
| 57 | +- **Bash** - Updates `~/.bashrc` |
| 58 | +- **Zsh** - Updates `~/.zshrc` (macOS default) |
| 59 | +- **Cmd** - Windows Command Prompt |
| 60 | +- **PowerShell** - Windows PowerShell |
| 61 | + |
| 62 | +## How It Works |
| 63 | + |
| 64 | +`nvm-pl` manages Node.js versions in `~/.nvm-pl/install/`: |
| 65 | + |
| 66 | +``` |
| 67 | +~/.nvm-pl/install/ |
| 68 | +├── downloads/ # Cached Node.js tarballs |
| 69 | +├── versions/ # Installed Node.js versions |
| 70 | +│ ├── v25.1.0/ |
| 71 | +│ ├── v24.11.0/ |
| 72 | +│ └── current -> v25.1.0/ # Symlink/junction to active version |
| 73 | +└── node_index_cache.json # Cached version list |
| 74 | +``` |
| 75 | + |
| 76 | +## Commands |
| 77 | + |
| 78 | +| Command | Description | |
| 79 | +| ---------------------------- | ------------------------------------------ | |
| 80 | +| `nvm-pl install <version>` | Install a Node.js version | |
| 81 | +| `nvm-pl use <version>` | Switch to a version (updates shell config) | |
| 82 | +| `nvm-pl ls` | List installed versions | |
| 83 | +| `nvm-pl ls-remote` | List available remote versions | |
| 84 | +| `nvm-pl current` | Show active version | |
| 85 | +| `nvm-pl uninstall <version>` | Remove a version | |
| 86 | +| `nvm-pl --help` | Show help message | |
| 87 | +| `nvm-pl --version` | Show version | |
| 88 | + |
| 89 | +## Examples |
| 90 | + |
| 91 | +```bash |
| 92 | +# Install the latest LTS version |
| 93 | +nvm-pl install 24.11.0 |
| 94 | +nvm-pl use 24.11.0 |
| 95 | + |
| 96 | +# Install multiple versions |
| 97 | +nvm-pl install 25.1.0 |
| 98 | +nvm-pl install 24.11.0 |
| 99 | +nvm-pl install 23.10.0 |
| 100 | + |
| 101 | +# Switch between versions |
| 102 | +nvm-pl use 25.1.0 |
| 103 | +node --version # v25.1.0 |
| 104 | + |
| 105 | +nvm-pl use 24.11.0 |
| 106 | +node --version # v24.11.0 |
| 107 | + |
| 108 | +# See what's installed |
| 109 | +nvm-pl ls |
| 110 | +# [nvm-pl] Installed versions: |
| 111 | +# v24.11.0 |
| 112 | +# v25.1.0 |
| 113 | +``` |
| 114 | + |
| 115 | +## Migration from Other Version Managers |
| 116 | + |
| 117 | +### From nvm |
| 118 | + |
| 119 | +```bash |
| 120 | +# Remove nvm |
| 121 | +rm -rf ~/.nvm |
| 122 | + |
| 123 | +# Remove nvm lines from ~/.bashrc/~/.zshrc |
| 124 | +# Install and use nvm-pl as shown above |
| 125 | +``` |
| 126 | + |
| 127 | +### From system Node.js |
| 128 | + |
| 129 | +```bash |
| 130 | +# Remove system Node.js (Ubuntu/Debian) |
| 131 | +sudo apt remove nodejs npm |
| 132 | + |
| 133 | +# Use nvm-pl exclusively |
| 134 | +nvm-pl install 25.1.0 |
| 135 | +nvm-pl use 25.1.0 |
| 136 | +``` |
| 137 | + |
| 138 | +## Configuration |
| 139 | + |
| 140 | +Create `~/.nvmplrc` for custom settings: |
| 141 | + |
| 142 | +```ini |
| 143 | +install_dir = /custom/path/.nvm-pl |
| 144 | +mirror_url = https://nodejs.org/dist |
| 145 | +cache_ttl = 86400 |
| 146 | +auto_use = 1 |
| 147 | +color_output = 1 |
| 148 | +``` |
| 149 | + |
| 150 | +## Development |
| 151 | + |
| 152 | +```bash |
| 153 | +# Clone the repository |
| 154 | +git clone https://github.com/yourusername/nvm-pl.git |
| 155 | +cd nvm-pl |
| 156 | + |
| 157 | +# Install dependencies |
| 158 | +cpanm --installdeps . |
| 159 | + |
| 160 | +# Run tests |
| 161 | +prove -lv t/ |
| 162 | + |
| 163 | +# Build distribution |
| 164 | +perl Makefile.PL |
| 165 | +make |
| 166 | +make test |
| 167 | +make dist |
| 168 | +``` |
| 169 | + |
| 170 | +## Why nvm-pl? |
| 171 | + |
| 172 | +- **Lightweight** - No heavy JavaScript toolchain required |
| 173 | +- **Fast** - Perl is optimized for system utilities |
| 174 | +- **Simple** - Clean, readable codebase |
| 175 | +- **Reliable** - Comprehensive test suite |
| 176 | +- **Cross-platform** - True multi-OS support |
| 177 | + |
| 178 | +## License |
| 179 | + |
| 180 | +MIT License - see [LICENSE](LICENSE) file for details. |
| 181 | + |
| 182 | +## Contributing |
| 183 | + |
| 184 | +Contributions welcome! Please feel free to submit a Pull Request. |
| 185 | + |
| 186 | +1. Fork the repository |
| 187 | +2. Create a feature branch |
| 188 | +3. Add tests for your changes |
| 189 | +4. Ensure all tests pass |
| 190 | +5. Submit a pull request |
| 191 | + |
| 192 | +Happy Node.js version managing! |
0 commit comments