Skip to content

Commit

Permalink
Apply exports for CI typegen
Browse files Browse the repository at this point in the history
  • Loading branch information
johncarmack1984 committed Oct 13, 2024
1 parent bb98678 commit b28fbf7
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 59 deletions.
57 changes: 50 additions & 7 deletions example/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 2 additions & 44 deletions taurpc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions taurpc/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const createTauRPCProxy = () => createProxy<Router>(ARGS_MAP)
/// By default, if the `export_to` attribute was not specified on the procedures macro, it will be exported
/// to `node_modules/.taurpc` and a `package.json` will also be generated to import the package.
/// Otherwise the code will just be export to the .ts file specified by the user.
pub(super) fn export_types(
pub fn export_types(
export_path: Option<&'static str>,
handlers: Vec<(&'static str, &'static str)>,
args_map: String,
Expand Down Expand Up @@ -57,7 +57,7 @@ pub(super) fn export_types(
file.write_all(generate_router_type(handlers).as_bytes())
.unwrap();

if export_path.ends_with("node_modules\\.taurpc\\index.ts") {
if export_path.ends_with("node_modules/.taurpc/index.ts") {
let package_json_path = Path::new(&export_path)
.parent()
.map(|path| path.join("package.json"))
Expand Down
12 changes: 6 additions & 6 deletions taurpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use tauri::{AppHandle, Emitter, Runtime};

pub use taurpc_macros::{ipc_type, procedures, resolvers};

mod export;
use export::export_types;
pub mod export;
pub use export::export_types;

/// A trait, which is automatically implemented by `#[taurpc::procedures]`, that is used for handling incoming requests
/// and the type generation.
Expand Down Expand Up @@ -204,10 +204,10 @@ impl EventTrigger {
/// ```
#[derive(Default)]
pub struct Router {
handlers: HashMap<String, Sender<Arc<Invoke<tauri::Wry>>>>,
export_path: Option<&'static str>,
args_map_json: HashMap<&'static str, String>,
handler_paths: Vec<(&'static str, &'static str)>,
pub handlers: HashMap<String, Sender<Arc<Invoke<tauri::Wry>>>>,
pub export_path: Option<&'static str>,
pub args_map_json: HashMap<&'static str, String>,
pub handler_paths: Vec<(&'static str, &'static str)>,
}

impl Router {
Expand Down

0 comments on commit b28fbf7

Please sign in to comment.