2022-11-08 21:13:28 +08:00
|
|
|
#[cfg(feature = "proto_gen")]
|
2022-02-15 21:27:00 +08:00
|
|
|
pub mod protobuf_file;
|
|
|
|
|
|
|
|
#[cfg(feature = "dart_event")]
|
|
|
|
pub mod dart_event;
|
|
|
|
|
2023-01-17 16:27:17 +08:00
|
|
|
#[cfg(feature = "ts_event")]
|
|
|
|
pub mod ts_event;
|
|
|
|
|
|
|
|
#[cfg(any(feature = "proto_gen", feature = "dart_event", feature = "ts_event"))]
|
2022-02-15 21:27:00 +08:00
|
|
|
mod flowy_toml;
|
|
|
|
|
2023-01-18 11:22:13 +08:00
|
|
|
pub(crate) mod ast;
|
2023-01-17 16:27:17 +08:00
|
|
|
#[cfg(any(feature = "proto_gen", feature = "dart_event", feature = "ts_event"))]
|
2022-02-16 10:00:31 +08:00
|
|
|
pub mod util;
|
2022-02-16 12:22:26 +08:00
|
|
|
|
|
|
|
#[derive(serde::Serialize, serde::Deserialize)]
|
|
|
|
pub struct ProtoCache {
|
2023-02-13 09:29:49 +08:00
|
|
|
pub structs: Vec<String>,
|
|
|
|
pub enums: Vec<String>,
|
2022-02-16 12:22:26 +08:00
|
|
|
}
|
2024-01-30 05:36:27 +08:00
|
|
|
|
|
|
|
pub enum Project {
|
|
|
|
Tauri,
|
2024-04-03 19:25:54 +08:00
|
|
|
TauriApp,
|
2024-01-30 05:36:27 +08:00
|
|
|
Native,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Project {
|
|
|
|
pub fn dst(&self) -> String {
|
|
|
|
match self {
|
|
|
|
Project::Tauri => "appflowy_tauri/src/services/backend".to_string(),
|
2024-04-03 19:25:54 +08:00
|
|
|
Project::TauriApp => {
|
|
|
|
"appflowy_web_app/src/application/services/tauri-services/backend".to_string()
|
|
|
|
},
|
2024-01-30 05:36:27 +08:00
|
|
|
Project::Native => panic!("Native project is not supported yet."),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn event_root(&self) -> String {
|
|
|
|
match self {
|
2024-04-03 19:25:54 +08:00
|
|
|
Project::Tauri | Project::TauriApp => "../../".to_string(),
|
2024-01-30 05:36:27 +08:00
|
|
|
Project::Native => panic!("Native project is not supported yet."),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn model_root(&self) -> String {
|
|
|
|
match self {
|
2024-04-03 19:25:54 +08:00
|
|
|
Project::Tauri | Project::TauriApp => "../../".to_string(),
|
2024-01-30 05:36:27 +08:00
|
|
|
Project::Native => panic!("Native project is not supported yet."),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn event_imports(&self) -> String {
|
|
|
|
match self {
|
2024-04-03 19:25:54 +08:00
|
|
|
Project::TauriApp | Project::Tauri => r#"
|
2024-01-30 05:36:27 +08:00
|
|
|
/// Auto generate. Do not edit
|
|
|
|
import { Ok, Err, Result } from "ts-results";
|
|
|
|
import { invoke } from "@tauri-apps/api/tauri";
|
|
|
|
import * as pb from "../..";
|
|
|
|
"#
|
|
|
|
.to_string(),
|
|
|
|
Project::Native => panic!("Native project is not supported yet."),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|