use std::fs;
use std::path::Path;
use crate::types::{PackageJson, Result};

pub fn read_package_json() -> Result<PackageJson> {
    let content = fs::read_to_string("package.json")?;
    let package_json: PackageJson = serde_json::from_str(&content)?;
    Ok(package_json)
}

pub fn package_json_exists() -> bool {
    Path::new("package.json").exists()
}