An interactive CLI tool for running npm scripts from your package.json
files with autocomplete functionality.
- ✅ Interactive selection of npm scripts
- ✅ Autocomplete filtering for quick script selection
- ✅ Works in any directory containing a package.json file
- ✅ Simple and easy to use
# Clone the repository
git clone https://github.com/yourusername/npm-runner.git
cd npm-runner
# Install dependencies
npm install
# Make the script executable
chmod +x index.js
# Install globally
npm install -g .
Navigate to any directory containing a package.json
file with npm scripts and run:
npm-run
You'll be presented with an interactive list of available scripts:
? Select a script to run: (Use arrow keys or type to search)
❯ start
build
test
lint
dev
deploy
analyze
Start typing to filter the list:
? Select a script to run: de
❯ dev
deploy
Press Enter to run the selected script. The tool will execute the script and exit when it completes.
- When you run
npm_run
, the tool looks for apackage.json
file in your current directory - It extracts all the scripts defined in that file
- It presents an interactive selection menu with autocomplete functionality
- You can type to filter the available scripts
- Once you select a script, it runs
npm run [selected-script]
- After the script finishes running, the tool exits
- Node.js (v12 or higher recommended)
- npm (v6 or higher)
MIT
The npm-runner tool includes a comprehensive test suite using Jest:
# Install dev dependencies
npm install
# Run all tests
npm test
# Run only unit tests
npm run test:unit
# Run only integration tests
npm run test:integration
# Run specific test files
node --experimental-vm-modules node_modules/jest/bin/jest.js tests/unit/package-parser.test.js
The test suite includes:
- Unit tests for package.json parsing and script filtering
- Integration tests for script execution and user interaction
- Test coverage reports
Tests are also automatically run on GitHub Actions for all pull requests and pushes to main.
Command not found: npm_run
- Check that the package is properly installed globally with
npm list -g | grep npm-runner
No package.json found
- Make sure you're running the command in a directory containing a package.json file
No scripts found
- Your package.json file doesn't have any scripts defined in the "scripts" section