Crate npm_rs[][src]

Expand description

This crate provides an abstraction over Command with manual npm commands in a simple and easy package with fluent API.

npm_rs exposes NpmEnv to configure the npm execution enviroment and Npm to use said enviroment to execute npm commands.

Example

use npm_rs::*;

let exit_status = NpmEnv::default()
       .with_env("NODE_ENV", "production")
       .init()
       .install(None)
       .run("build")
       .exec()?;

NpmEnv implements Clone while running under a nightly toolchain and with the feature nightly is enabled.

// Cargo.toml

[dev.dependencies]
npm_rs = { version = "0.1", features = ["nightly"] }

Structs

Npm

This struct is used to execute npm commands. Can be created from NpmEnv of using Default.

NpmEnv

This struct is used to create the enviroment in which npm will execute commands. NpmEnv uses Command so it takes all the env variables in your system.