Struct npm_rs::Npm [−][src]
pub struct Npm { /* fields omitted */ }
Expand description
This struct is used to execute npm commands.
Can be created from NpmEnv
of using Default
.
After queuing the desired commands, use Npm::exec()
to execute them.
Example
use npm_rs::*; Npm::default().install(Some(&["tailwindcss"])).exec()?;
Implementations
Same behaviour as npm-init -y.
Initializes a package, creating a package.json
file with the default template.
Same behaviour as npm-install.
Same behaviour as npm-uninstall.
Uninstalls the given packages in pkg
.
Same behaviour as npm-update.
Same behaviour as npm-run-script.
Runs an arbitrary command
from package.json
’s “scripts” object.
Executes all the commands in the invokation order used, waiting for its completion status.
Example
use npm_rs::*; let status = Npm::default().install(None).run("build").exec()?; // Executes npm install && npm run build. assert!(status.success()); // Will `panic` if not completed successfully.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Npm
impl !UnwindSafe for Npm