From 6a4e44918c7c05a675d54665e4b5e35d740facf7 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Wed, 5 Jul 2023 10:40:58 +0200 Subject: [PATCH] Version 0.7.3 --- .vscode/settings.json | 2 +- CHANGELOG.md | 8 ++++++++ Cargo.lock | 6 +++--- Cargo.toml | 2 +- packages/lib-roblox/src/document/mod.rs | 18 +++++++++++++++++- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 13f714f..a6cfda4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,7 @@ "luau-lsp.types.roblox": false, "luau-lsp.require.mode": "relativeToFile", "luau-lsp.require.directoryAliases": { - "@lune/": "./docs/typedefs" + "@lune/": "./docs/typedefs/" }, // Luau - ignore type defs file in docs dir and dev scripts we use "luau-lsp.ignoreGlobs": [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dce105..a42ddbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## `0.7.3` - July 5th, 2023 + +### Changed + +- When using `roblox.serializeModel`, Lune will no longer keep internal unique ids.
+ This is consistent with what Roblox does and prevents Lune from always generating a new and unique file.
+ This previously caused unnecessary diffs when using git or other kinds of source control. ([Relevant issue](https://github.com/filiptibell/lune/issues/61)) + ## `0.7.2` - June 28th, 2023 ### Added diff --git a/Cargo.lock b/Cargo.lock index e99216b..4d64f1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1138,7 +1138,7 @@ dependencies = [ [[package]] name = "lune" -version = "0.7.2" +version = "0.7.3" dependencies = [ "anyhow", "async-compression", @@ -1169,7 +1169,7 @@ dependencies = [ [[package]] name = "lune-cli" -version = "0.7.2" +version = "0.7.3" dependencies = [ "anyhow", "clap 4.3.8", @@ -1193,7 +1193,7 @@ dependencies = [ [[package]] name = "lune-roblox" -version = "0.7.2" +version = "0.7.3" dependencies = [ "anyhow", "glam", diff --git a/Cargo.toml b/Cargo.toml index 414d1c9..a6177e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ default-members = ["packages/cli"] # Package config values shared across all packages, # such as version, license, and other metadata [workspace.package] -version = "0.7.2" +version = "0.7.3" edition = "2021" license = "MPL-2.0" repository = "https://github.com/filiptibell/lune" diff --git a/packages/lib-roblox/src/document/mod.rs b/packages/lib-roblox/src/document/mod.rs index ca89453..8a741e1 100644 --- a/packages/lib-roblox/src/document/mod.rs +++ b/packages/lib-roblox/src/document/mod.rs @@ -1,4 +1,4 @@ -use rbx_dom_weak::{InstanceBuilder as DomInstanceBuilder, WeakDom}; +use rbx_dom_weak::{types::Ref as DomRef, InstanceBuilder as DomInstanceBuilder, WeakDom}; use rbx_xml::{ DecodeOptions as XmlDecodeOptions, DecodePropertyBehavior as XmlDecodePropertyBehavior, EncodeOptions as XmlEncodeOptions, EncodePropertyBehavior as XmlEncodePropertyBehavior, @@ -274,6 +274,9 @@ impl Document { instance.clone_into_external_dom(&mut dom); } + let root_ref = dom.root_ref(); + recurse_strip_unique_ids(&mut dom, root_ref); + Ok(Self { kind: DocumentKind::Model, format: DocumentFormat::default(), @@ -281,3 +284,16 @@ impl Document { }) } } + +fn recurse_strip_unique_ids(dom: &mut WeakDom, dom_ref: DomRef) { + let child_refs = match dom.get_by_ref_mut(dom_ref) { + Some(inst) => { + inst.properties.remove("UniqueId"); + inst.children().to_vec() + } + None => Vec::new(), + }; + for child_ref in child_refs { + recurse_strip_unique_ids(dom, child_ref) + } +}