lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

commit b57cf990638fd556abb6656a4e8906428181cdc8
parent e51682d253fb504d7ac194e2d466679e16213270
Author: triesap <tyson@radroots.org>
Date:   Fri, 20 Feb 2026 16:15:11 +0000

identity: route username constants export to ts-rs target


- switch username constants test output from crate-local bindings to ts-rs export dir
- honor ts_rs_export_dir when set and fallback to workspace target/ts-rs/identity
- keep generated ts artifacts out of source tree for sdk sync flow
- validate with cargo check and cargo test for `radroots-identity` with ts-rs enabled

Diffstat:
Mcrates/identity/src/username.rs | 27+++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/crates/identity/src/username.rs b/crates/identity/src/username.rs @@ -90,11 +90,34 @@ mod tests { #[cfg(all(test, feature = "ts-rs", feature = "std"))] mod constants_tests { use super::*; - use std::{fs, path::Path}; + use std::{ + fs, + path::{Path, PathBuf}, + }; + + fn workspace_root(manifest_dir: &Path) -> PathBuf { + let parent = manifest_dir.parent().unwrap_or(manifest_dir); + if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { + parent.parent().unwrap_or(parent).to_path_buf() + } else { + parent.to_path_buf() + } + } + + fn ts_export_dir() -> PathBuf { + if let Some(export_dir) = option_env!("TS_RS_EXPORT_DIR") { + return PathBuf::from(export_dir); + } + let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + workspace_root(&manifest_dir) + .join("target") + .join("ts-rs") + .join("identity") + } #[test] fn export_username_constants() { - let path = Path::new("./bindings").join("constants.ts"); + let path = ts_export_dir().join("constants.ts"); if let Some(parent) = path.parent() { fs::create_dir_all(parent).expect("create ts export dir"); }