pub struct Package {
pub name: String,
pub version: String,
pub description: Option<String>,
pub package_manager: Option<String>,
pub scripts: HashMap<String, String>,
pub scripts_info: HashMap<String, String>,
pub ntl: Option<NtlConfig>,
pub workspaces: Option<WorkspacesConfig>,
}Expand description
Parsed package.json structure.
Fields§
§name: StringPackage name.
version: StringPackage version.
description: Option<String>Package description.
package_manager: Option<String>Package manager specification (e.g., “pnpm@8.0.0”).
scripts: HashMap<String, String>Raw scripts object.
scripts_info: HashMap<String, String>Scripts info for descriptions.
ntl: Option<NtlConfig>NTL configuration (for descriptions).
workspaces: Option<WorkspacesConfig>Workspaces configuration.
Implementations§
Source§impl Package
impl Package
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Get the package name, or “unnamed” if not set.
Sourcepub fn has_scripts(&self) -> bool
pub fn has_scripts(&self) -> bool
Check if this package has any scripts.
Sourcepub fn script_count(&self) -> usize
pub fn script_count(&self) -> usize
Get the number of scripts.
Sourcepub fn is_monorepo(&self) -> bool
pub fn is_monorepo(&self) -> bool
Check if this is a monorepo (has workspaces).
Sourcepub fn package_manager_name(&self) -> Option<&str>
pub fn package_manager_name(&self) -> Option<&str>
Extract the package manager name from the packageManager field.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Package
impl<'de> Deserialize<'de> for Package
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnwindSafe for Package
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more