Refactor project configuration to use .json format

- Replaced the legacy .json5 project file with a new .json format for `plugin.project.json`.
- Updated `build.rs` to prioritize the new .json format while maintaining backward compatibility with .json5.
- Made adjustments to the Confirming.lua file to enhance UI consistency.
- Improved metadata handling in snapshot middleware to support both modern and legacy file extensions.
This commit is contained in:
Joe 2026-01-30 10:06:32 -06:00
parent 5f059dbc16
commit 5a85c5145c
7 changed files with 50 additions and 24 deletions

View file

@ -74,8 +74,19 @@ fn main() -> Result<(), anyhow::Error> {
let template_snapshot = snapshot_from_fs_path(&templates_dir)?;
// Try modern .json5 extension first, fall back to legacy .json
let plugin_project_path = {
let json5_path = root_dir.join("plugin.project.json5");
let json_path = root_dir.join("plugin.project.json");
if json5_path.exists() {
json5_path
} else {
json_path
}
};
let plugin_snapshot = VfsSnapshot::dir(hashmap! {
"default.project.json5" => snapshot_from_fs_path(&root_dir.join("plugin.project.json5"))?,
"default.project.json5" => snapshot_from_fs_path(&plugin_project_path)?,
"plugin" => VfsSnapshot::dir(hashmap! {
"fmt" => snapshot_from_fs_path(&plugin_dir.join("fmt"))?,
"http" => snapshot_from_fs_path(&plugin_dir.join("http"))?,

View file

@ -327,18 +327,18 @@ function ConfirmingPage:render()
self:setState({ showingAcceptConfirm = false })
end,
}, {
Content = e("Frame", {
Size = UDim2.fromScale(1, 1),
BackgroundColor3 = theme.Background2,
BorderSizePixel = 0,
}, {
Message = e("TextLabel", {
Text = string.format(
"%d item%s not been reviewed.\n\nAccept selected changes and skip the rest?",
self.state.unselectedCount,
self.state.unselectedCount == 1 and " has" or "s have"
),
FontFace = theme.Font.Regular,
Content = e("Frame", {
Size = UDim2.fromScale(1, 1),
BackgroundColor3 = theme.BackgroundColor,
BorderSizePixel = 0,
}, {
Message = e("TextLabel", {
Text = string.format(
"%d item%s not been reviewed.\n\nAccept selected changes and skip the rest?",
self.state.unselectedCount,
self.state.unselectedCount == 1 and " has" or "s have"
),
FontFace = theme.Font.Main,
TextSize = theme.TextSize.Body,
TextColor3 = theme.TextColor,
TextWrapped = true,

View file

@ -133,9 +133,11 @@ fn get_dir_middleware<'path>(
(Middleware::LegacyScriptDir, "init.legacy.luau"),
(Middleware::CsvDir, "init.csv"),
// Legacy extensions (for backwards compatibility)
// init.server.lua → Script with RunContext.Legacy (old emitLegacyScripts behavior)
// init.client.lua → LocalScript (old emitLegacyScripts behavior)
(Middleware::ModuleScriptDir, "init.lua"),
(Middleware::ServerScriptDir, "init.server.lua"),
(Middleware::ClientScriptDir, "init.client.lua"),
(Middleware::LegacyScriptDir, "init.server.lua"),
(Middleware::LocalScriptDir, "init.client.lua"),
]
});
@ -431,8 +433,12 @@ pub fn default_sync_rules() -> &'static [SyncRule] {
sync_rule!("*.model.json5", JsonModel, ".model.json5"),
sync_rule!("*.json5", Json, ".json5", "*.meta.json5"),
// Legacy Lua extensions (for backwards compatibility)
sync_rule!("*.server.lua", ServerScript, ".server.lua"),
sync_rule!("*.client.lua", ClientScript, ".client.lua"),
// .server.lua → Script with RunContext.Legacy (old emitLegacyScripts behavior)
// .client.lua → LocalScript (old emitLegacyScripts behavior)
// .plugin.lua → Script with RunContext.Plugin
sync_rule!("*.server.lua", LegacyScript, ".server.lua"),
sync_rule!("*.client.lua", LocalScript, ".client.lua"),
sync_rule!("*.plugin.lua", PluginScript, ".plugin.lua"),
sync_rule!("*.lua", ModuleScript),
// Legacy JSON extensions (for backwards compatibility)
sync_rule!("*.project.json", Project, ".project.json"),

View file

@ -38,7 +38,9 @@ pub fn name_for_inst<'old>(
| Middleware::CsvDir
| Middleware::ServerScriptDir
| Middleware::ClientScriptDir
| Middleware::ModuleScriptDir => {
| Middleware::ModuleScriptDir
| Middleware::LocalScriptDir
| Middleware::LegacyScriptDir => {
let name = if encode_invalid_chars {
let encoded = encode_path_name(&new_inst.name);
// Validate for issues not fixed by encoding (trailing space/dot, control chars, reserved names)

View file

@ -306,7 +306,14 @@ impl<'sync> SyncbackSnapshot<'sync> {
pub fn filter_out_property(inst: &Instance, prop_name: &str) -> bool {
match inst.class.as_str() {
"Script" | "LocalScript" | "ModuleScript" => {
"Script" => {
// These properties shouldn't be set by scripts that are created via
// `$path` or via being on the file system.
// RunContext is filtered because it's encoded in the file extension:
// .server.luau → Server, .client.luau → Client, .plugin.luau → Plugin, .legacy.luau → Legacy
prop_name == "Source" || prop_name == "ScriptGuid" || prop_name == "RunContext"
}
"LocalScript" | "ModuleScript" => {
// These properties shouldn't be set by scripts that are created via
// `$path` or via being on the file system.
prop_name == "Source" || prop_name == "ScriptGuid"