mirror of
https://github.com/Noratrieb/node-package-manager.git
synced 2026-01-14 15:45:03 +01:00
full package json
This commit is contained in:
parent
bf1809e025
commit
c5e1b8011c
3 changed files with 135 additions and 62 deletions
106
src/manifest.rs
106
src/manifest.rs
|
|
@ -1,16 +1,106 @@
|
|||
use indexmap::map::IndexMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Human {
|
||||
pub name: String,
|
||||
pub url: Option<String>,
|
||||
pub email: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Person {
|
||||
Simple(String),
|
||||
Expanded(Human),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct ExpandedFunding {
|
||||
pub r#type: String,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Funding {
|
||||
Simple(String),
|
||||
Expanded(ExpandedFunding),
|
||||
Multiple(Vec<ExpandedFunding>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Bugs {
|
||||
pub url: Option<String>,
|
||||
pub email: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Repository {
|
||||
pub r#type: String,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Bin {
|
||||
Single(String),
|
||||
Multiple(IndexMap<String, String>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Man {
|
||||
Single(String),
|
||||
Multiple(Vec<String>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct PeerDependencyMeta {
|
||||
pub optional: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Override {
|
||||
Version(String),
|
||||
Nested(IndexMap<String, Override>),
|
||||
}
|
||||
|
||||
/// https://docs.npmjs.com/cli/v8/configuring-npm/package-json
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PackageJson {
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub description: Option<String>,
|
||||
pub keywords: Option<Vec<String>>,
|
||||
pub homepage: Option<String>,
|
||||
pub bugs: Option<Bugs>,
|
||||
pub license: Option<String>,
|
||||
pub author: Option<Person>,
|
||||
pub contributors: Option<Vec<Person>>,
|
||||
pub funding: Option<Funding>,
|
||||
pub files: Option<Vec<String>>,
|
||||
pub main: Option<String>,
|
||||
pub browser: Option<String>,
|
||||
pub bin: Option<Bin>,
|
||||
pub man: Option<Man>,
|
||||
pub directories: Option<IndexMap<String, String>>,
|
||||
pub repository: Option<Repository>,
|
||||
pub scripts: Option<IndexMap<String, String>>,
|
||||
pub config: Option<IndexMap<String, serde_json::Value>>,
|
||||
pub dependencies: Option<IndexMap<String, String>>,
|
||||
pub dev_dependencies: Option<IndexMap<String, String>>,
|
||||
pub peer_dependencies: Option<IndexMap<String, String>>,
|
||||
pub peer_dependencies_meta: Option<IndexMap<String, PeerDependencyMeta>>,
|
||||
pub bundled_dependencies: Option<Vec<String>>,
|
||||
pub optional_dependencies: Option<IndexMap<String, String>>,
|
||||
pub overrides: Option<IndexMap<String, Override>>,
|
||||
pub engines: Option<IndexMap<String, String>>,
|
||||
pub os: Option<Vec<String>>,
|
||||
pub cpu: Option<Vec<String>>,
|
||||
pub private: Option<bool>,
|
||||
#[serde(default = "IndexMap::new")]
|
||||
pub scripts: IndexMap<String, String>,
|
||||
#[serde(default = "IndexMap::new")]
|
||||
pub dependencies: IndexMap<String, String>,
|
||||
#[serde(default = "IndexMap::new")]
|
||||
pub dev_dependencies: IndexMap<String, String>,
|
||||
pub publish_config: Option<IndexMap<String, serde_json::Value>>,
|
||||
pub workspaces: Option<Vec<String>>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue