Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@jchip/nvm

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jchip/nvm - npm Package Compare versions

Comparing version
1.7.0
to
1.8.0
bin/nvx

Sorry, the diff of this file is not supported yet

+46
#!/usr/bin/env pwsh
# nvx - Execute commands with local node_modules/.bin in PATH
# Check for help flag
if ($args.Count -eq 0 -or $args[0] -eq "--help" -or $args[0] -eq "-h") {
if ($args.Count -eq 0) {
Write-Error "Error: nvx requires a command to execute"
Write-Host ""
}
Write-Host "nvx - Execute commands with local node_modules/.bin in PATH"
Write-Host ""
Write-Host "Usage:"
Write-Host " nvx <command> [args...] Execute command with .\node_modules\.bin in PATH"
Write-Host " nvx --help, -h Show this help message"
Write-Host ""
Write-Host "Examples:"
Write-Host " nvx eslint src/ Run eslint from local node_modules"
Write-Host " nvx prettier --write . Run prettier from local node_modules"
if ($args.Count -eq 0) {
exit 1
}
exit 0
}
# Check if .\node_modules\.bin exists
if (Test-Path ".\node_modules\.bin" -PathType Container) {
# Get absolute path
$binPath = (Resolve-Path ".\node_modules\.bin").Path
# Add it to PATH for this session
$env:PATH = "$binPath;$env:PATH"
}
# Execute the command with arguments
$command = $args[0]
$commandArgs = $args[1..($args.Count - 1)]
if ($commandArgs) {
& $command @commandArgs
} else {
& $command
}
# Exit with the command's exit code
exit $LASTEXITCODE
+1
-0

@@ -32,2 +32,3 @@ "use strict";

` source "\$\{NVM_SH}"`,
` alias nvx="\$\{NVM_HOME}/bin/nvx"`,
`else`,

@@ -34,0 +35,0 @@ ` unset NVM_HOME`,

+1
-1

@@ -6,3 +6,3 @@ param (

$nvmVersion = "1.7.0"
$nvmVersion = "1.8.0"
$nvmVersionV = "v$nvmVersion"

@@ -9,0 +9,0 @@ $DisableInstallNvmFromTgz = $false

NVM_VERSION="1.7.0"
NVM_VERSION="1.8.0"
NVM_VERSION_V="v${NVM_VERSION}"

@@ -147,2 +147,7 @@

tar ${TAR_WILDCARDS_OPT} -xzf "${nvmDestTgzFile}" --directory="${NVM_HOME}" --strip=1 --files-from="$nvm_files"
# Ensure nvx has execute permissions
if [ -f "${NVM_HOME}/bin/nvx" ]; then
chmod +x "${NVM_HOME}/bin/nvx"
fi
}

@@ -149,0 +154,0 @@

{
"name": "@jchip/nvm",
"description": "nvm: a universal node.js version manager for Windows (no admin) and Unix",
"version": "1.7.0",
"version": "1.8.0",
"author": "Tom.Huang <hzlhu.dargon@gmail.com>",

@@ -6,0 +6,0 @@ "contributors": [

+119
-11

@@ -31,2 +31,11 @@ # @jchip/nvm

- [Environments](#environments)
- [nvx - Execute with local node_modules](#nvx---execute-with-local-node_modules)
- [Basic Usage](#basic-usage)
- [Show Help](#show-help)
- [Installing to PATH (macOS/Linux only)](#installing-to-path-macoslinux-only)
- [Install to User PATH (recommended)](#install-to-user-path-recommended)
- [Install to System PATH (all users)](#install-to-system-path-all-users)
- [Contributing and Release](#contributing-and-release)
- [Development](#development)
- [Release Process](#release-process)
- [License](#license)

@@ -58,3 +67,3 @@

cd $Env:USERPROFILE;
Invoke-WebRequest https://raw.githubusercontent.com/jchip/nvm/v1.7.0/install.ps1 -OutFile install.ps1;
Invoke-WebRequest https://raw.githubusercontent.com/jchip/nvm/v1.8.0/install.ps1 -OutFile install.ps1;
.\install.ps1 -nvmhome $Env:USERPROFILE\nvm;

@@ -70,3 +79,3 @@ del install.ps1

cd $Env:USERPROFILE;
Invoke-WebRequest https://unpkg.com/@jchip/nvm@1.7.0/install.ps1 -OutFile install.ps1;
Invoke-WebRequest https://unpkg.com/@jchip/nvm@1.8.0/install.ps1 -OutFile install.ps1;
.\install.ps1 -nvmhome $Env:USERPROFILE\nvm;

@@ -82,3 +91,3 @@ del install.ps1

cd $Env:USERPROFILE;
Invoke-WebRequest https://cdn.jsdelivr.net/npm/@jchip/nvm@1.7.0/install.ps1 -OutFile install.ps1;
Invoke-WebRequest https://cdn.jsdelivr.net/npm/@jchip/nvm@1.8.0/install.ps1 -OutFile install.ps1;
.\install.ps1 -nvmhome $Env:USERPROFILE\nvm;

@@ -128,4 +137,4 @@ del install.ps1

1. Download the package zip file from https://github.com/jchip/nvm/archive/v1.7.0/.zip
1. Extract this file to your home directory. You will get a new directory `nvm-1.7.0`.
1. Download the package zip file from https://github.com/jchip/nvm/archive/v1.8.0/.zip
1. Extract this file to your home directory. You will get a new directory `nvm-1.8.0`.
2. Rename it to `nvm`, for example: `C:\Users\<username>\nvm`

@@ -161,3 +170,3 @@ 2. Download the zipfile https://nodejs.org/dist/v20.12.1/node-v20.12.1-win-x64.zip

```bash
NVM_HOME=~/nvm curl -o- https://raw.githubusercontent.com/jchip/nvm/v1.7.0/install.sh | bash
NVM_HOME=~/nvm curl -o- https://raw.githubusercontent.com/jchip/nvm/v1.8.0/install.sh | bash
```

@@ -168,3 +177,3 @@

```bash
NVM_HOME=~/nvm wget -qO- https://raw.githubusercontent.com/jchip/nvm/v1.7.0/install.sh | bash
NVM_HOME=~/nvm wget -qO- https://raw.githubusercontent.com/jchip/nvm/v1.8.0/install.sh | bash
```

@@ -179,3 +188,3 @@

```bash
NVM_HOME=~/nvm curl -o- https://unpkg.com/@jchip/nvm@1.7.0/install.sh | bash
NVM_HOME=~/nvm curl -o- https://unpkg.com/@jchip/nvm@1.8.0/install.sh | bash
```

@@ -186,3 +195,3 @@

```bash
NVM_HOME=~/nvm wget -qO- https://unpkg.com/@jchip/nvm@1.7.0/install.sh | bash
NVM_HOME=~/nvm wget -qO- https://unpkg.com/@jchip/nvm@1.8.0/install.sh | bash
```

@@ -197,3 +206,3 @@

```bash
NVM_HOME=~/nvm curl -o- https://cdn.jsdelivr.net/npm/@jchip/nvm@1.7.0/install.sh | bash
NVM_HOME=~/nvm curl -o- https://cdn.jsdelivr.net/npm/@jchip/nvm@1.8.0/install.sh | bash
```

@@ -204,3 +213,3 @@

```bash
NVM_HOME=~/nvm wget -qO- https://cdn.jsdelivr.net/npm/@jchip/nvm@1.7.0/install.sh | bash
NVM_HOME=~/nvm wget -qO- https://cdn.jsdelivr.net/npm/@jchip/nvm@1.8.0/install.sh | bash
```

@@ -266,4 +275,103 @@

## nvx - Execute with local node_modules
The `nvx` command allows you to run commands from your local `node_modules/.bin` directory without needing to specify the full path.
Unlike `npx`, which can fetch and execute packages from remote npm registry, `nvx` is simpler and only runs locally installed packages. This makes it faster and more predictable for running project-specific tools.
### Basic Usage
```bash
# Run eslint from local node_modules
nvx eslint src/
# Run prettier from local node_modules
nvx prettier --write .
# Run any locally installed CLI tool
nvx jest --watch
```
### Show Help
```bash
nvx --help
# or
nvx -h
```
### Installing to PATH (macOS/Linux only)
On macOS and Linux, you can optionally add the nvm bin directory to your system PATH to make nvm commands available in GUI applications (like VS Code).
#### Install to User PATH (recommended)
This adds nvm to your user's PATH. Works with GUI applications and doesn't require sudo:
**macOS:**
```bash
nvx --install-to-user
# Log out and log back in for changes to take effect
```
**Linux:**
```bash
nvx --install-to-user
# Log out and log back in for changes to take effect
```
#### Install to System PATH (all users)
This adds nvm to the system-wide PATH for all users. Requires sudo:
**macOS:**
```bash
sudo nvx --install-to-system
# Restart your terminal for changes to take effect
```
**Linux:**
```bash
sudo nvx --install-to-system
# Log out and log back in for changes to take effect
```
**Note for Windows users:** On Windows, the nvm bin directory is automatically added to your PATH during installation, so these commands are not needed.
## Contributing and Release
### Development
1. Clone the repository
2. Install [fyn](https://www.npmjs.com/package/fyn) globally: `npm install -g fyn`
3. Install dependencies: `fyn install`
4. Make your changes
5. Test your changes on the target platform(s)
### Release Process
This project uses `xrun` for versioning and releasing. **Do not use `npm version` or `npm publish`** directly.
1. **Update CHANGELOG.md** - Add a new entry at the top with the version and date:
```markdown
## X.Y.Z MMM DD, YYYY
- feat: description of new feature
- fix: description of bug fix
```
2. **Bump version** - Choose the appropriate version bump:
```bash
xrun version --patch # Bug fixes (1.7.0 -> 1.7.1)
xrun version --minor # New features (1.7.0 -> 1.8.0)
xrun version --major # Breaking changes (1.7.0 -> 2.0.0)
```
3. **Release** - Publish to npm:
```bash
xrun release
```
## License
[MIT](http://www.opensource.org/licenses/MIT)