From 48f591a48a4059952d3f3af67cf23cac716bf4d8 Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Sun, 11 Aug 2024 17:45:48 +0200 Subject: [PATCH] feat: implement default sourcemap_generator script --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/cli/commands/init.rs | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e972336..d1e0b8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "gix-worktree-state" version = "0.11.1" -source = "git+https://github.com/daimond113/gitoxide?rev=753961c2cc23982a7d8c327dbc68c4dd26bce193#753961c2cc23982a7d8c327dbc68c4dd26bce193" +source = "git+https://github.com/daimond113/gitoxide?rev=0447211a773f4da62b9bb9e7db73d047e09aed66#0447211a773f4da62b9bb9e7db73d047e09aed66" dependencies = [ "bstr", "gix-features", diff --git a/Cargo.toml b/Cargo.toml index 5a9d3f3..1d35991 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ inquire = { version = "0.7.5", optional = true } # TODO: remove this when a release with https://github.com/Byron/gitoxide/commit/aab78f102113330f96c3140c472aaab0912bc553 is available [patch.crates-io] -gix-worktree-state = { git = "https://github.com/daimond113/gitoxide", rev = "753961c2cc23982a7d8c327dbc68c4dd26bce193" } +gix-worktree-state = { git = "https://github.com/daimond113/gitoxide", rev = "0447211a773f4da62b9bb9e7db73d047e09aed66" } [target.'cfg(target_os = "windows")'.dependencies] winreg = { version = "0.52.0", optional = true } diff --git a/src/cli/commands/init.rs b/src/cli/commands/init.rs index 050f177..dfe1198 100644 --- a/src/cli/commands/init.rs +++ b/src/cli/commands/init.rs @@ -135,13 +135,28 @@ impl InitCommand { ScriptName::RobloxSyncConfigGenerator ))), ) - .context("failed to write script file")?; + .context("failed to write sync config generator script file")?; + + std::fs::write( + folder.join(format!("{}.luau", ScriptName::SourcemapGenerator)), + script_contents(Path::new(&format!( + "lune/rojo/{}.luau", + ScriptName::SourcemapGenerator + ))), + ) + .context("failed to write sourcemap generator script file")?; manifest["scripts"][&ScriptName::RobloxSyncConfigGenerator.to_string()] = toml_edit::value(format!( concat!(".", env!("CARGO_PKG_NAME"), "/{}.luau"), ScriptName::RobloxSyncConfigGenerator )); + + manifest["scripts"][&ScriptName::SourcemapGenerator.to_string()] = + toml_edit::value(format!( + concat!(".", env!("CARGO_PKG_NAME"), "/{}.luau"), + ScriptName::SourcemapGenerator + )); } manifest["indices"][DEFAULT_INDEX_NAME] =