node-alias

command module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 2 Imported by: 0

README

Node Alias

GitHub Release GitHub go.mod Go version License Go Report Card

A fast, lightweight proxy for Node.js package managers that works across npm, yarn, pnpm, and bun. It provides smart shortcuts for common commands and seamless integration with your shell.

Features

  • Universal Package Manager Support: Works with npm, yarn, pnpm, and bun without any configuration.
  • Smart Shortcuts: Quickly run common commands like install, add, remove, and run scripts with minimal typing.
  • Automatic Tool Detection: Automatically uses tools like taze for outdated checks and npkill for cleaning node_modules if they are installed.
  • File Execution: Directly execute JavaScript, TypeScript, and Python files with appropriate runtimes.

Installation

You can download the latest release from the releases page. Or use one of the following methods:

Script
sh -c "$(curl -fsSL jcwillox.com/l/node-alias)"

Windows

iwr -useb jcwillox.com/l/node-alias-ps1 | iex

Usage

Set up an Alias

The power of node-alias comes from setting up shell aliases. At minimum, set up the n alias:

Bash/Zsh/Fish:

alias n="node-alias"

You can also add additional shorthands to save even more characters:

alias ni="node-alias install"
alias nr="node-alias run"
# alias just for bun pkg manager
alias b="NODE_ALIAS_MANAGER=bun node-alias"

PowerShell:

New-Alias n node-alias.exe

Once set up, you can use n instead of typing out your full package manager command!

Common Commands

Using the n alias, you can run package manager commands quickly:

n install                # Install dependencies
n i                      # Same as install
n add lodash             # Add a dependency
n a lodash               # Same as add
n a -d lodash            # Add a dev dependency and save exact version
n remove lodash          # Remove a dependency
n rm lodash              # Same as remove
n list                   # List installed packages
n ls                     # Same as list
n run dev                # Run a npm script
n r dev                  # Same as run
n patch lodash           # Create a patch for a dependency
n patch-commit <path>    # Commit a patch
n patch-remove [email protected] # Remove a patch
Smart Shortcuts

node-alias includes intelligent shortcuts that automatically run the right tool:

  • n o – Check for outdated packages

    • Uses taze if available, otherwise falls back to the package manager's outdated command
  • n k – Clean up node_modules

    • Uses npkill if installed, otherwise forwards the command line to the package manager
Proxy and Execute Files

node-alias can also directly execute Node.js files, and figure out the right runtime to use.

n script.js              # Run any .js file
n script.ts              # Run TypeScript files (using tsx or bun if available, or node if supported)

Scripts with shebang lines are automatically detected and executed with the specified interpreter:

n script.sh              # Executes with bash if shebang is #!/bin/bash
n script.py              # Uses shebang interpreter if present, otherwise falls back to uv or python

And Python files:

n script.py              # Run Python (using uv or python)
Use a Specific Package Manager

node-alias automatically detects your project's package manager (npm, yarn, pnpm, or bun) and uses the correct one. You can also manually override it:

# Use bun explicitly
b install                # Uses bun (requires `alias b="NODE_ALIAS_MANAGER=bun node-alias"`)
Shell completions

node-alias provides intelligent completions for multiple shells, for linux packages (deb, rpm, apk) these are built-in. Otherwise, up-to-date copies are located in the completions/ directory.

You can also generate them yourself with the following command:

node-alias completion [bash|zsh|fish|pwsh]

You can write this to a file then source it in your shell configuration.

Zsh

# copy and reload (ensure fpath+compinit in ~/.zshrc)
mkdir -p ~/.local/share/zsh/site-functions
cp completions/node-alias.zsh ~/.local/share/zsh/site-functions/
source ~/.zshrc

PowerShell

# copy and add dot-source to your profile (CurrentUserAllHosts)
$dest = Join-Path $HOME ".config\powershell\Modules\node-alias"; New-Item -ItemType Directory -Force -Path $dest | Out-Null
Copy-Item .\completions\node-alias.ps1 -Destination (Join-Path $dest "node-alias.ps1") -Force
# then add: . "$HOME\.config\powershell\Modules\node-alias\node-alias.ps1" to your profile

That's it — copy the file from completions/ and add the single config line shown above for your shell.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL