diff --git a/Cargo.toml b/Cargo.toml index 1a1f669..58fbcc0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "design_token_parser" -version = "3.1.3" +version = "3.1.4" edition = "2021" repository = "https://github.com/vrrashkov/TokenParser" readme = "README.md" diff --git a/src/deserializer.rs b/src/deserializer.rs index 788d57d..f261b8e 100644 --- a/src/deserializer.rs +++ b/src/deserializer.rs @@ -69,6 +69,7 @@ pub struct ConfigTokensGlobalOtherPathCombineWithMode { #[serde(skip_serializing_if = "Option::is_none")] #[serde(default)] pub file_name: Option, + pub merge: Vec, #[serde(alias = "files")] pub files: Vec } diff --git a/src/figma_parser.rs b/src/figma_parser.rs index 8695700..3e3e275 100644 --- a/src/figma_parser.rs +++ b/src/figma_parser.rs @@ -83,10 +83,10 @@ pub fn filter_properties(token_config: &deserializer::TokensConfig) { // merging files and updating the values // the merged files are dependant on the config - let mut data_object: serde_json::Value = serde_json::Value::Null; let mut file_name = String::from(""); 'figma_output: for group in &token_config.global.figma_output_paths { + let mut data_object: serde_json::Value = serde_json::Value::Null; for (index, fileData) in group.combine.files.iter().enumerate() { let combineFileName = &group.combine.file_name.to_owned().unwrap(); @@ -99,11 +99,11 @@ pub fn filter_properties(token_config: &deserializer::TokensConfig) { let uniqueName = Path::new(&fileData.path).file_stem().unwrap().to_str().unwrap().to_owned(); - if !¤tList.contains(&fileData.path) { + if !¤tList.contains(&fileData.path) || !group.combine.merge.contains(&sourceFileName.to_owned()) { continue } - dbg!(¤tList); - dbg!(&fileData.path); + dbg!(currentList); + dbg!(&uniqueName); let mut data_to_merge_with: serde_json::Value = general::get_json(&fileData.path); diff --git a/src/main.rs b/src/main.rs index 0b2ed5e..23a83a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,7 @@ fn main() { // Covert to usable code let matches: clap::ArgMatches = Command::new("Design Tokens") - .version("3.1.3") + .version("3.1.4") .author("Vladislav R. ") .about("Parses figma design tokens to usable code") .arg(Arg::new("config").short('c').long("config").action(ArgAction::Set).required(true))