Add a new syncRules field project files to allow users to specify middleware to use for files (#813)

This commit is contained in:
Micah
2024-01-19 22:18:17 -08:00
committed by GitHub
parent c0a96e3811
commit 73828af715
48 changed files with 923 additions and 146 deletions

View File

@@ -0,0 +1,18 @@
---
source: tests/tests/build.rs
assertion_line: 102
expression: contents
---
<roblox version="4">
<Item class="Folder" referent="0">
<Properties>
<string name="Name">sync_rule_alone</string>
</Properties>
<Item class="StringValue" referent="1">
<Properties>
<string name="Name">foo</string>
<string name="Value">Hello, world!</string>
</Properties>
</Item>
</Item>
</roblox>

View File

@@ -0,0 +1,43 @@
---
source: tests/tests/build.rs
assertion_line: 104
expression: contents
---
<roblox version="4">
<Item class="Folder" referent="0">
<Properties>
<string name="Name">sync_rule_complex</string>
</Properties>
<Item class="Script" referent="1">
<Properties>
<string name="Name">bar</string>
<token name="RunContext">0</token>
<string name="Source">-- Hello, from bar (a Script)!</string>
</Properties>
</Item>
<Item class="LocalScript" referent="2">
<Properties>
<string name="Name">baz</string>
<string name="Source">-- Hello, from baz (a LocalScript)!</string>
</Properties>
</Item>
<Item class="StringValue" referent="3">
<Properties>
<string name="Name">cat</string>
<string name="Value">Hello, from cat (a StringValue)!</string>
</Properties>
</Item>
<Item class="ModuleScript" referent="4">
<Properties>
<string name="Name">foo</string>
<string name="Source">-- Hello, from foo (a ModuleScript)!</string>
</Properties>
</Item>
<Item class="StringValue" referent="5">
<Properties>
<string name="Name">qux</string>
<string name="Value">Hello, from qux (a .rojo file that's turned into a StringValue)!</string>
</Properties>
</Item>
</Item>
</roblox>

View File

@@ -0,0 +1,12 @@
---
source: tests/tests/build.rs
assertion_line: 104
expression: contents
---
<roblox version="4">
<Item class="Folder" referent="0">
<Properties>
<string name="Name">sync_rule_nested_projects</string>
</Properties>
</Item>
</roblox>

View File

@@ -0,0 +1,12 @@
{
"name": "sync_rule_alone",
"tree": {
"$path": "src"
},
"syncRules": [
{
"pattern": "*.nothing",
"use": "text"
}
]
}

View File

@@ -0,0 +1 @@
Hello, world!

View File

@@ -0,0 +1,30 @@
{
"name": "sync_rule_complex",
"tree": {
"$path": "src"
},
"syncRules": [
{
"pattern": "*.module",
"use": "moduleScript"
},
{
"pattern": "*.server",
"use": "serverScript"
},
{
"pattern": "*.client",
"use": "clientScript"
},
{
"pattern": "*.rojo",
"exclude": "*.ignore.rojo",
"use": "project"
},
{
"pattern": "*.dog.rojo2",
"use": "text",
"suffix": ".dog.rojo2"
}
]
}

View File

@@ -0,0 +1 @@
-- Hello, from bar (a Script)!

View File

@@ -0,0 +1 @@
-- Hello, from baz (a LocalScript)!

View File

@@ -0,0 +1 @@
Hello, from cat (a StringValue)!

View File

@@ -0,0 +1 @@
-- Hello, from foo (a ModuleScript)!

View File

@@ -0,0 +1,9 @@
{
"name": "qux",
"tree": {
"$className": "StringValue",
"$properties": {
"Value": "Hello, from qux (a .rojo file that's turned into a StringValue)!"
}
}
}

View File

@@ -0,0 +1 @@
This file should be ignored!

View File

@@ -0,0 +1,12 @@
{
"name": "sync_rule_nested_projects",
"tree": {
"$path": "nested.project.json"
},
"syncRules": [
{
"pattern": "*.rojo",
"use": "text"
}
]
}

View File

@@ -0,0 +1,12 @@
{
"name": "nested",
"tree": {
"$path": "src"
},
"syncRules": [
{
"pattern": "*.txt",
"use": "ignore"
}
]
}

View File

@@ -0,0 +1 @@
This shouldn't be in the built file. If it is, something is wrong.

View File

@@ -0,0 +1 @@
This shouldn't be in the built file. If it is, something is wrong.

View File

@@ -0,0 +1,30 @@
---
source: tests/tests/serve.rs
assertion_line: 268
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
---
instances:
id-2:
Children:
- id-3
ClassName: Folder
Id: id-2
Metadata:
ignoreUnknownInstances: false
Name: sync_rule_alone
Parent: "00000000000000000000000000000000"
Properties: {}
id-3:
Children: []
ClassName: StringValue
Id: id-3
Metadata:
ignoreUnknownInstances: false
Name: foo
Parent: id-2
Properties:
Value:
String: "Hello, world!"
messageCursor: 0
sessionId: id-1

View File

@@ -0,0 +1,14 @@
---
source: tests/tests/serve.rs
assertion_line: 265
expression: redactions.redacted_yaml(info)
---
expectedPlaceIds: ~
gameId: ~
placeId: ~
projectName: sync_rule_alone
protocolVersion: 4
rootInstanceId: id-2
serverVersion: "[server-version]"
sessionId: id-1

View File

@@ -0,0 +1,80 @@
---
source: tests/tests/serve.rs
assertion_line: 284
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
---
instances:
id-2:
Children:
- id-3
- id-4
- id-5
- id-6
- id-7
ClassName: Folder
Id: id-2
Metadata:
ignoreUnknownInstances: false
Name: sync_rule_complex
Parent: "00000000000000000000000000000000"
Properties: {}
id-3:
Children: []
ClassName: Script
Id: id-3
Metadata:
ignoreUnknownInstances: false
Name: bar
Parent: id-2
Properties:
RunContext:
Enum: 0
Source:
String: "-- Hello, from bar (a Script)!"
id-4:
Children: []
ClassName: LocalScript
Id: id-4
Metadata:
ignoreUnknownInstances: false
Name: baz
Parent: id-2
Properties:
Source:
String: "-- Hello, from baz (a LocalScript)!"
id-5:
Children: []
ClassName: StringValue
Id: id-5
Metadata:
ignoreUnknownInstances: false
Name: cat
Parent: id-2
Properties:
Value:
String: "Hello, from cat (a StringValue)!"
id-6:
Children: []
ClassName: ModuleScript
Id: id-6
Metadata:
ignoreUnknownInstances: false
Name: foo
Parent: id-2
Properties:
Source:
String: "-- Hello, from foo (a ModuleScript)!"
id-7:
Children: []
ClassName: StringValue
Id: id-7
Metadata:
ignoreUnknownInstances: true
Name: qux
Parent: id-2
Properties:
Value:
String: "Hello, from qux (a .rojo file that's turned into a StringValue)!"
messageCursor: 0
sessionId: id-1

View File

@@ -0,0 +1,14 @@
---
source: tests/tests/serve.rs
assertion_line: 281
expression: redactions.redacted_yaml(info)
---
expectedPlaceIds: ~
gameId: ~
placeId: ~
projectName: sync_rule_complex
protocolVersion: 4
rootInstanceId: id-2
serverVersion: "[server-version]"
sessionId: id-1

View File

@@ -0,0 +1,30 @@
---
source: tests/tests/serve.rs
assertion_line: 303
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
---
instances:
id-2:
Children:
- id-3
ClassName: Folder
Id: id-2
Metadata:
ignoreUnknownInstances: false
Name: sync_rule_no_extension
Parent: "00000000000000000000000000000000"
Properties: {}
id-3:
Children: []
ClassName: ModuleScript
Id: id-3
Metadata:
ignoreUnknownInstances: false
Name: no_extension
Parent: id-2
Properties:
Source:
String: "return {\"This file has no extension but should be a ModuleScript named `no_extension`\"}"
messageCursor: 0
sessionId: id-1

View File

@@ -0,0 +1,14 @@
---
source: tests/tests/serve.rs
assertion_line: 297
expression: redactions.redacted_yaml(info)
---
expectedPlaceIds: ~
gameId: ~
placeId: ~
projectName: sync_rule_no_extension
protocolVersion: 4
rootInstanceId: id-2
serverVersion: "[server-version]"
sessionId: id-1

View File

@@ -0,0 +1,12 @@
{
"name": "sync_rule_alone",
"tree": {
"$path": "src"
},
"syncRules": [
{
"pattern": "*.nothing",
"use": "text"
}
]
}

View File

@@ -0,0 +1 @@
Hello, world!

View File

@@ -0,0 +1,30 @@
{
"name": "sync_rule_complex",
"tree": {
"$path": "src"
},
"syncRules": [
{
"pattern": "*.module",
"use": "moduleScript"
},
{
"pattern": "*.server",
"use": "serverScript"
},
{
"pattern": "*.client",
"use": "clientScript"
},
{
"pattern": "*.rojo",
"exclude": "*.ignore.rojo",
"use": "project"
},
{
"pattern": "*.dog.rojo2",
"use": "text",
"suffix": ".dog.rojo2"
}
]
}

View File

@@ -0,0 +1 @@
-- Hello, from bar (a Script)!

View File

@@ -0,0 +1 @@
-- Hello, from baz (a LocalScript)!

View File

@@ -0,0 +1 @@
Hello, from cat (a StringValue)!

View File

@@ -0,0 +1 @@
-- Hello, from foo (a ModuleScript)!

View File

@@ -0,0 +1,9 @@
{
"name": "qux",
"tree": {
"$className": "StringValue",
"$properties": {
"Value": "Hello, from qux (a .rojo file that's turned into a StringValue)!"
}
}
}

View File

@@ -0,0 +1 @@
This file should be ignored!

View File

@@ -0,0 +1,12 @@
{
"name": "sync_rule_no_extension",
"tree": {
"$path": "src"
},
"syncRules": [
{
"pattern": "src/**",
"use": "json"
}
]
}

View File

@@ -0,0 +1 @@
["This file has no extension but should be a ModuleScript named `no_extension`"]