Skip to content

Commit

Permalink
fix: sozo build --typescript now properly orders contracts.gen.ts (#3074
Browse files Browse the repository at this point in the history
)
  • Loading branch information
MartianGreed authored Feb 28, 2025
1 parent 60e0a6b commit 9fba033
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/dojo/bindgen/src/plugins/typescript/writer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::path::{Path, PathBuf};

use cainome::parser::tokens::Composite;
use dojo_world::contracts::naming;

use crate::error::BindgenResult;
use crate::plugins::{BindgenContractGenerator, BindgenModelGenerator, BindgenWriter, Buffer};
Expand Down Expand Up @@ -148,7 +149,15 @@ impl BindgenWriter for TsFileContractWriter {
.collect::<Vec<_>>()
})
.collect::<Vec<_>>();
functions.sort_by(|(_, af), (_, bf)| af.name.cmp(&bf.name));

functions.sort_by(|(ca, af), (cb, bf)| {
let contract_a = naming::get_name_from_tag(&ca.tag);
let contract_b = naming::get_name_from_tag(&cb.tag);
let function_a = format!("{}_{}", contract_a, af.name);
let function_b = format!("{}_{}", contract_b, bf.name);

function_a.cmp(&function_b)
});

let code = self
.generators
Expand Down

0 comments on commit 9fba033

Please sign in to comment.