Merge pull request #5 from oscartbeaumont/main

add Cargo workspace & fix Prisma
This commit is contained in:
Jamie Pine
2022-03-30 01:19:28 -07:00
committed by GitHub
14 changed files with 1144 additions and 2963 deletions

3
.gitignore vendored
View File

@@ -57,4 +57,5 @@ yalc.lock
.npmrc
!create-turbo/templates/**/*
todos.md
examples/*/*.lock
examples/*/*.lock
/target

7
.rustfmt.toml Normal file
View File

@@ -0,0 +1,7 @@
hard_tabs = true
tab_spaces = 4
match_block_trailing_comma = true
max_width = 90
newline_style = "Unix"
use_field_init_shorthand = true
use_try_shorthand = true

View File

@@ -1,10 +1,5 @@
{
"cSpell.words": ["ipfs", "repr", "tailwindcss"],
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.diagnostics.enableExperimental": false,
"rust-analyzer.linkedProjects": [
"./packages/core/Cargo.toml",
"./apps/desktop/src-tauri/Cargo.toml",
"./apps/debug/Cargo.toml"
]
"rust-analyzer.diagnostics.enableExperimental": false
}

View File

Binary file not shown.

6
Cargo.toml Normal file
View File

@@ -0,0 +1,6 @@
[workspace]
members = [
"apps/debug",
"apps/desktop/src-tauri",
"packages/core"
]

BIN
apps/debug/Cargo.lock generated
View File

Binary file not shown.

View File

@@ -10,12 +10,12 @@ edition = "2018"
build = "src/build.rs"
[build-dependencies]
tauri-build = { version = "1.0.0-beta.3" }
tauri-build = { version = "1.0.0-rc.5", features = [] }
swift-rs = "0.2.3"
[dependencies]
# Project dependencies
tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["api-all"] }
tauri = { version = "1.0.0-rc.6", features = ["api-all"] }
sdcorelib = { path = "../../../packages/core" }
# tauri-plugin-shadows = { git = "https://github.com/tauri-apps/tauri-plugin-shadows", features = ["tauri-impl"] }

View File

@@ -1,4 +1,4 @@
use tauri::{CustomMenuItem, Menu, MenuItem, Submenu, WindowMenuEvent, Wry};
use tauri::{AboutMetadata, CustomMenuItem, Menu, MenuItem, Submenu, WindowMenuEvent, Wry};
pub(crate) fn get_menu() -> Menu {
// let quit = CustomMenuItem::new("quit".to_string(), "Quit");
@@ -11,7 +11,10 @@ pub(crate) fn get_menu() -> Menu {
let spacedrive = Submenu::new(
"Spacedrive",
Menu::new()
.add_native_item(MenuItem::About("Spacedrive".to_string()))
.add_native_item(MenuItem::About(
"Spacedrive".to_string(),
AboutMetadata::new(),
)) // TODO: fill out about metadata
.add_native_item(MenuItem::Separator)
.add_native_item(MenuItem::Services)
.add_native_item(MenuItem::Separator)

BIN
packages/core/Cargo.lock generated
View File

Binary file not shown.

View File

@@ -29,7 +29,7 @@ once_cell = "1.8.0"
int-enum = "0.4.0"
# Project dependencies
ts-rs = "6.1"
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", rev = "022b799929c0e5b1a7dc1565ec8228ba52a32991" }
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", rev = "848f9ed11fdcccd9f67011a5650166146f863eba" }
walkdir = "^2.3.2"
bytesize = "1.1.0"
env_logger = "0.9.0"

View File

@@ -11,7 +11,7 @@ const INIT_MIGRATION: &str =
static MIGRATIONS_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/prisma/migrations");
pub async fn run_migrations(db_url: &str) -> Result<()> {
let client = prisma::new_client_with_url(&format!("file:{}", &db_url)).await;
let client = prisma::new_client_with_url(&format!("file:{}", &db_url)).await?;
match client
._query_raw::<serde_json::Value>(

View File

@@ -9,6 +9,8 @@ pub enum DatabaseError {
MissingConnection,
#[error("Unable find current_library in the client config")]
MalformedConfig,
#[error("Unable to initialise the Prisma client")]
ClientError(#[from] prisma::NewClientError),
}
pub async fn create_connection() -> Result<PrismaClient, DatabaseError> {
@@ -23,6 +25,6 @@ pub async fn create_connection() -> Result<PrismaClient, DatabaseError> {
let path = current_library.library_path.clone();
// TODO: Error handling when brendan adds it to prisma-client-rust
let client = prisma::new_client_with_url(&format!("file:{}", &path)).await;
let client = prisma::new_client_with_url(&format!("file:{}", &path)).await?;
Ok(client)
}

View File

File diff suppressed because one or more lines are too long

3851
yarn.lock
View File

File diff suppressed because it is too large Load Diff