Skip to content

Commit

Permalink
chore: 修改项目路径结构,使用 workspace 组织包 (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoaer committed Jun 7, 2024
1 parent c4db12b commit 1744f86
Show file tree
Hide file tree
Showing 44 changed files with 181 additions and 4,753 deletions.
186 changes: 92 additions & 94 deletions Cargo.lock

Large diffs are not rendered by default.

33 changes: 19 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
[package]
name = "bili-sync-rs"
[workspace]
members = ["crates/*"]
default-members = ["crates/bili_sync"]
resolver = "2"

[workspace.package]
version = "2.0.3"
edition = "2021"
authors = ["amtoaer <amtoaer@gmail.com>"]
license = "MIT"
description = "基于 rust tokio 编写的 bilibili 收藏夹同步下载工具"
edition = "2021"
publish = false

[workspace.dependencies]
bili_sync_entity = { path = "crates/bili_sync_entity" }
bili_sync_migration = { path = "crates/bili_sync_migration" }

[dependencies]
anyhow = { version = "1.0.81", features = ["backtrace"] }
arc-swap = { version = "1.7", features = ["serde"] }
async-std = { version = "1", features = ["attributes", "tokio1"] }
async-stream = "0.3.5"
chrono = { version = "0.4.35", features = ["serde"] }
cookie = "0.18.0"
dirs = "5.0.1"
entity = { path = "entity" }
filenamify = "0.1.0"
float-ord = "0.3.2"
futures = "0.3.30"
handlebars = "5.1.2"
hex = "0.4.3"
log = "0.4.21"
memchr = "2.5.0"
migration = { path = "migration" }
once_cell = "1.19.0"
prost = "0.12.4"
quick-xml = { version = "0.31.0", features = ["async-tokio"] }
rand = "0.8.5"
regex = "1.10.3"
reqwest = { version = "0.12.4", features = [
"json",
"stream",
"charset",
"cookies",
"gzip",
"charset",
"http2",
"json",
"rustls-tls",
"stream",
], default-features = false }
rsa = { version = "0.9.6", features = ["sha2"] }
sea-orm = { version = "0.12", features = [
"sqlx-sqlite",
"runtime-tokio-rustls",
"macros",
"runtime-tokio-rustls",
"sqlx-sqlite",
] }
sea-orm-migration = { version = "0.12.0", features = [] }
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0"
strum = { version = "0.26", features = ["derive"] }
Expand All @@ -51,9 +59,6 @@ toml = "0.8.12"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["chrono"] }

[workspace]
members = [".", "entity", "migration"]

[profile.release]
strip = true
lto = "thin"
Expand Down
46 changes: 46 additions & 0 deletions crates/bili_sync/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[package]
name = "bili_sync"
version = { workspace = true }
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
description = { workspace = true }
publish = { workspace = true }
readme = "../../README.md"

[dependencies]
anyhow = { workspace = true }
arc-swap = { workspace = true }
async-stream = { workspace = true }
bili_sync_entity = { workspace = true }
bili_sync_migration = { workspace = true }
chrono = { workspace = true }
cookie = { workspace = true }
dirs = { workspace = true }
filenamify = { workspace = true }
float-ord = { workspace = true }
futures = { workspace = true }
handlebars = { workspace = true }
hex = { workspace = true }
log = { workspace = true }
memchr = { workspace = true }
once_cell = { workspace = true }
prost = { workspace = true }
quick-xml = { workspace = true }
rand = { workspace = true }
regex = { workspace = true }
reqwest = { workspace = true }
rsa = { workspace = true }
sea-orm = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
strum = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
toml = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }

[[bin]]
name = "bili-sync-rs"
path = "src/main.rs"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
use std::pin::Pin;

use anyhow::{bail, Result};
use entity::{favorite, page, video};
use bili_sync_entity::{favorite, page, video};
use filenamify::filenamify;
use futures::stream::{FuturesOrdered, FuturesUnordered};
use futures::{pin_mut, Future, StreamExt};
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/core/utils.rs → crates/bili_sync/src/core/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use std::collections::HashSet;
use std::path::Path;

use anyhow::Result;
use entity::*;
use bili_sync_entity::*;
use bili_sync_migration::OnConflict;
use filenamify::filenamify;
use handlebars::handlebars_helper;
use migration::OnConflict;
use once_cell::sync::Lazy;
use quick_xml::events::{BytesCData, BytesText};
use quick_xml::writer::Writer;
Expand Down
2 changes: 1 addition & 1 deletion src/database.rs → crates/bili_sync/src/database.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use migration::{Migrator, MigratorTrait};
use bili_sync_migration::{Migrator, MigratorTrait};
use sea_orm::{ConnectOptions, Database, DatabaseConnection};
use tokio::fs;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions crates/bili_sync_entity/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "bili_sync_entity"
version = { workspace = true }
edition = { workspace = true }
publish = { workspace = true }

[dependencies]
sea-orm = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions crates/bili_sync_migration/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "bili_sync_migration"
version = { workspace = true }
edition = { workspace = true }
publish = { workspace = true }

[dependencies]
async-std = { workspace = true }
sea-orm-migration = { workspace = true }
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ use sea_orm_migration::prelude::*;

#[async_std::main]
async fn main() {
cli::run_cli(migration::Migrator).await;
cli::run_cli(bili_sync_migration::Migrator).await;
}
Loading

0 comments on commit 1744f86

Please sign in to comment.