Crate npm_run_scripts

Crate npm_run_scripts 

Source
Expand description

nrs - npm Run Scripts

A fast, interactive terminal user interface (TUI) for discovering and executing npm/yarn/pnpm/bun scripts defined in package.json files.

§Features

  • Fast: Sub-50ms startup time (Rust native binary)
  • Intuitive: Number keys for quick execution, fuzzy search, visual grid
  • Smart: Auto-detect package manager, remember history, show descriptions
  • Cross-platform: Linux and macOS support
  • Zero-config: Works out of the box, optional configuration for power users

§Modules

  • cli - Command-line interface argument parsing
  • config - Configuration file loading and types
  • error - Error types and result helpers
  • filter - Fuzzy filtering for scripts
  • history - Script execution history tracking
  • package - Package.json parsing and package manager detection
  • runner - Script execution
  • tui - Terminal user interface
  • utils - Path and terminal utilities

§Example

use npm_run_scripts::package::{parse_scripts, detect_runner, Runner};
use std::path::Path;

// Parse scripts from a project
let project_dir = Path::new("./my-project");
let scripts = parse_scripts(project_dir).expect("Failed to parse scripts");

// Detect the package manager
let runner = detect_runner(project_dir);

// Get the command for a script
let cmd = runner.run_command("dev");
println!("Command: {:?}", cmd);

Re-exports§

pub use cli::Cli;
pub use config::Config;
pub use error::NrsError;
pub use error::Result;
pub use package::Runner;
pub use package::Script;
pub use package::Scripts;

Modules§

cli
CLI argument definitions. CLI argument definitions for nrs.
config
Configuration system for loading and merging settings. Configuration module for nrs.
error
Error types and result helpers. Custom error types for nrs.
filter
Fuzzy filtering for scripts. Filter module for nrs.
history
Script execution history tracking. History module for nrs.
package
Package.json parsing and package manager detection. Package module for nrs.
runner
Script execution. Runner module for nrs.
tui
Terminal user interface. TUI module for nrs.
utils
Path and terminal utilities. Utility module for nrs.