mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
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:
parent
779e3de0ae
commit
84f76d48fc
118 changed files with 75 additions and 97 deletions
11
.config/nextest.toml
Normal file
11
.config/nextest.toml
Normal 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
|
||||
|
|
@ -4,6 +4,6 @@
|
|||
"$path": "src"
|
||||
},
|
||||
"globIgnorePaths": [
|
||||
"**/*.spec.lua"
|
||||
"**/*.spec.luau"
|
||||
]
|
||||
}
|
||||
|
|
@ -4,6 +4,6 @@
|
|||
"$path": "subproject"
|
||||
},
|
||||
"globIgnorePaths": [
|
||||
"**/*.spec.lua"
|
||||
"**/*.spec.luau"
|
||||
]
|
||||
}
|
||||
|
|
@ -4,6 +4,6 @@
|
|||
"$path": "src"
|
||||
},
|
||||
"globIgnorePaths": [
|
||||
"**/*.spec.lua"
|
||||
"**/*.spec.luau"
|
||||
]
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
"$className": "DataModel",
|
||||
"ReplicatedStorage": {
|
||||
"Main": {
|
||||
"$path": "main.lua"
|
||||
"$path": "main.luau"
|
||||
}
|
||||
},
|
||||
"HttpService": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "json_as_lua",
|
||||
"tree": {
|
||||
"$path": "make-me-a-script.json"
|
||||
"$path": "make-me-a-script.json5"
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ const UNKNOWN_INPUT_KIND_ERR: &str = "Could not detect what kind of file was inp
|
|||
/// given.
|
||||
///
|
||||
/// 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 ease programmatic use, this command pipes all normal output to stderr.
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ pub struct InstanceMetadata {
|
|||
///
|
||||
/// A directory named bar/ might have these:
|
||||
/// - bar/
|
||||
/// - bar/init.meta.json
|
||||
/// - bar/init.lua
|
||||
/// - bar/init.server.lua
|
||||
/// - bar/init.client.lua
|
||||
/// - bar/default.project.json
|
||||
/// - bar/init.meta.json5
|
||||
/// - bar/init.luau
|
||||
/// - bar/init.server.luau
|
||||
/// - bar/init.client.luau
|
||||
/// - bar/default.project.json5
|
||||
///
|
||||
/// This path is used to make sure that file changes update all instances
|
||||
/// that may need updates.
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ pub fn snapshot_dir(
|
|||
|
||||
/// Snapshot a directory without applying meta files; useful for if the
|
||||
/// 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.
|
||||
pub fn snapshot_dir_no_meta(
|
||||
context: &InstanceContext,
|
||||
|
|
@ -68,12 +68,11 @@ pub fn snapshot_dir_no_meta(
|
|||
// TODO: We shouldn't need to know about Lua existing in this
|
||||
// middleware. Should we figure out a way for that function to add
|
||||
// relevant paths to this middleware?
|
||||
normalized_path.join("init.lua"),
|
||||
normalized_path.join("init.luau"),
|
||||
normalized_path.join("init.server.lua"),
|
||||
normalized_path.join("init.server.luau"),
|
||||
normalized_path.join("init.client.lua"),
|
||||
normalized_path.join("init.client.luau"),
|
||||
normalized_path.join("init.local.luau"),
|
||||
normalized_path.join("init.legacy.luau"),
|
||||
normalized_path.join("init.csv"),
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ mod test {
|
|||
fn instance_from_vfs() {
|
||||
let mut imfs = InMemoryFs::new();
|
||||
imfs.load_snapshot(
|
||||
"/foo.json",
|
||||
"/foo.json5",
|
||||
VfsSnapshot::file(
|
||||
r#"{
|
||||
"array": [1, 2, 3],
|
||||
|
|
@ -98,7 +98,7 @@ mod test {
|
|||
let instance_snapshot = snapshot_json(
|
||||
&InstanceContext::default(),
|
||||
&vfs,
|
||||
Path::new("/foo.json"),
|
||||
Path::new("/foo.json5"),
|
||||
"foo",
|
||||
)
|
||||
.unwrap()
|
||||
|
|
@ -111,7 +111,7 @@ mod test {
|
|||
fn with_metadata() {
|
||||
let mut imfs = InMemoryFs::new();
|
||||
imfs.load_snapshot(
|
||||
"/foo.json",
|
||||
"/foo.json5",
|
||||
VfsSnapshot::file(
|
||||
r#"{
|
||||
"array": [1, 2, 3],
|
||||
|
|
@ -136,7 +136,7 @@ mod test {
|
|||
let instance_snapshot = snapshot_json(
|
||||
&InstanceContext::default(),
|
||||
&vfs,
|
||||
Path::new("/foo.json"),
|
||||
Path::new("/foo.json5"),
|
||||
"foo",
|
||||
)
|
||||
.unwrap()
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ pub fn snapshot_json_model(
|
|||
})?;
|
||||
|
||||
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!(
|
||||
"Model at path {} had a top-level Name field. \
|
||||
|
|
@ -229,7 +229,7 @@ mod test {
|
|||
fn model_from_vfs() {
|
||||
let mut imfs = InMemoryFs::new();
|
||||
imfs.load_snapshot(
|
||||
"/foo.model.json",
|
||||
"/foo.model.json5",
|
||||
VfsSnapshot::file(
|
||||
r#"
|
||||
{
|
||||
|
|
@ -254,7 +254,7 @@ mod test {
|
|||
let instance_snapshot = snapshot_json_model(
|
||||
&InstanceContext::default(),
|
||||
&vfs,
|
||||
Path::new("/foo.model.json"),
|
||||
Path::new("/foo.model.json5"),
|
||||
"foo",
|
||||
)
|
||||
.unwrap()
|
||||
|
|
@ -267,7 +267,7 @@ mod test {
|
|||
fn model_from_vfs_legacy() {
|
||||
let mut imfs = InMemoryFs::new();
|
||||
imfs.load_snapshot(
|
||||
"/foo.model.json",
|
||||
"/foo.model.json5",
|
||||
VfsSnapshot::file(
|
||||
r#"
|
||||
{
|
||||
|
|
@ -292,7 +292,7 @@ mod test {
|
|||
let instance_snapshot = snapshot_json_model(
|
||||
&InstanceContext::default(),
|
||||
&vfs,
|
||||
Path::new("/foo.model.json"),
|
||||
Path::new("/foo.model.json5"),
|
||||
"foo",
|
||||
)
|
||||
.unwrap()
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ pub fn snapshot_lua(
|
|||
/// Attempts to snapshot an 'init' Lua script contained inside of a folder with
|
||||
/// the given name.
|
||||
///
|
||||
/// Scripts named `init.lua`, `init.server.lua`, `init.client.lua`, `init.local.lua`,
|
||||
/// `init.legacy.lua`, or `init.plugin.lua` usurp their parents, which acts similarly
|
||||
/// Scripts named `init.luau`, `init.server.luau`, `init.client.luau`, `init.local.luau`,
|
||||
/// `init.legacy.luau`, or `init.plugin.luau` usurp their parents, which acts similarly
|
||||
/// to `__init__.py` from the Python world.
|
||||
pub fn snapshot_lua_init(
|
||||
context: &InstanceContext,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// that the Instances they're running on originate in a project.json.
|
||||
// As a result, the `meta.json` syncback code is hardcoded to not work
|
||||
// that the Instances they're running on originate in a project.json5.
|
||||
// As a result, the `meta.json5` syncback code is hardcoded to not work
|
||||
// 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() {
|
||||
// Since the node has a path, we have to run syncback on it.
|
||||
let node_path = node.path.as_ref().map(PathNode::path).expect(
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@ metadata:
|
|||
Path: /root
|
||||
relevant_paths:
|
||||
- /root
|
||||
- /root/init.lua
|
||||
- /root/init.luau
|
||||
- /root/init.server.lua
|
||||
- /root/init.server.luau
|
||||
- /root/init.client.lua
|
||||
- /root/init.client.luau
|
||||
- /root/init.local.luau
|
||||
- /root/init.legacy.luau
|
||||
- /root/init.csv
|
||||
- /root/init.meta.json5
|
||||
context:
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@ metadata:
|
|||
Path: /root
|
||||
relevant_paths:
|
||||
- /root
|
||||
- /root/init.lua
|
||||
- /root/init.luau
|
||||
- /root/init.server.lua
|
||||
- /root/init.server.luau
|
||||
- /root/init.client.lua
|
||||
- /root/init.client.luau
|
||||
- /root/init.local.luau
|
||||
- /root/init.legacy.luau
|
||||
- /root/init.csv
|
||||
- /root/init.meta.json5
|
||||
context:
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@ metadata:
|
|||
Path: /foo
|
||||
relevant_paths:
|
||||
- /foo
|
||||
- /foo/init.lua
|
||||
- /foo/init.luau
|
||||
- /foo/init.server.lua
|
||||
- /foo/init.server.luau
|
||||
- /foo/init.client.lua
|
||||
- /foo/init.client.luau
|
||||
- /foo/init.local.luau
|
||||
- /foo/init.legacy.luau
|
||||
- /foo/init.csv
|
||||
- /foo/init.meta.json5
|
||||
context:
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@ metadata:
|
|||
Path: /foo
|
||||
relevant_paths:
|
||||
- /foo
|
||||
- /foo/init.lua
|
||||
- /foo/init.luau
|
||||
- /foo/init.server.lua
|
||||
- /foo/init.server.luau
|
||||
- /foo/init.client.lua
|
||||
- /foo/init.client.luau
|
||||
- /foo/init.local.luau
|
||||
- /foo/init.legacy.luau
|
||||
- /foo/init.csv
|
||||
- /foo/init.meta.json5
|
||||
context:
|
||||
|
|
@ -33,12 +32,11 @@ children:
|
|||
Path: /foo/Child
|
||||
relevant_paths:
|
||||
- /foo/Child
|
||||
- /foo/Child/init.lua
|
||||
- /foo/Child/init.luau
|
||||
- /foo/Child/init.server.lua
|
||||
- /foo/Child/init.server.luau
|
||||
- /foo/Child/init.client.lua
|
||||
- /foo/Child/init.client.luau
|
||||
- /foo/Child/init.local.luau
|
||||
- /foo/Child/init.legacy.luau
|
||||
- /foo/Child/init.csv
|
||||
- /foo/Child/init.meta.json5
|
||||
context:
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ snapshot_id: "00000000000000000000000000000000"
|
|||
metadata:
|
||||
ignore_unknown_instances: false
|
||||
instigating_source:
|
||||
Path: /foo.json
|
||||
Path: /foo.json5
|
||||
relevant_paths:
|
||||
- /foo.json
|
||||
- /foo.json5
|
||||
- /foo.meta.json5
|
||||
context:
|
||||
decode_windows_invalid_chars: true
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ snapshot_id: "00000000000000000000000000000000"
|
|||
metadata:
|
||||
ignore_unknown_instances: false
|
||||
instigating_source:
|
||||
Path: /foo.json
|
||||
Path: /foo.json5
|
||||
relevant_paths:
|
||||
- /foo.json
|
||||
- /foo.json5
|
||||
- /foo.meta.json5
|
||||
context:
|
||||
decode_windows_invalid_chars: true
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ snapshot_id: "00000000000000000000000000000000"
|
|||
metadata:
|
||||
ignore_unknown_instances: false
|
||||
instigating_source:
|
||||
Path: /foo.model.json
|
||||
Path: /foo.model.json5
|
||||
relevant_paths:
|
||||
- /foo.model.json
|
||||
- /foo.model.json5
|
||||
context:
|
||||
decode_windows_invalid_chars: true
|
||||
specified_id: ~
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ snapshot_id: "00000000000000000000000000000000"
|
|||
metadata:
|
||||
ignore_unknown_instances: false
|
||||
instigating_source:
|
||||
Path: /foo.model.json
|
||||
Path: /foo.model.json5
|
||||
relevant_paths:
|
||||
- /foo.model.json
|
||||
- /foo.model.json5
|
||||
context:
|
||||
decode_windows_invalid_chars: true
|
||||
specified_id: ~
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@ metadata:
|
|||
Path: /root/init.luau
|
||||
relevant_paths:
|
||||
- /root
|
||||
- /root/init.lua
|
||||
- /root/init.luau
|
||||
- /root/init.server.lua
|
||||
- /root/init.server.luau
|
||||
- /root/init.client.lua
|
||||
- /root/init.client.luau
|
||||
- /root/init.local.luau
|
||||
- /root/init.legacy.luau
|
||||
- /root/init.csv
|
||||
- /root/init.meta.json5
|
||||
context:
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@ metadata:
|
|||
Path: /root/init.luau
|
||||
relevant_paths:
|
||||
- /root
|
||||
- /root/init.lua
|
||||
- /root/init.luau
|
||||
- /root/init.server.lua
|
||||
- /root/init.server.luau
|
||||
- /root/init.client.lua
|
||||
- /root/init.client.luau
|
||||
- /root/init.local.luau
|
||||
- /root/init.legacy.luau
|
||||
- /root/init.csv
|
||||
- /root/init.meta.json5
|
||||
context:
|
||||
|
|
|
|||
|
|
@ -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: []
|
||||
|
|
@ -2236,8 +2236,6 @@ mod tests {
|
|||
// Comprehensive RunContext Configuration Tests
|
||||
// =========================================================================
|
||||
mod run_context_comprehensive_tests {
|
||||
use super::*;
|
||||
|
||||
/// Helper to get RunContext enum value by name
|
||||
fn get_run_context_value(name: &str) -> Option<u32> {
|
||||
rbx_reflection_database::get()
|
||||
|
|
@ -2947,8 +2945,6 @@ mod tests {
|
|||
// Syncback Configuration Matrix Tests
|
||||
// =========================================================================
|
||||
mod syncback_configuration_matrix {
|
||||
use super::*;
|
||||
|
||||
/// Test matrix for all script class + RunContext combinations
|
||||
#[test]
|
||||
fn test_configuration_matrix() {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue