Skip to content

Commit fca5848

Browse files
committed
bump tealr version
1 parent fe50841 commit fca5848

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# bevy_mod_scripting Changelog
2+
## Unreleased
3+
- Bump `tealr_doc_gen` and `tealr` versions
4+
25
## v0.2.1
36
### Added
47
- Automatic documentation publishing for lua Bevy api

languages/bevy_mod_scripting_lua/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ path="src/lib.rs"
4242
[dependencies]
4343
bevy= { version = "0.9.1", default-features = false}
4444
bevy_mod_scripting_core = {path="../../bevy_mod_scripting_core", version = "0.2.1" }
45-
tealr = { version = "=0.9.0-alpha3", features=["mlua_vendored","mlua_send"]}
45+
tealr = { version = "=0.9.0-alpha4", features=["mlua_vendored","mlua_send"]}
4646
parking_lot = "0.12.1"
4747
serde_json = "1.0.81"
4848
serde = { version = "1", features = ["derive"] }

languages/bevy_mod_scripting_lua/src/docs.rs

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ impl DocFragment for LuaDocFragment {
9292
.fold(TypeWalker::new(), |a, v| (v.builder)(a));
9393

9494
// generate json file
95-
let mut json = serde_json::to_string_pretty(&tw)
95+
let json = serde_json::to_string_pretty(&tw)
9696
.map_err(|e| ScriptError::DocGenError(e.to_string()))?;
9797

9898
// temporary fix for incompatibility in json formats
99-
json.remove(json.len() - 1);
100-
json.push_str(",\n\"tealr_version_used\": \"0.9.0-alpha3\",\n\"extra_page\": []\n}");
99+
// json.remove(json.len() - 1);
100+
// json.push_str(",\n\"tealr_version_used\": \"0.9.0-alpha3\",\n\"extra_page\": []\n}");
101101

102102
let json_path = script_doc_dir.join(format!("{}.json", docs_name));
103103

@@ -125,23 +125,27 @@ impl DocFragment for LuaDocFragment {
125125

126126
#[cfg(feature = "teal")]
127127
{
128-
// now generate teal declaration (d.tl) file
129-
130-
let script_types_dir = &script_asset_path.join("types");
131-
fs::create_dir_all(script_types_dir)
132-
.expect("Could not create `.../assets/scripts/types` directories");
133-
134-
let decl_path = &script_types_dir.join("types.d.tl");
135-
// generate declaration file
136-
let decl_file_contents = tw.generate("types", true).unwrap();
137-
138-
let mut decl_file =
139-
File::create(decl_path).map_err(|e| ScriptError::DocGenError(e.to_string()))?;
140-
141-
decl_file
142-
.write_all(decl_file_contents.as_bytes())
143-
.expect("Failed to write to declaration file");
144-
decl_file.flush().unwrap();
128+
// now manage the definition (d.tl) file
129+
let definition_directory = script_asset_path.join("types");
130+
fs::create_dir_all(&definition_directory).map_err(|e| {
131+
ScriptError::DocGenError(format!(
132+
"Could not create `{}` directories: {e}",
133+
&definition_directory.display()
134+
))
135+
})?;
136+
137+
let definition_file_path = script_doc_dir
138+
.join(&docs_name)
139+
.join("definitions")
140+
.join(docs_name + ".d.tl");
141+
let output_definition_file_path = script_asset_path.join("types").join("types.d.tl");
142+
fs::copy(&definition_file_path, &output_definition_file_path).map_err(|e| {
143+
ScriptError::DocGenError(format!(
144+
"Could not copy definition file from `{}` to `{}`: {e}",
145+
definition_file_path.display(),
146+
output_definition_file_path.display()
147+
))
148+
})?;
145149

146150
// finally create a tlconfig.lua file if doesn't exist
147151
// we do this to avoid problems with varying teal configurations

0 commit comments

Comments
 (0)