feat: implement default sourcemap_generator script

This commit is contained in:
daimond113 2024-08-11 17:45:48 +02:00
parent 09307276b0
commit 48f591a48a
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
3 changed files with 18 additions and 3 deletions

2
Cargo.lock generated
View file

@ -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",

View file

@ -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 }

View file

@ -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] =