From dad460ad37ecbbe972528ed81bb4173b192309fa Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Tue, 8 Aug 2023 13:43:50 -0700 Subject: [PATCH] Convert to monorepo with utils library --- .vscode/settings.json | 6 ++++++ Cargo.lock | 8 ++++++++ Cargo.toml | 14 ++------------ tatoeba/Cargo.toml | 13 +++++++++++++ {src => tatoeba/src}/error.rs | 0 {src => tatoeba/src}/main.rs | 1 - utils/Cargo.toml | 9 +++++++++ src/utils.rs => utils/src/lib.rs | 0 8 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 tatoeba/Cargo.toml rename {src => tatoeba/src}/error.rs (100%) rename {src => tatoeba/src}/main.rs (98%) create mode 100644 utils/Cargo.toml rename src/utils.rs => utils/src/lib.rs (100%) diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a16172a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "rust-analyzer.linkedProjects": [ + "./tatoeba/Cargo.toml", + "./utils/Cargo.toml" + ] +} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 94073b2..0566f61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1277,6 +1277,7 @@ dependencies = [ "derive_more", "mime", "reqwest", + "utils", ] [[package]] @@ -1448,6 +1449,13 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utils" +version = "0.1.0" +dependencies = [ + "actix-web", +] + [[package]] name = "vcpkg" version = "0.2.15" diff --git a/Cargo.toml b/Cargo.toml index 4d9c0bb..aa17899 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,2 @@ -[package] -name = "tatoeba-api" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -actix-web = "4.3.1" -derive_more = "0.99.17" -mime = "0.3.17" -reqwest = "0.11.18" +[workspace] +members = ["tatoeba", "utils"] diff --git a/tatoeba/Cargo.toml b/tatoeba/Cargo.toml new file mode 100644 index 0000000..36a6705 --- /dev/null +++ b/tatoeba/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "tatoeba-api" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +utils = { path = "../utils" } +actix-web = "4.3.1" +derive_more = "0.99.17" +mime = "0.3.17" +reqwest = "0.11.18" diff --git a/src/error.rs b/tatoeba/src/error.rs similarity index 100% rename from src/error.rs rename to tatoeba/src/error.rs diff --git a/src/main.rs b/tatoeba/src/main.rs similarity index 98% rename from src/main.rs rename to tatoeba/src/main.rs index 368871c..f696f5a 100644 --- a/src/main.rs +++ b/tatoeba/src/main.rs @@ -1,7 +1,6 @@ mod error; pub use error::{Error, Result}; -pub mod utils; use utils::is_human; use actix_web::{get, http::header, App, HttpRequest, HttpResponse, HttpServer, Responder}; diff --git a/utils/Cargo.toml b/utils/Cargo.toml new file mode 100644 index 0000000..16a8069 --- /dev/null +++ b/utils/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "utils" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +actix-web = "4.3.1" diff --git a/src/utils.rs b/utils/src/lib.rs similarity index 100% rename from src/utils.rs rename to utils/src/lib.rs