fix: add feature gates to init command

This commit is contained in:
daimond113 2024-10-07 16:42:49 +02:00
parent aee036b998
commit 9a64a12f8e
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
2 changed files with 12 additions and 4 deletions

View file

@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] - 2024-10-07
### Fixed
- Add feature gates to `wally-compat` specific code in init command by @daimond113
## [0.5.0-rc.3] - 2024-10-06 ## [0.5.0-rc.3] - 2024-10-06
### Fixed ### Fixed
- Use workspace specifiers' `target` field when resolving by @daimond113 - Use workspace specifiers' `target` field when resolving by @daimond113

View file

@ -136,6 +136,7 @@ impl InitCommand {
) )
.context("failed to write sync config generator script file")?; .context("failed to write sync config generator script file")?;
#[cfg(feature = "wally-compat")]
std::fs::write( std::fs::write(
folder.join(format!("{}.luau", ScriptName::SourcemapGenerator)), folder.join(format!("{}.luau", ScriptName::SourcemapGenerator)),
script_contents(Path::new(&format!( script_contents(Path::new(&format!(
@ -154,11 +155,14 @@ impl InitCommand {
ScriptName::RobloxSyncConfigGenerator ScriptName::RobloxSyncConfigGenerator
)); ));
#[cfg(feature = "wally-compat")]
{
scripts[&ScriptName::SourcemapGenerator.to_string()] = toml_edit::value(format!( scripts[&ScriptName::SourcemapGenerator.to_string()] = toml_edit::value(format!(
concat!(".", env!("CARGO_PKG_NAME"), "/{}.luau"), concat!(".", env!("CARGO_PKG_NAME"), "/{}.luau"),
ScriptName::SourcemapGenerator ScriptName::SourcemapGenerator
)); ));
} }
}
manifest["indices"].or_insert(toml_edit::Item::Table(toml_edit::Table::new())) manifest["indices"].or_insert(toml_edit::Item::Table(toml_edit::Table::new()))
[DEFAULT_INDEX_NAME] = [DEFAULT_INDEX_NAME] =