Add project configuration and test files in JSON5 format

- Introduced new configuration files for testing, including `default.project.json5`, `client_in_folder`, and others.
- Updated existing project files to use JSON5 format, ensuring consistency across configurations.
- Added new Lua scripts and model files to support various test cases.
- Adjusted snapshot files to align with the new project structure and properties.
This commit is contained in:
Joe 2026-01-30 09:16:46 -06:00
parent 779e3de0ae
commit 84f76d48fc
118 changed files with 75 additions and 97 deletions

11
.config/nextest.toml Normal file
View file

@ -0,0 +1,11 @@
[profile.default]
# Set a 10 second timeout for all tests
slow-timeout = { period = "10s", terminate-after = 1 }
# Fail fast on first test failure
fail-fast = true
[profile.ci]
# CI profile with same timeout
slow-timeout = { period = "10s", terminate-after = 1 }
fail-fast = false

View file

@ -4,6 +4,6 @@
"$path": "src" "$path": "src"
}, },
"globIgnorePaths": [ "globIgnorePaths": [
"**/*.spec.lua" "**/*.spec.luau"
] ]
} }

View file

@ -4,6 +4,6 @@
"$path": "subproject" "$path": "subproject"
}, },
"globIgnorePaths": [ "globIgnorePaths": [
"**/*.spec.lua" "**/*.spec.luau"
] ]
} }

View file

@ -4,6 +4,6 @@
"$path": "src" "$path": "src"
}, },
"globIgnorePaths": [ "globIgnorePaths": [
"**/*.spec.lua" "**/*.spec.luau"
] ]
} }

View file

@ -4,7 +4,7 @@
"$className": "DataModel", "$className": "DataModel",
"ReplicatedStorage": { "ReplicatedStorage": {
"Main": { "Main": {
"$path": "main.lua" "$path": "main.luau"
} }
}, },
"HttpService": { "HttpService": {

View file

@ -1,6 +1,6 @@
{ {
"name": "json_as_lua", "name": "json_as_lua",
"tree": { "tree": {
"$path": "make-me-a-script.json" "$path": "make-me-a-script.json5"
} }
} }

View file

@ -27,7 +27,7 @@ const UNKNOWN_INPUT_KIND_ERR: &str = "Could not detect what kind of file was inp
/// given. /// given.
/// ///
/// Syncback exists to convert Roblox files into a Rojo project automatically. /// Syncback exists to convert Roblox files into a Rojo project automatically.
/// It uses the project.json file provided to traverse the Roblox file passed as /// It uses the project.json5 file provided to traverse the Roblox file passed as
/// to serialize Instances to the file system in a format that Rojo understands. /// to serialize Instances to the file system in a format that Rojo understands.
/// ///
/// To ease programmatic use, this command pipes all normal output to stderr. /// To ease programmatic use, this command pipes all normal output to stderr.

View file

@ -36,11 +36,11 @@ pub struct InstanceMetadata {
/// ///
/// A directory named bar/ might have these: /// A directory named bar/ might have these:
/// - bar/ /// - bar/
/// - bar/init.meta.json /// - bar/init.meta.json5
/// - bar/init.lua /// - bar/init.luau
/// - bar/init.server.lua /// - bar/init.server.luau
/// - bar/init.client.lua /// - bar/init.client.luau
/// - bar/default.project.json /// - bar/default.project.json5
/// ///
/// This path is used to make sure that file changes update all instances /// This path is used to make sure that file changes update all instances
/// that may need updates. /// that may need updates.

View file

@ -33,7 +33,7 @@ pub fn snapshot_dir(
/// Snapshot a directory without applying meta files; useful for if the /// Snapshot a directory without applying meta files; useful for if the
/// directory's ClassName will change before metadata should be applied. For /// directory's ClassName will change before metadata should be applied. For
/// example, this can happen if the directory contains an `init.client.lua` /// example, this can happen if the directory contains an `init.client.luau`
/// file. /// file.
pub fn snapshot_dir_no_meta( pub fn snapshot_dir_no_meta(
context: &InstanceContext, context: &InstanceContext,
@ -68,12 +68,11 @@ pub fn snapshot_dir_no_meta(
// TODO: We shouldn't need to know about Lua existing in this // TODO: We shouldn't need to know about Lua existing in this
// middleware. Should we figure out a way for that function to add // middleware. Should we figure out a way for that function to add
// relevant paths to this middleware? // relevant paths to this middleware?
normalized_path.join("init.lua"),
normalized_path.join("init.luau"), normalized_path.join("init.luau"),
normalized_path.join("init.server.lua"),
normalized_path.join("init.server.luau"), normalized_path.join("init.server.luau"),
normalized_path.join("init.client.lua"),
normalized_path.join("init.client.luau"), normalized_path.join("init.client.luau"),
normalized_path.join("init.local.luau"),
normalized_path.join("init.legacy.luau"),
normalized_path.join("init.csv"), normalized_path.join("init.csv"),
]; ];

View file

@ -75,7 +75,7 @@ mod test {
fn instance_from_vfs() { fn instance_from_vfs() {
let mut imfs = InMemoryFs::new(); let mut imfs = InMemoryFs::new();
imfs.load_snapshot( imfs.load_snapshot(
"/foo.json", "/foo.json5",
VfsSnapshot::file( VfsSnapshot::file(
r#"{ r#"{
"array": [1, 2, 3], "array": [1, 2, 3],
@ -98,7 +98,7 @@ mod test {
let instance_snapshot = snapshot_json( let instance_snapshot = snapshot_json(
&InstanceContext::default(), &InstanceContext::default(),
&vfs, &vfs,
Path::new("/foo.json"), Path::new("/foo.json5"),
"foo", "foo",
) )
.unwrap() .unwrap()
@ -111,7 +111,7 @@ mod test {
fn with_metadata() { fn with_metadata() {
let mut imfs = InMemoryFs::new(); let mut imfs = InMemoryFs::new();
imfs.load_snapshot( imfs.load_snapshot(
"/foo.json", "/foo.json5",
VfsSnapshot::file( VfsSnapshot::file(
r#"{ r#"{
"array": [1, 2, 3], "array": [1, 2, 3],
@ -136,7 +136,7 @@ mod test {
let instance_snapshot = snapshot_json( let instance_snapshot = snapshot_json(
&InstanceContext::default(), &InstanceContext::default(),
&vfs, &vfs,
Path::new("/foo.json"), Path::new("/foo.json5"),
"foo", "foo",
) )
.unwrap() .unwrap()

View file

@ -36,7 +36,7 @@ pub fn snapshot_json_model(
})?; })?;
if let Some(top_level_name) = &instance.name { if let Some(top_level_name) = &instance.name {
let new_name = format!("{}.model.json", top_level_name); let new_name = format!("{}.model.json5", top_level_name);
log::warn!( log::warn!(
"Model at path {} had a top-level Name field. \ "Model at path {} had a top-level Name field. \
@ -229,7 +229,7 @@ mod test {
fn model_from_vfs() { fn model_from_vfs() {
let mut imfs = InMemoryFs::new(); let mut imfs = InMemoryFs::new();
imfs.load_snapshot( imfs.load_snapshot(
"/foo.model.json", "/foo.model.json5",
VfsSnapshot::file( VfsSnapshot::file(
r#" r#"
{ {
@ -254,7 +254,7 @@ mod test {
let instance_snapshot = snapshot_json_model( let instance_snapshot = snapshot_json_model(
&InstanceContext::default(), &InstanceContext::default(),
&vfs, &vfs,
Path::new("/foo.model.json"), Path::new("/foo.model.json5"),
"foo", "foo",
) )
.unwrap() .unwrap()
@ -267,7 +267,7 @@ mod test {
fn model_from_vfs_legacy() { fn model_from_vfs_legacy() {
let mut imfs = InMemoryFs::new(); let mut imfs = InMemoryFs::new();
imfs.load_snapshot( imfs.load_snapshot(
"/foo.model.json", "/foo.model.json5",
VfsSnapshot::file( VfsSnapshot::file(
r#" r#"
{ {
@ -292,7 +292,7 @@ mod test {
let instance_snapshot = snapshot_json_model( let instance_snapshot = snapshot_json_model(
&InstanceContext::default(), &InstanceContext::default(),
&vfs, &vfs,
Path::new("/foo.model.json"), Path::new("/foo.model.json5"),
"foo", "foo",
) )
.unwrap() .unwrap()

View file

@ -85,8 +85,8 @@ pub fn snapshot_lua(
/// Attempts to snapshot an 'init' Lua script contained inside of a folder with /// Attempts to snapshot an 'init' Lua script contained inside of a folder with
/// the given name. /// the given name.
/// ///
/// Scripts named `init.lua`, `init.server.lua`, `init.client.lua`, `init.local.lua`, /// Scripts named `init.luau`, `init.server.luau`, `init.client.luau`, `init.local.luau`,
/// `init.legacy.lua`, or `init.plugin.lua` usurp their parents, which acts similarly /// `init.legacy.luau`, or `init.plugin.luau` usurp their parents, which acts similarly
/// to `__init__.py` from the Python world. /// to `__init__.py` from the Python world.
pub fn snapshot_lua_init( pub fn snapshot_lua_init(
context: &InstanceContext, context: &InstanceContext,

View file

@ -354,12 +354,12 @@ pub fn syncback_project<'sync>(
); );
} }
// TODO handle meta.json files in this branch. Right now, we perform // TODO handle meta.json5 files in this branch. Right now, we perform
// syncback if a node has `$path` set but the Middleware aren't aware // syncback if a node has `$path` set but the Middleware aren't aware
// that the Instances they're running on originate in a project.json. // that the Instances they're running on originate in a project.json5.
// As a result, the `meta.json` syncback code is hardcoded to not work // As a result, the `meta.json5` syncback code is hardcoded to not work
// if the Instance originates from a project file. However, we should // if the Instance originates from a project file. However, we should
// ideally use a .meta.json over the project node if it exists already. // ideally use a .meta.json5 over the project node if it exists already.
if node.path.is_some() { if node.path.is_some() {
// Since the node has a path, we have to run syncback on it. // Since the node has a path, we have to run syncback on it.
let node_path = node.path.as_ref().map(PathNode::path).expect( let node_path = node.path.as_ref().map(PathNode::path).expect(

View file

@ -9,12 +9,11 @@ metadata:
Path: /root Path: /root
relevant_paths: relevant_paths:
- /root - /root
- /root/init.lua
- /root/init.luau - /root/init.luau
- /root/init.server.lua
- /root/init.server.luau - /root/init.server.luau
- /root/init.client.lua
- /root/init.client.luau - /root/init.client.luau
- /root/init.local.luau
- /root/init.legacy.luau
- /root/init.csv - /root/init.csv
- /root/init.meta.json5 - /root/init.meta.json5
context: context:

View file

@ -9,12 +9,11 @@ metadata:
Path: /root Path: /root
relevant_paths: relevant_paths:
- /root - /root
- /root/init.lua
- /root/init.luau - /root/init.luau
- /root/init.server.lua
- /root/init.server.luau - /root/init.server.luau
- /root/init.client.lua
- /root/init.client.luau - /root/init.client.luau
- /root/init.local.luau
- /root/init.legacy.luau
- /root/init.csv - /root/init.csv
- /root/init.meta.json5 - /root/init.meta.json5
context: context:

View file

@ -9,12 +9,11 @@ metadata:
Path: /foo Path: /foo
relevant_paths: relevant_paths:
- /foo - /foo
- /foo/init.lua
- /foo/init.luau - /foo/init.luau
- /foo/init.server.lua
- /foo/init.server.luau - /foo/init.server.luau
- /foo/init.client.lua
- /foo/init.client.luau - /foo/init.client.luau
- /foo/init.local.luau
- /foo/init.legacy.luau
- /foo/init.csv - /foo/init.csv
- /foo/init.meta.json5 - /foo/init.meta.json5
context: context:

View file

@ -9,12 +9,11 @@ metadata:
Path: /foo Path: /foo
relevant_paths: relevant_paths:
- /foo - /foo
- /foo/init.lua
- /foo/init.luau - /foo/init.luau
- /foo/init.server.lua
- /foo/init.server.luau - /foo/init.server.luau
- /foo/init.client.lua
- /foo/init.client.luau - /foo/init.client.luau
- /foo/init.local.luau
- /foo/init.legacy.luau
- /foo/init.csv - /foo/init.csv
- /foo/init.meta.json5 - /foo/init.meta.json5
context: context:
@ -33,12 +32,11 @@ children:
Path: /foo/Child Path: /foo/Child
relevant_paths: relevant_paths:
- /foo/Child - /foo/Child
- /foo/Child/init.lua
- /foo/Child/init.luau - /foo/Child/init.luau
- /foo/Child/init.server.lua
- /foo/Child/init.server.luau - /foo/Child/init.server.luau
- /foo/Child/init.client.lua
- /foo/Child/init.client.luau - /foo/Child/init.client.luau
- /foo/Child/init.local.luau
- /foo/Child/init.legacy.luau
- /foo/Child/init.csv - /foo/Child/init.csv
- /foo/Child/init.meta.json5 - /foo/Child/init.meta.json5
context: context:

View file

@ -6,9 +6,9 @@ snapshot_id: "00000000000000000000000000000000"
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
instigating_source: instigating_source:
Path: /foo.json Path: /foo.json5
relevant_paths: relevant_paths:
- /foo.json - /foo.json5
- /foo.meta.json5 - /foo.meta.json5
context: context:
decode_windows_invalid_chars: true decode_windows_invalid_chars: true

View file

@ -6,9 +6,9 @@ snapshot_id: "00000000000000000000000000000000"
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
instigating_source: instigating_source:
Path: /foo.json Path: /foo.json5
relevant_paths: relevant_paths:
- /foo.json - /foo.json5
- /foo.meta.json5 - /foo.meta.json5
context: context:
decode_windows_invalid_chars: true decode_windows_invalid_chars: true

View file

@ -6,9 +6,9 @@ snapshot_id: "00000000000000000000000000000000"
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
instigating_source: instigating_source:
Path: /foo.model.json Path: /foo.model.json5
relevant_paths: relevant_paths:
- /foo.model.json - /foo.model.json5
context: context:
decode_windows_invalid_chars: true decode_windows_invalid_chars: true
specified_id: ~ specified_id: ~

View file

@ -6,9 +6,9 @@ snapshot_id: "00000000000000000000000000000000"
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
instigating_source: instigating_source:
Path: /foo.model.json Path: /foo.model.json5
relevant_paths: relevant_paths:
- /foo.model.json - /foo.model.json5
context: context:
decode_windows_invalid_chars: true decode_windows_invalid_chars: true
specified_id: ~ specified_id: ~

View file

@ -9,12 +9,11 @@ metadata:
Path: /root/init.luau Path: /root/init.luau
relevant_paths: relevant_paths:
- /root - /root
- /root/init.lua
- /root/init.luau - /root/init.luau
- /root/init.server.lua
- /root/init.server.luau - /root/init.server.luau
- /root/init.client.lua
- /root/init.client.luau - /root/init.client.luau
- /root/init.local.luau
- /root/init.legacy.luau
- /root/init.csv - /root/init.csv
- /root/init.meta.json5 - /root/init.meta.json5
context: context:

View file

@ -9,12 +9,11 @@ metadata:
Path: /root/init.luau Path: /root/init.luau
relevant_paths: relevant_paths:
- /root - /root
- /root/init.lua
- /root/init.luau - /root/init.luau
- /root/init.server.lua
- /root/init.server.luau - /root/init.server.luau
- /root/init.client.lua
- /root/init.client.luau - /root/init.client.luau
- /root/init.local.luau
- /root/init.legacy.luau
- /root/init.csv - /root/init.csv
- /root/init.meta.json5 - /root/init.meta.json5
context: context:

View file

@ -1,28 +0,0 @@
---
source: src/snapshot_middleware/lua.rs
expression: instance_snapshot
---
snapshot_id: "00000000000000000000000000000000"
metadata:
ignore_unknown_instances: false
instigating_source:
Path: /foo.plugin.lua
relevant_paths:
- /foo.plugin.lua
- /foo.meta.json
- /foo.meta.jsonc
- /foo.meta.json5
context:
emit_legacy_scripts: false
decode_windows_invalid_chars: false
specified_id: ~
middleware: ~
schema: ~
name: foo
class_name: Script
properties:
RunContext:
Enum: 3
Source:
String: Hello there!
children: []

View file

@ -2236,8 +2236,6 @@ mod tests {
// Comprehensive RunContext Configuration Tests // Comprehensive RunContext Configuration Tests
// ========================================================================= // =========================================================================
mod run_context_comprehensive_tests { mod run_context_comprehensive_tests {
use super::*;
/// Helper to get RunContext enum value by name /// Helper to get RunContext enum value by name
fn get_run_context_value(name: &str) -> Option<u32> { fn get_run_context_value(name: &str) -> Option<u32> {
rbx_reflection_database::get() rbx_reflection_database::get()
@ -2947,8 +2945,6 @@ mod tests {
// Syncback Configuration Matrix Tests // Syncback Configuration Matrix Tests
// ========================================================================= // =========================================================================
mod syncback_configuration_matrix { mod syncback_configuration_matrix {
use super::*;
/// Test matrix for all script class + RunContext combinations /// Test matrix for all script class + RunContext combinations
#[test] #[test]
fn test_configuration_matrix() { fn test_configuration_matrix() {

Some files were not shown because too many files have changed in this diff Show more