From 5c396322d9290bd4ce26a245eb2f0df80d6aca73 Mon Sep 17 00:00:00 2001 From: astrid Date: Mon, 15 Dec 2025 19:08:18 +0100 Subject: [PATCH] fix: `name` prop not properly syncing --- ...ests__build__slugified_name_roundtrip.snap | 20 +++++++++++++++++++ .../_Script/init.meta.json | 4 ++++ .../_Script/init.server.luau | 2 ++ .../default.project.json | 6 ++++++ .../src/_Script/init.meta.json | 3 +++ .../src/_Script/init.server.luau | 1 + src/snapshot_middleware/meta_file.rs | 6 ++++++ tests/tests/build.rs | 1 + 8 files changed, 43 insertions(+) create mode 100644 rojo-test/build-test-snapshots/end_to_end__tests__build__slugified_name_roundtrip.snap create mode 100644 rojo-test/build-tests/slugified_name_roundtrip/_Script/init.meta.json create mode 100644 rojo-test/build-tests/slugified_name_roundtrip/_Script/init.server.luau create mode 100644 rojo-test/build-tests/slugified_name_roundtrip/default.project.json create mode 100644 rojo-test/build-tests/slugified_name_roundtrip/src/_Script/init.meta.json create mode 100644 rojo-test/build-tests/slugified_name_roundtrip/src/_Script/init.server.luau diff --git a/rojo-test/build-test-snapshots/end_to_end__tests__build__slugified_name_roundtrip.snap b/rojo-test/build-test-snapshots/end_to_end__tests__build__slugified_name_roundtrip.snap new file mode 100644 index 00000000..c88e9a80 --- /dev/null +++ b/rojo-test/build-test-snapshots/end_to_end__tests__build__slugified_name_roundtrip.snap @@ -0,0 +1,20 @@ +--- +source: tests/tests/build.rs +assertion_line: 108 +expression: contents +--- + + + + slugified_name_roundtrip + + + + /Script + 0 + + + + + diff --git a/rojo-test/build-tests/slugified_name_roundtrip/_Script/init.meta.json b/rojo-test/build-tests/slugified_name_roundtrip/_Script/init.meta.json new file mode 100644 index 00000000..eb7e860c --- /dev/null +++ b/rojo-test/build-tests/slugified_name_roundtrip/_Script/init.meta.json @@ -0,0 +1,4 @@ +{ + "name": "/Script" +} + diff --git a/rojo-test/build-tests/slugified_name_roundtrip/_Script/init.server.luau b/rojo-test/build-tests/slugified_name_roundtrip/_Script/init.server.luau new file mode 100644 index 00000000..b29a52f4 --- /dev/null +++ b/rojo-test/build-tests/slugified_name_roundtrip/_Script/init.server.luau @@ -0,0 +1,2 @@ +print("Hello world!") + diff --git a/rojo-test/build-tests/slugified_name_roundtrip/default.project.json b/rojo-test/build-tests/slugified_name_roundtrip/default.project.json new file mode 100644 index 00000000..79f6f8a5 --- /dev/null +++ b/rojo-test/build-tests/slugified_name_roundtrip/default.project.json @@ -0,0 +1,6 @@ +{ + "name": "slugified_name_roundtrip", + "tree": { + "$path": "src" + } +} diff --git a/rojo-test/build-tests/slugified_name_roundtrip/src/_Script/init.meta.json b/rojo-test/build-tests/slugified_name_roundtrip/src/_Script/init.meta.json new file mode 100644 index 00000000..617a69b2 --- /dev/null +++ b/rojo-test/build-tests/slugified_name_roundtrip/src/_Script/init.meta.json @@ -0,0 +1,3 @@ +{ + "name": "/Script" +} diff --git a/rojo-test/build-tests/slugified_name_roundtrip/src/_Script/init.server.luau b/rojo-test/build-tests/slugified_name_roundtrip/src/_Script/init.server.luau new file mode 100644 index 00000000..658f93e6 --- /dev/null +++ b/rojo-test/build-tests/slugified_name_roundtrip/src/_Script/init.server.luau @@ -0,0 +1 @@ +print("Hello world!") diff --git a/src/snapshot_middleware/meta_file.rs b/src/snapshot_middleware/meta_file.rs index 23a18918..3a6a6fda 100644 --- a/src/snapshot_middleware/meta_file.rs +++ b/src/snapshot_middleware/meta_file.rs @@ -245,6 +245,9 @@ impl AdjacentMetadata { self.path.display() ); } + if let Some(name) = &self.name { + snapshot.name = name.clone().into(); + } snapshot.metadata.specified_name = self.name.take(); Ok(()) } @@ -534,6 +537,9 @@ impl DirectoryMetadata { self.path.display() ); } + if let Some(name) = &self.name { + snapshot.name = name.clone().into(); + } snapshot.metadata.specified_name = self.name.take(); Ok(()) } diff --git a/tests/tests/build.rs b/tests/tests/build.rs index 8c533115..db3cdcc8 100644 --- a/tests/tests/build.rs +++ b/tests/tests/build.rs @@ -55,6 +55,7 @@ gen_build_tests! { script_meta_disabled, server_in_folder, server_init, + slugified_name_roundtrip, txt, txt_in_folder, unresolved_values,