Skip to main content

Crate use_npm

Crate use_npm 

Source
Expand description

§use-npm

npm command and package spec primitives for RustUse.

§Experimental

use-npm is experimental while use-js remains below 0.3.0.

§Example

use use_npm::{NpmCommand, NpmPackageSpec, NpmRegistryUrl};

let registry = NpmRegistryUrl::new("https://registry.npmjs.org/")?;
let spec = NpmPackageSpec::new("react@latest")?;

assert_eq!(registry.as_str(), "https://registry.npmjs.org/");
assert_eq!(spec.as_str(), "react@latest");
assert_eq!("ci".parse::<NpmCommand>()?, NpmCommand::Ci);

§Scope

  • npm command labels.
  • Script command text.
  • Registry URL and package spec metadata.

§Non-goals

  • Running npm.
  • Registry API calls.
  • Full npm package spec parsing.

§License

Licensed under either Apache-2.0 or MIT.

Structs§

NpmPackageSpec
NpmRegistryUrl
npm registry URL metadata.
NpmScriptCommand

Enums§

NpmCommand
Common npm command labels.
NpmCommandParseError
Error returned while parsing npm commands.
NpmTextError
Error returned when npm text metadata is invalid.