mirror of
https://github.com/SkyfallWasTaken/dinopkg.git
synced 2025-05-22 07:03:06 +00:00
Finish off init command
This commit is contained in:
parent
6164542183
commit
c681c7b125
6 changed files with 242 additions and 15 deletions
|
@ -6,5 +6,6 @@ edition = "2021"
|
|||
[dependencies]
|
||||
serde = { version = "1.0.204", features = ["derive"] }
|
||||
serde_json = "1.0.120"
|
||||
serde_with = "3.9.0"
|
||||
thiserror = "1.0.61"
|
||||
tokio = { version = "1.38.0", features = ["fs"], optional = true }
|
||||
|
|
|
@ -2,21 +2,41 @@ use std::collections::HashMap;
|
|||
use std::path::PathBuf;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::{serde_as, skip_serializing_none};
|
||||
|
||||
mod util;
|
||||
|
||||
#[serde_as]
|
||||
#[skip_serializing_none]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PackageJson {
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub author: Option<String>,
|
||||
#[serde(default = "default_as_false")]
|
||||
#[serde(skip_serializing_if = "is_false")]
|
||||
pub private: bool,
|
||||
pub license: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub main: Option<String>,
|
||||
pub repository: Option<String>,
|
||||
|
||||
pub scripts: Option<Scripts>,
|
||||
|
||||
pub dependencies: Option<Dependencies>,
|
||||
pub dev_dependencies: Option<Dependencies>,
|
||||
}
|
||||
|
||||
// serde :/
|
||||
fn is_false(value: &bool) -> bool {
|
||||
!*value
|
||||
}
|
||||
|
||||
fn default_as_false() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub type Scripts = HashMap<String, String>;
|
||||
pub type Dependencies = HashMap<String, String>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue