packager
ModulePackage managers: Packager, the built-in Npm, Pnpm and
Yarn, and the PackagerDetector that finds one from file names.
Contents
use utopia_detector::Npm;Rust
pub struct Npmnpm: package.json or package-lock.json.
use utopia_detector::PackagerDetector;Rust
pub struct PackagerDetectorFinds the packager of a project from its file names: the first option, in the order they were added, with one of its files among the inputs.
Rust
use utopia_detector::{Npm, PackagerDetector, Pnpm, Yarn};
let mut detector = PackagerDetector::new();
detector.add_option(Pnpm).add_option(Yarn).add_option(Npm);
detector.add_input("package.json").add_input("yarn.lock");
assert_eq!(detector.detect().map(|p| p.name()), Some("yarn"));Also implements
Debug.use utopia_detector::Pnpm;Rust
pub struct Pnpmpnpm: pnpm-lock.yaml.
use utopia_detector::Yarn;Rust
pub struct YarnYarn: yarn.lock.
use utopia_detector::Packager;Rust
pub trait Packager: Send + SyncA package manager, recognised by the files it leaves in a project.