Crates.io | npm_rs |
lib.rs | npm_rs |
version | 1.0.0 |
source | src |
created_at | 2021-05-31 09:49:32.77112 |
updated_at | 2022-11-16 12:19:36.005525 |
description | Provides simple Rust to npm bindings to use in your build scripts. |
homepage | https://github.com/UpsettingBoy/npm_rs |
repository | https://github.com/UpsettingBoy/npm_rs |
max_upload_size | |
id | 404166 |
size | 30,635 |
A library to run npm
commands from your Rust build script.
This library will aid you in executing npm
commands when building your crate/bin,
removing the burden of having to manually do so or by using a tool other than Cargo.
This crate provides an abstraction over Command
to use npm
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.
NODE_ENV
setup// build.rs
use npm_rs::*;
let exit_status = NpmEnv::default()
.with_node_env(&NodeEnv::Production)
.with_env("FOO", "bar")
.init_env()
.install(None)
.run("build")
.exec()?;
NODE_ENV
setup// build.rs
use npm_rs::*;
let exit_status = NpmEnv::default()
.with_node_env(&NodeEnv::from_cargo_profile().unwrap_or_default())
.with_env("FOO", "bar")
.init_env()
.install(None)
.run("build")
.exec()?;
npm_rs
is either distributed under MIT or Apache-2.0 license. Choose as you please.