| Crates.io | np-cli |
| lib.rs | np-cli |
| version | 0.1.0 |
| created_at | 2025-10-19 19:56:53.644393+00 |
| updated_at | 2025-10-19 19:56:53.644393+00 |
| description | A blazingly fast, intelligent package manager proxy that automatically detects and forwards commands to npm, yarn, or pnpm |
| homepage | |
| repository | https://github.com/jordyfontoura/np |
| max_upload_size | |
| id | 1890888 |
| size | 79,725 |
Stop memorizing commands. Start building.
np is a blazingly fast, intelligent package manager proxy that automatically detects and forwards commands to the right package manager (npm, yarn, or pnpm) in your project. Write once, run anywhere.
Ever switched between projects and typed the wrong command?
# In a pnpm project
$ npm install axios
# โ Wrong package manager!
# In a yarn project
$ pnpm add lodash
# โ Wrong again!
Managing multiple projects with different package managers is painful. You need to:
np does the thinking for you.
# Works everywhere, automatically
$ np install axios
$ np add lodash
$ np run dev
$ np --version
One command to rule them all. np automatically:
package.json or lock filespackageManager field in package.json or scans lock filespackage.json automaticallycargo install np
git clone https://github.com/jordyfontoura/np.git
cd np
cargo build --release
sudo mv target/release/np /usr/local/bin/
Download the latest binary from Releases
Once installed, just replace your package manager command with np:
# Instead of:
npm install
yarn install
pnpm install
# Just use:
np install
That's it! np will figure out the rest.
All your favorite commands work exactly the same:
# Installing dependencies
np install
np add axios
np add -D typescript
# Running scripts
np run dev
np run build
np test
# Getting info
np --version
np list
When np can't determine the package manager, it will ask you:
$ np install
๐ค Could not determine the package manager.
? Which package manager would you like to use?
> npm
yarn
pnpm
? Would you like to save this choice in the 'packageManager' field in package.json? (Y/n)
Select your preferred package manager, and optionally save it to avoid future prompts.
np follows this detection order:
packageManager field in package.json (highest priority)
{
"packageManager": "pnpm@9.9.0"
}
Lock files in the project directory:
package-lock.json โ npmyarn.lock โ yarnpnpm-lock.yaml โ pnpmInteractive prompt (when multiple or none are detected)
cd frontend/ # Uses yarn
np install # โ
Runs: yarn install
cd ../backend/ # Uses pnpm
np install # โ
Runs: pnpm install
cd ../legacy/ # Uses npm
np install # โ
Runs: npm install
# Clone any project
git clone https://github.com/some/project.git
cd project
# Just use np - it adapts automatically
np install
np run test
np run build
# .github/workflows/ci.yml
- name: Install dependencies
run: np install
- name: Run tests
run: np test
- name: Build
run: np run build
Detection Phase:
package.json for packageManager fieldpackage-lock.json, yarn.lock, pnpm-lock.yaml)Execution Phase:
Persistence (Optional):
package.json โ packageManager fieldnp comes with a comprehensive test suite:
# Run all tests
cargo test
# Run specific test suites
cargo test --test package_detector_tests
cargo test --test script_handler_tests
cargo test --test command_executor_tests
Test Coverage:
Contributions are welcome! Here's how to get started:
git checkout -b feature/amazing-featurecargo testgit commit -m 'Add amazing feature'git push origin feature/amazing-featureThis project is licensed under the MIT License - see the LICENSE file for details.
If np saves you time and mental overhead, please consider: