Merge pull request #2 from jamiepine/monorepo

Monorepo
This commit is contained in:
Jamie Pine 2021-12-24 16:25:57 -08:00 committed by GitHub
commit 22b706e192
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
167 changed files with 8428 additions and 5055 deletions

38
.TODO
View file

@ -1,38 +0,0 @@
# SpaceDrive development log / todo list
✔ Configured a Tauri window
✔ Primative UI components (Button, Input, Shortcut etc)
✔ Connect & create sqlite database in application data folder
✔ Auto migrate database on app launch
✔ Define data schema in Rust
✔ Scan given directory recursively and write to database
✔ App frame and router set up
✔ Render basic file list with database data
✔ Create a global store
☐ File inspector <- CURRENT
✔ Virtualized list for explorer @done(21-10-24 04:03)
Also cache folder contents and serve lazy, updating in background
✔ Native file type icons @done(21-10-24 04:04)
✔ Cache native icons in app data folder @done(21-10-24 11:30)
☐ Native file previews
☐ Generate buffer hash
☐ Action system & command pallete
☐ Settings screen
☐ Tag creation and assignment
☐ Job queue system
☐ Right click menu
☐ Volume identification
☐ Set up Tauri updater
☐ Statistic calucations
Folder size, Volume size, Total capacity, Total unique etc..
☐ Onboarding flow
☐ Explorer grid view
☐ Explorer path viewer / editor
☐ File encryptor
☐ File viewer / player
☐ Secret keystore
☐ Search
Efficient way to search sqlite: make file table WITHOUT ROWID
☐ Open with
☐ Changelog
☐ Landing page

1
.env
View file

@ -1 +0,0 @@
OUT_DIR=""

60
.gitignore vendored
View file

@ -1,5 +1,61 @@
node_modules
src-tauri/target
.next
dist
*.tsbuildinfo
package-lock.json
.eslintcache
.turbo
.vercel
cli/turbo
cli/turbo-new
cli/turbo-new.exe
cli/turbo.exe
.DS_Store
cache
.env
vendor/
dist
data
node_modules
packages/turbo-server/data/
packages/turbo-server/uploads/
packages/*/node_modules
packages/*/data
apps/*/data
docs/public/*.st
docs/public/*.toml
.DS_Store
!cli/cmd/turbo
cli/npm/turbo-android-arm64/bin
cli/npm/turbo-darwin-64/bin
cli/npm/turbo-darwin-arm64/bin
cli/npm/turbo-freebsd-64/bin
cli/npm/turbo-freebsd-arm64/bin
cli/npm/turbo-linux-32/bin
cli/npm/turbo-linux-64/bin
cli/npm/turbo-linux-arm/bin
cli/npm/turbo-linux-arm64/bin
cli/npm/turbo-linux-s390x/bin
cli/npm/turbo-linux-mips64le/bin
cli/npm/turbo-linux-ppc64le/bin
cli/npm/turbo-netbsd-64/bin
cli/npm/turbo-openbsd-64/bin
cli/npm/turbo-sunos-64/bin
cli/npm/turbo-windows-32/turbo.exe
cli/npm/turbo-windows-64/turbo.exe
cli/npm/turbo-windows-arm64/turbo.exe
cli/scripts/turbo-*
!/npm/turbo-windows-32/bin
!/npm/turbo-windows-64/bin
!/npm/turbo-install/bin
!cli/internal/cache
demo
yalc.lock
store
!http_cache/cache
!http_cache/cache/cache.go
*.log
.npmrc
!create-turbo/templates/**/*
todos.md
examples/*/*.lock

View file

@ -1,11 +0,0 @@
{
"useTabs": false,
"printWidth": 100,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": false,
"semi": true,
"quoteProps": "consistent"
}

View file

@ -1,5 +1,6 @@
{
"cSpell.words": ["ipfs", "repr", "tailwindcss"],
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.diagnostics.enableExperimental": false,
}
"cSpell.words": ["ipfs", "repr", "tailwindcss"],
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.diagnostics.enableExperimental": false,
}

78
README.md Normal file
View file

@ -0,0 +1,78 @@
# Turborepo starter
This is an official Yarn v1 starter turborepo.
## What's inside?
This turborepo uses [Yarn](https://classic.yarnpkg.com/lang/en/) as a package manager. It includes the following packages/apps:
### Apps and Packages
- `docs`: a [Next.js](https://nextjs.org) app
- `web`: another [Next.js](https://nextjs.org) app
- `ui`: a stub React component library shared by both `web` and `docs` applications
- `config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
- `tsconfig`: `tsconfig.json`s used throughout the monorepo
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
### Utilities
This turborepo has some additional tools already setup for you:
- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Jest](https://jestjs.io) test runner for all things JavaScript
- [Prettier](https://prettier.io) for code formatting
## Setup
This repository is used in the `npx create-turbo` command, and selected when choosing which package manager you wish to use with your monorepo (Yarn).
### Build
To build all apps and packages, run the following command:
```
cd my-turborepo
yarn run build
```
### Develop
To develop all apps and packages, run the following command:
```
cd my-turborepo
yarn run dev
```
### Remote Caching
Turborepo can use a technique known as [Remote Caching (Beta)](https://turborepo.org/docs/features/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
By default, Turborepo will cache locally. To enable Remote Caching (Beta) you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
```
cd my-turborepo
npx turbo login
```
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your turborepo:
```
npx turbo link
```
## Useful Links
Learn more about the power of Turborepo:
- [Pipelines](https://turborepo.org/docs/features/pipelines)
- [Caching](https://turborepo.org/docs/features/caching)
- [Remote Caching (Beta)](https://turborepo.org/docs/features/remote-caching)
- [Scoped Tasks](https://turborepo.org/docs/features/scopes)
- [Configuration Options](https://turborepo.org/docs/reference/configuration)
- [CLI Usage](https://turborepo.org/docs/reference/command-line-reference)

62
apps/desktop/package.json Normal file
View file

@ -0,0 +1,62 @@
{
"name": "desktop",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"devDependencies": {
"@tauri-apps/cli": "^1.0.0-beta.6",
"@types/babel-core": "^6.25.7",
"@types/byte-size": "^8.1.0",
"@types/react": "^17.0.18",
"@types/react-dom": "^17.0.9",
"@types/react-router-dom": "^5.3.1",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/tailwindcss": "^2.2.1",
"concurrently": "^6.2.1",
"prettier": "^2.3.2",
"typescript": "^4.3.5"
},
"scripts": {
"vite": "vite",
"dev": "concurrently \"yarn tauri dev\" \"vite\"",
"tauri": "tauri",
"build": "vite build && tauri build"
},
"resolutions": {
"react-virtualized": "patch:react-virtualized@9.22.3#./path/to/react-virtualized-9.22.3.patch"
},
"dependencies": {
"@apollo/client": "^3.4.7",
"@headlessui/react": "^1.4.0",
"@heroicons/react": "^1.0.4",
"@tauri-apps/api": "^1.0.0-beta.5",
"@types/pretty-bytes": "^5.2.0",
"@types/react-table": "^7.7.6",
"@types/react-virtualized": "^9.21.14",
"@vitejs/plugin-react-refresh": "^1.3.6",
"autoprefixer": "^9",
"byte-size": "^8.1.0",
"clsx": "^1.1.1",
"immer": "^9.0.6",
"moment": "^2.29.1",
"phosphor-react": "^1.3.1",
"pretty-bytes": "^5.6.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-dropzone": "^11.3.4",
"react-error-boundary": "^3.1.3",
"react-hotkeys-hook": "^3.4.4",
"react-router-dom": "^5.2.0",
"react-spline": "^1.2.1",
"react-virtuoso": "^2.2.6",
"rooks": "^5.7.1",
"tailwindcss": "^3.0.7",
"vite": "^2.4.4",
"vite-plugin-filter-replace": "^0.1.9",
"vite-tsconfig-paths": "^3.3.13",
"zustand": "^3.5.13"
}
}

View file

@ -0,0 +1 @@
module.exports = require("ui/style/postcss.config");

View file

@ -177,9 +177,9 @@ dependencies = [
[[package]]
name = "async-process"
version = "1.2.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b21b63ab5a0db0369deb913540af2892750e42d949faacc7a61495ac418a1692"
checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6"
dependencies = [
"async-io",
"blocking",
@ -260,9 +260,9 @@ checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0"
[[package]]
name = "async-trait"
version = "0.1.51"
version = "0.1.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e"
checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3"
dependencies = [
"proc-macro2",
"quote",
@ -360,12 +360,12 @@ dependencies = [
[[package]]
name = "bae"
version = "0.1.6"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec107f431ee3d8a8e45e6dd117adab769556ef463959e77bf6a4888d5fd500cf"
checksum = "33b8de67cc41132507eeece2584804efcb15f85ba516e34c944b7667f480397a"
dependencies = [
"heck",
"proc-macro-error 0.4.12",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
@ -441,9 +441,9 @@ dependencies = [
[[package]]
name = "blocking"
version = "1.0.2"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9"
checksum = "046e47d4b2d391b1f6f8b407b1deb8dee56c1852ccd868becf2710f601b5f427"
dependencies = [
"async-channel",
"async-task",
@ -905,20 +905,6 @@ dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "crossbeam"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-epoch",
"crossbeam-queue",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.1"
@ -1142,12 +1128,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
[[package]]
name = "doc-comment"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "dotenv"
version = "0.15.0"
@ -1208,19 +1188,6 @@ dependencies = [
"syn",
]
[[package]]
name = "env_logger"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]]
name = "env_proxy"
version = "0.4.1"
@ -1667,7 +1634,7 @@ dependencies = [
"anyhow",
"heck",
"proc-macro-crate 1.1.0",
"proc-macro-error 1.0.4",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
@ -1714,9 +1681,9 @@ dependencies = [
[[package]]
name = "gloo-timers"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f"
checksum = "6f16c88aa13d2656ef20d1c042086b8767bbe2bdb62526894275a1b062161b2e"
dependencies = [
"futures-channel",
"futures-core",
@ -1797,7 +1764,7 @@ dependencies = [
"anyhow",
"heck",
"proc-macro-crate 1.1.0",
"proc-macro-error 1.0.4",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
@ -1888,12 +1855,6 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eee9694f83d9b7c09682fdb32213682939507884e5bcf227be9aff5d644b90dc"
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "ico"
version = "0.1.0"
@ -2376,19 +2337,6 @@ dependencies = [
"void",
]
[[package]]
name = "nix"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188"
dependencies = [
"bitflags 1.3.2",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset",
]
[[package]]
name = "nodrop"
version = "0.1.14"
@ -2625,7 +2573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e23813b1bcb2d41a838849a2bbae40ae5c03c85ecabf04ba97086f438484714"
dependencies = [
"Inflector",
"proc-macro-error 1.0.4",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
@ -2928,45 +2876,19 @@ dependencies = [
"toml",
]
[[package]]
name = "proc-macro-error"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7"
dependencies = [
"proc-macro-error-attr 0.4.12",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr 1.0.4",
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn-mid",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
@ -3325,9 +3247,9 @@ dependencies = [
[[package]]
name = "rusqlite"
version = "0.25.3"
version = "0.25.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57adcf67c8faaf96f3248c2a7b419a0dbc52ebe36ba83dd57fe83827c1ea4eb3"
checksum = "5c4b1eaf239b47034fb450ee9cdedd7d0226571689d8823030c4b6c2cb407152"
dependencies = [
"bitflags 1.3.2",
"fallible-iterator",
@ -3352,9 +3274,9 @@ dependencies = [
[[package]]
name = "rust_decimal"
version = "1.17.0"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "353775f96a1f400edcca737f843cb201af3645912e741e64456a257c770173e8"
checksum = "71b5a9625a7e6060b23db692facf49082cc78889a7e6ac94a735356ae49db4b0"
dependencies = [
"arrayvec 0.5.2",
"num-traits",
@ -3448,6 +3370,34 @@ dependencies = [
"untrusted",
]
[[package]]
name = "sdcorelib"
version = "0.1.0"
dependencies = [
"anyhow",
"base64",
"bytesize",
"cargo-edit",
"chrono",
"data-encoding",
"futures",
"int-enum",
"log",
"once_cell",
"rebind",
"refinery",
"ring 0.17.0-alpha.10",
"rusqlite",
"sea-orm",
"serde",
"serde_json",
"sha256",
"sqlx",
"strum 0.21.0",
"swift-rs",
"walkdir",
]
[[package]]
name = "sea-orm"
version = "0.3.2"
@ -3717,9 +3667,9 @@ dependencies = [
[[package]]
name = "signal-hook"
version = "0.3.10"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c98891d737e271a2954825ef19e46bd16bdb98e2746f2eec4f7a4ef7946efd1"
checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d"
dependencies = [
"libc",
"signal-hook-registry",
@ -3762,27 +3712,6 @@ dependencies = [
"static_assertions",
]
[[package]]
name = "snafu"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7"
dependencies = [
"doc-comment",
"snafu-derive",
]
[[package]]
name = "snafu-derive"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "socket2"
version = "0.4.2"
@ -3826,37 +3755,23 @@ version = "0.1.0"
dependencies = [
"anyhow",
"base64",
"bytesize",
"cargo-edit",
"chrono",
"cocoa",
"crossbeam",
"data-encoding",
"env_logger",
"futures",
"int-enum",
"libc",
"log",
"nix 0.23.0",
"objc",
"objc-foundation",
"once_cell",
"rebind",
"refinery",
"ring 0.17.0-alpha.10",
"rusqlite",
"sea-orm",
"sdcorelib",
"serde",
"serde_json",
"sha256",
"snafu",
"sqlx",
"strum 0.21.0",
"swift-rs 0.1.0",
"swift-rs 0.2.2",
"swift-rs",
"tauri",
"tauri-build",
"walkdir",
]
[[package]]
@ -4053,7 +3968,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
dependencies = [
"heck",
"proc-macro-error 1.0.4",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
@ -4140,17 +4055,6 @@ dependencies = [
"serde_json",
]
[[package]]
name = "swift-rs"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "429fcb93ca0ca9c60efba60a7f842254781c60d3e006f716c731e9901094c87e"
dependencies = [
"base64",
"serde",
"serde_json",
]
[[package]]
name = "syn"
version = "1.0.81"
@ -4162,17 +4066,6 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "syn-mid"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baa8e7560a164edb1621a55d18a0c59abf49d360f47aa7b821061dd7eea7fac9"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "system-deps"
version = "1.3.2"
@ -4989,9 +4882,9 @@ dependencies = [
[[package]]
name = "whoami"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c33ac5ee236a4efbf2c98967e12c6cc0c51d93a744159a52957ba206ae6ef5f7"
checksum = "524b58fa5a20a2fb3014dd6358b70e6579692a56ef6fce928834e488f42f65e8"
dependencies = [
"wasm-bindgen",
"web-sys",
@ -5187,7 +5080,7 @@ dependencies = [
"fastrand",
"futures",
"nb-connect",
"nix 0.17.0",
"nix",
"once_cell",
"polling",
"scoped-tls",

View file

@ -0,0 +1,40 @@
[package]
name = "spacedrive"
version = "0.1.0"
description = "The next gen private virtual filesystem."
authors = ["NerdHouse, Inc.", "Jamie Pine"]
license = ""
repository = "https://github.com/jamiepine/spacedrive"
default-run = "spacedrive"
edition = "2018"
build = "src/build.rs"
[build-dependencies]
tauri-build = { version = "1.0.0-beta.3" }
swift-rs = "0.2.3"
[dependencies]
# Project dependencies
tauri = { version = "1.0.0-beta.8", features = ["api-all"] }
swift-rs = "0.2.3"
sdcorelib = { path = "../../../packages/core" }
# Universal Dependencies
anyhow = "1.0.44"
log = "0.4.14"
base64 = "0.13.0"
serde = { version = "1.0", features = ["derive"] }
chrono = { version = "0.4.0", features = ["serde"] }
strum = { version = "0.21.0", features = ["derive"] }
serde_json = "1.0"
futures = "0.3"
rebind = "0.2.1"
data-encoding = "2.3.2"
ring = "0.17.0-alpha.10"
cargo-edit = "0.8.0"
sha256 = "1.0.2"
once_cell = "1.8.0"
int-enum = "0.4.0"
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

View file

@ -2,7 +2,7 @@ use swift_rs::build_utils::{link_swift, link_swift_package};
fn main() {
link_swift();
link_swift_package("swift-lib", "./swift-lib/");
link_swift_package("swift-lib", "../../../packages/native-macos/");
tauri_build::build();
}

View file

@ -0,0 +1,75 @@
use anyhow::Result;
use sdcorelib::db::connection::db_instance;
use sdcorelib::file::{indexer, retrieve, retrieve::Directory};
use sdcorelib::native;
use sdcorelib::{AppConfig, CONFIG};
use serde::Serialize;
use swift_rs::types::SRObjectArray;
#[derive(Serialize)]
pub enum GlobalEventKind {
FileTypeThumb,
}
#[derive(Serialize)]
pub struct GlobalEvent<T> {
pub kind: GlobalEventKind,
pub data: T,
}
#[derive(Serialize)]
pub struct GenFileTypeIconsResponse {
pub file_id: u32,
pub icon_created: bool,
}
pub fn reply<T: Serialize>(window: &tauri::Window, kind: GlobalEventKind, data: T) {
let _message = window
.emit("message", GlobalEvent { kind, data })
.map_err(|e| println!("{}", e));
}
#[tauri::command(async)]
pub async fn scan_dir(window: tauri::Window, path: String) -> Result<(), String> {
db_instance().await?;
// reply(&window, GlobalEventKind::JEFF, "jeff");
let files = indexer::scan(&path).await.map_err(|e| e.to_string())?;
println!("file: {:?}", files);
Ok(())
}
#[tauri::command(async)]
pub async fn get_files(path: String) -> Result<Directory, String> {
Ok(retrieve::get_dir_with_contents(&path).await?)
}
#[tauri::command(async)]
pub async fn get_config() -> Result<&'static AppConfig, String> {
Ok(CONFIG.get().unwrap())
}
#[tauri::command]
pub fn get_mounts() -> Result<SRObjectArray<native::methods::Mount>, String> {
Ok(native::methods::get_mounts())
}
#[tauri::command(async)]
pub async fn test_scan() -> Result<(), String> {
Ok(
indexer::test_scan("/Users/jamie")
.await
.map_err(|e| e.to_string())?,
)
}
// #[tauri::command(async)]
// pub async fn get_file_thumb(path: &str) -> Result<String, String> {
// // let thumbnail_b64 = get_file_thumbnail_base64(path).to_string();
// Ok(thumbnail_b64)
// }
// #[tauri::command(async)]
// pub async fn get_thumbs_for_directory(window: tauri::Window, path: &str) -> Result<(), String> {
// let config = config::get_config();
// }

View file

@ -0,0 +1,25 @@
mod commands;
mod menu;
use sdcorelib;
use tauri::api::path;
fn main() {
tauri::Builder::default()
.setup(|_app| {
let data_dir = path::data_dir().unwrap_or(std::path::PathBuf::from("./"));
sdcorelib::configure(data_dir);
Ok(())
})
.on_menu_event(|event| menu::handle_menu_event(event))
.invoke_handler(tauri::generate_handler![
commands::scan_dir,
commands::get_files,
commands::get_config,
commands::get_mounts,
commands::test_scan,
])
.menu(menu::get_menu())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

View file

@ -13,12 +13,11 @@
"bundle": {
"active": true,
"targets": "all",
"identifier": "co.spacedrive.client",
"identifier": "co.spacedrive.desktop",
"icon": ["icons/icon.icns"],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
"copyright": "NerdHouse, Inc",
"shortDescription": "",
"longDescription": "",
"deb": {

View file

@ -13,7 +13,7 @@ import { Modal } from './components/layout/Modal';
import { useKey, useKeyBindings } from 'rooks';
// import { useHotkeys } from 'react-hotkeys-hook';
import { ErrorBoundary, FallbackProps } from 'react-error-boundary';
import { Button } from './components/primative';
import { Button } from './components/primitive';
import { useLocationStore, Location } from './store/locations';
import { OverviewScreen } from './screens/Overview';
import { SpacesScreen } from './screens/Spaces';
@ -23,9 +23,9 @@ function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
<div
data-tauri-drag-region
role="alert"
className="flex border border-gray-200 dark:border-gray-650 h-screen justify-center items-center flex-col rounded-lg w-screen bg-gray-50 dark:bg-gray-950 dark:text-white p-4"
className="flex flex-col items-center justify-center w-screen h-screen p-4 border border-gray-200 rounded-lg dark:border-gray-650 bg-gray-50 dark:bg-gray-950 dark:text-white"
>
<p className="text-sm m-3 text-gray-400 font-bold">APP CRASHED</p>
<p className="m-3 text-sm font-bold text-gray-400">APP CRASHED</p>
<h1 className="text-2xl font-bold">We're past the event horizon...</h1>
<pre className="m-2">Error: {error.message}</pre>
<div className="flex flex-row space-x-2">
@ -61,12 +61,12 @@ export default function App() {
}}
>
<Router>
<div className="flex flex-col select-none h-screen rounded-xl border border-gray-200 dark:border-gray-550 bg-white text-gray-900 dark:text-white dark:bg-gray-800 overflow-hidden">
<div className="flex flex-col h-screen overflow-hidden text-gray-900 bg-white border border-gray-200 select-none rounded-xl dark:border-gray-550 dark:text-white dark:bg-gray-800">
<DebugGlobalStore />
<TopBar />
<div className="flex flex-row min-h-full">
<Sidebar />
<div className="relative w-full flex bg-gray-50 dark:bg-gray-800">
<div className="relative flex w-full bg-white dark:bg-gray-800">
<Switch>
<Route exact path="/">
<Redirect to="/explorer" />

View file

@ -5,7 +5,7 @@ import { IFile } from '../../types';
import { useAppState } from '../../store/global';
import { convertFileSrc } from '@tauri-apps/api/tauri';
import moment from 'moment';
import { Button } from '../primative';
import { Button } from '../primitive';
import { ShareIcon } from '@heroicons/react/solid';
import { Heart, Link } from 'phosphor-react';

View file

@ -30,17 +30,9 @@ import {
import React, { useEffect } from 'react';
import { NavLink, NavLinkProps } from 'react-router-dom';
import { useLocations } from '../../store/locations';
import { Button } from '../primative';
import { Dropdown } from '../primative/Dropdown';
import { DefaultProps } from '../primative/types';
// const tabs: Record<string, { name: string; icon: any; uri: string }[]> = {
// '': [
// { name: 'Spaces', icon: CirclesFour, uri: '/spaces' },
// { name: 'Explorer', icon: Folder, uri: '/explorer' },
// { name: 'Media', icon: MonitorPlay, uri: '/settings' }
// ],
// };
import { Button } from '../primitive';
import { Dropdown } from '../primitive/Dropdown';
import { DefaultProps } from '../primitive/types';
interface SidebarProps extends DefaultProps {}
@ -48,7 +40,7 @@ const SidebarLink = (props: NavLinkProps) => (
<NavLink
{...props}
className={clsx(
'max-w mb-[2px] text-gray-550 dark:text-gray-150 rounded-md px-2 py-1 flex flex-row flex-grow items-center hover:bg-gray-100 dark:hover:bg-gray-600 text-sm',
'max-w mb-[2px] text-gray-550 dark:text-gray-150 rounded px-2 py-1 flex flex-row flex-grow items-center hover:bg-gray-100 dark:hover:bg-gray-600 text-sm',
props.className
)}
activeClassName="!bg-primary !text-white hover:bg-primary dark:hover:bg-primary"
@ -62,7 +54,7 @@ const Icon = ({ component: Icon, ...props }: any) => (
);
const Heading: React.FC<{}> = ({ children }) => (
<div className="text-xs font-semibold text-gray-300 ml-1 mb-1 mt-5">{children}</div>
<div className="mt-5 mb-1 ml-1 text-xs font-semibold text-gray-300">{children}</div>
);
export const Sidebar: React.FC<SidebarProps> = (props) => {
@ -73,7 +65,7 @@ export const Sidebar: React.FC<SidebarProps> = (props) => {
buttonProps={{
justifyLeft: true,
className:
'mb-1 !bg-gray-50 border-gray-150 hover:!bg-gray-1000 flex-shrink-0 w-[175px] dark:!bg-gray-600 dark:hover:!bg-gray-550 dark:!border-gray-550 dark:hover:!border-gray-500',
'mb-1 rounded !bg-gray-50 border-gray-150 hover:!bg-gray-1000 flex-shrink-0 w-[175px] dark:!bg-gray-600 dark:hover:!bg-gray-550 dark:!border-gray-550 dark:hover:!border-gray-500',
variant: 'gray'
}}
// buttonIcon={<Book weight="bold" className="w-4 h-4 mt-0.5 mr-1" />}

View file

@ -26,7 +26,7 @@ export const Modal = (props: ModalProps) => {
leaveFrom="scale-0"
leaveTo="-scale-2"
>
<div className="w-full h-full bg-white dark:bg-gray-850 rounded-lg shadow-xl">
<div className="w-full h-full bg-white rounded-lg shadow-xl dark:bg-gray-850">
<h1 className="m-10">hi</h1>
</div>
</Transition>

View file

@ -14,9 +14,9 @@ import {
import React from 'react';
import { useExplorerStore } from '../../store/explorer';
import { TrafficLights } from '../os/TrafficLights';
import { Button, ButtonProps, Input } from '../primative';
import { Shortcut } from '../primative/Shortcut';
import { DefaultProps } from '../primative/types';
import { Button, ButtonProps, Input } from '../primitive';
import { Shortcut } from '../primitive/Shortcut';
import { DefaultProps } from '../primitive/types';
import { appWindow } from '@tauri-apps/api/window';
import { HeartIcon } from '@heroicons/react/solid';
@ -55,9 +55,9 @@ export const TopBar: React.FC<TopBarProps> = (props) => {
<>
<div
data-tauri-drag-region
className="flex h-[2.95rem] -mt-0.5 max-w z-50 rounded-t-2xl flex-shrink-0 items-center border-b bg-gray-50 dark:bg-gray-650 border-gray-100 dark:border-gray-600 !bg-opacity-60 backdrop-blur shadow-sm"
className="flex h-[2.95rem] -mt-0.5 max-w z-50 rounded-t-2xl flex-shrink-0 items-center border-b bg-gray-50 dark:bg-gray-650 border-gray-100 dark:border-gray-600 !bg-opacity-60 backdrop-blur "
>
<div className="mr-32 ml-1">
<div className="ml-1 mr-32">
<TrafficLights
onClose={appWindow.close}
onFullscreen={appWindow.maximize}

View file

@ -1,6 +1,6 @@
import clsx from 'clsx';
import React from 'react';
import { DefaultProps } from '../primative/types';
import { DefaultProps } from '../primitive/types';
export interface TrafficLightsProps extends DefaultProps {
onClose?: () => void;

View file

@ -28,7 +28,7 @@ export const ExplorerScreen: React.FC<{}> = () => {
if (currentDir === null) return <></>;
return (
<div className="relative w-full flex flex-row bg-white dark:bg-gray-900">
<div className="relative flex flex-row w-full bg-white dark:bg-gray-900">
<FileList />
<Inspector />
</div>

View file

@ -8,11 +8,11 @@ interface StatItemProps {
const StatItem: React.FC<StatItemProps> = (props) => {
return (
<div className="flex flex-col p-4 rounded-md dark:bg-gray-800 mt-2">
<span className="text-gray-400 text-sm">{props.name}</span>
<span className="font-bold text-2xl">
<div className="flex flex-col p-4 mt-2 rounded-md bg-gray-50 dark:bg-gray-800">
<span className="text-sm text-gray-400">{props.name}</span>
<span className="text-2xl font-bold">
{props.value}
<span className="text-sm text-gray-400 ml-1">{props.unit}</span>
<span className="ml-1 text-sm text-gray-400">{props.unit}</span>
</span>
</div>
);
@ -20,9 +20,9 @@ const StatItem: React.FC<StatItemProps> = (props) => {
export const OverviewScreen: React.FC<{}> = (props) => {
return (
<div className="flex flex-col w-full h-full bg-white dark:bg-gray-900 p-5">
<h1 className=" font-bold text-xl">Jamie's Library</h1>
<div className="flex flex-wrap space-x-2 mt-3">
<div className="flex flex-col w-full h-full p-5 bg-white dark:bg-gray-900">
<h1 className="text-xl font-bold ">Jamie's Library</h1>
<div className="flex flex-wrap mt-3 space-x-2">
<StatItem name="Total capacity" value="26.5" unit="TB" />
<StatItem name="Index size" value="103" unit="MB" />
<StatItem name="Preview media" value="23.5" unit="GB" />

View file

@ -2,14 +2,15 @@ import { DuplicateIcon, PencilAltIcon, TrashIcon } from '@heroicons/react/solid'
import { invoke } from '@tauri-apps/api';
import React, { useRef } from 'react';
// import { dummyIFile, FileList } from '../components/file/FileList';
import { Input, Toggle } from '../components/primative';
import { Button } from '../components/primative/Button';
import { Checkbox } from '../components/primative/Checkbox';
import { Dropdown } from '../components/primative/Dropdown';
import { InputContainer } from '../components/primative/InputContainer';
import { Shortcut } from '../components/primative/Shortcut';
import { Input, Toggle } from '../components/primitive';
import { Button } from '../components/primitive/Button';
import { Checkbox } from '../components/primitive/Checkbox';
import { Dropdown } from '../components/primitive/Dropdown';
import { InputContainer } from '../components/primitive/InputContainer';
import { Shortcut } from '../components/primitive/Shortcut';
import { useInputState } from '../hooks/useInputState';
import { useExplorerStore } from '../store/explorer';
import { useAppState } from '../store/global';
//@ts-ignore
// import { Spline } from 'react-spline';
// import WINDOWS_SCENE from '../assets/spline/scene.json';
@ -17,6 +18,8 @@ import { useExplorerStore } from '../store/explorer';
export const SettingsScreen: React.FC<{}> = () => {
const fileUploader = useRef<HTMLInputElement | null>(null);
const config = useAppState()
const [tempWatchDir, setTempWatchDir] = useExplorerStore((state) => [
state.tempWatchDir,
state.setTempWatchDir
@ -32,7 +35,7 @@ export const SettingsScreen: React.FC<{}> = () => {
width="100%"
height="100%"
></iframe> */}
<div className="flex space-x-2 mt-4">
<div className="flex mt-4 space-x-2">
<InputContainer
title="Quick scan directory"
description="The directory for which this application will perform a detailed scan of the contents and sub directories"
@ -44,7 +47,7 @@ export const SettingsScreen: React.FC<{}> = () => {
/>
</InputContainer>
</div>
<div className="space-x-2 flex flex-row mt-2">
<div className="flex flex-row mt-2 space-x-2">
<Button
size="sm"
variant="primary"
@ -67,10 +70,10 @@ export const SettingsScreen: React.FC<{}> = () => {
<Button size="sm">Test</Button>
</div>
<div className="space-x-2 flex flex-row mt-4">
<div className="flex flex-row mt-4 space-x-2">
<Toggle initialState={false} />
</div>
<div className="space-x-2 flex flex-row mt-4 mb-5 ml-1">
<div className="flex flex-row mt-4 mb-5 ml-1 space-x-2">
<Checkbox />
<Checkbox />
<Checkbox />
@ -90,6 +93,8 @@ export const SettingsScreen: React.FC<{}> = () => {
<Shortcut chars="⌘" />
<Shortcut chars="S" />
</div>
{JSON.stringify({config})}
</div>
</div>
);

View file

@ -0,0 +1 @@
module.exports = require("ui/style/tailwind.config");

View file

@ -0,0 +1,5 @@
{
"extends": "config/tsconfig/tauri.json",
"include": ["src"],
"exclude": ["node_modules"]
}

1
apps/docs/.eslintrc.js Normal file
View file

@ -0,0 +1 @@
module.exports = require("config/eslint-preset");

30
apps/docs/README.md Normal file
View file

@ -0,0 +1,30 @@
## Getting Started
First, run the development server:
```bash
yarn dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

6
apps/docs/next-env.d.ts vendored Normal file
View file

@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

5
apps/docs/next.config.js Normal file
View file

@ -0,0 +1,5 @@
const withTM = require("next-transpile-modules")(["ui"]);
module.exports = withTM({
reactStrictMode: true,
});

25
apps/docs/package.json Normal file
View file

@ -0,0 +1,25 @@
{
"name": "docs",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev --port 3001",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.0.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"ui": "*"
},
"devDependencies": {
"config": "*",
"eslint": "7.32.0",
"next-transpile-modules": "9.0.0",
"tsconfig": "*",
"@types/react": "17.0.37",
"typescript": "^4.5.3"
}
}

10
apps/docs/pages/index.tsx Normal file
View file

@ -0,0 +1,10 @@
import { Button } from "ui";
export default function Docs() {
return (
<div>
<h1>Docs</h1>
<Button />
</div>
);
}

5
apps/docs/tsconfig.json Normal file
View file

@ -0,0 +1,5 @@
{
"extends": "config/tsconfig/nextjs.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

7
apps/mobile/package.json Normal file
View file

@ -0,0 +1,7 @@
{
"name": "mobile",
"version": "0.0.0",
"main": "index.js",
"license": "MIT"
}

0
apps/server/README.md Normal file
View file

7
apps/server/package.json Normal file
View file

@ -0,0 +1,7 @@
{
"name": "server",
"version": "0.0.0",
"main": "index.js",
"license": "MIT"
}

0
apps/server/server.ts Normal file
View file

1
apps/web/.eslintrc.js Normal file
View file

@ -0,0 +1 @@
module.exports = require("config/eslint-preset");

30
apps/web/README.md Normal file
View file

@ -0,0 +1,30 @@
## Getting Started
First, run the development server:
```bash
yarn dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

6
apps/web/next-env.d.ts vendored Normal file
View file

@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

5
apps/web/next.config.js Normal file
View file

@ -0,0 +1,5 @@
const withTM = require("next-transpile-modules")(["ui"]);
module.exports = withTM({
reactStrictMode: true,
});

25
apps/web/package.json Normal file
View file

@ -0,0 +1,25 @@
{
"name": "web",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.0.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"ui": "*"
},
"devDependencies": {
"config": "*",
"eslint": "7.32.0",
"next-transpile-modules": "9.0.0",
"tsconfig": "*",
"@types/react": "17.0.37",
"typescript": "^4.5.3"
}
}

10
apps/web/pages/index.tsx Normal file
View file

@ -0,0 +1,10 @@
import { Button } from "ui";
export default function Web() {
return (
<div>
<h1>Web</h1>
<Button />
</div>
);
}

5
apps/web/tsconfig.json Normal file
View file

@ -0,0 +1,5 @@
{
"extends": "config/tsconfig/nextjs.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

View file

@ -1,61 +1,65 @@
{
"name": "drive",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"name": "spacedrive",
"version": "0.0.0",
"private": true,
"devDependencies": {
"@tauri-apps/cli": "^1.0.0-beta.6",
"@types/babel-core": "^6.25.7",
"@types/byte-size": "^8.1.0",
"@types/react": "^17.0.18",
"@types/react-dom": "^17.0.9",
"@types/react-router-dom": "^5.3.1",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/tailwindcss": "^2.2.1",
"concurrently": "^6.2.1",
"prettier": "^2.3.2",
"typescript": "^4.3.5"
"workspaces": {
"packages": [
"apps/*",
"packages/*"
],
"nohoist": [
"**/react-native",
"**/react-native/**",
"**/@react-native-*",
"**/@react-native-*/**",
"**/react-native-*",
"**/react-native-*/**",
"**/expo",
"**/expo/**",
"**/@expo",
"**/@expo/**",
"**/expo-*",
"**/expo-*/**",
"**/metro-*",
"**/metro-*/**"
]
},
"scripts": {
"vite": "vite",
"dev": "concurrently \"yarn tauri dev\" \"vite\"",
"tauri": "tauri",
"build": "vite build && tauri build"
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"desktop": "yarn workspace desktop",
"mobile": "yarn workspace mobile",
"web": "yarn workspace web",
"server": "yarn workspace server"
},
"resolutions": {
"react-virtualized": "patch:react-virtualized@9.22.3#./path/to/react-virtualized-9.22.3.patch"
"devDependencies": {
"prettier": "^2.5.1",
"turbo": "latest"
},
"dependencies": {
"@apollo/client": "^3.4.7",
"@headlessui/react": "^1.4.0",
"@heroicons/react": "^1.0.4",
"@tauri-apps/api": "^1.0.0-beta.5",
"@types/pretty-bytes": "^5.2.0",
"@types/react-table": "^7.7.6",
"@types/react-virtualized": "^9.21.14",
"@vitejs/plugin-react-refresh": "^1.3.6",
"autoprefixer": "^9",
"byte-size": "^8.1.0",
"clsx": "^1.1.1",
"immer": "^9.0.6",
"moment": "^2.29.1",
"phosphor-react": "^1.3.1",
"pretty-bytes": "^5.6.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-dropzone": "^11.3.4",
"react-error-boundary": "^3.1.3",
"react-hotkeys-hook": "^3.4.4",
"react-router-dom": "^5.2.0",
"react-spline": "^1.2.1",
"react-virtuoso": "^2.2.6",
"rooks": "^5.7.1",
"tailwindcss": "^2.2.16",
"vite": "^2.4.4",
"vite-plugin-filter-replace": "^0.1.9",
"vite-tsconfig-paths": "^3.3.13",
"zustand": "^3.5.13"
"turbo": {
"pipeline": {
"build": {
"dependsOn": [
"^build"
],
"outputs": [
"dist/**",
".next/**"
]
},
"lint": {
"outputs": []
},
"dev": {
"cache": false
}
}
},
"engines": {
"npm": ">=7.0.0",
"node": ">=14.0.0"
}
}
}

View file

@ -0,0 +1,11 @@
module.exports = {
extends: ["next", "prettier"],
settings: {
next: {
rootDir: ["apps/*/", "packages/*/"],
},
},
rules: {
"no-html-link-for-pages": "off",
},
};

View file

@ -0,0 +1,16 @@
{
"name": "config",
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"files": [
"eslint-preset.js"
],
"devDependencies": {
"typescript": "^4.5.3"
},
"dependencies": {
"eslint-config-next": "^12.0.3",
"eslint-config-prettier": "^8.3.0"
}
}

View file

@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true
},
"exclude": ["node_modules"]
}

View file

@ -0,0 +1,22 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["src", "next-env.d.ts"],
"exclude": ["node_modules"]
}

View file

@ -0,0 +1,11 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "React Library",
"extends": "./base.json",
"compilerOptions": {
"lib": ["ES2015"],
"module": "ESNext",
"target": "ES6",
"jsx": "react-jsx"
}
}

View file

@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"outDir": "dist"
},
"include": ["src"]
}

1
packages/core/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

2516
packages/core/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,52 +1,42 @@
[package]
name = "spacedrive"
name = "sdcorelib"
version = "0.1.0"
description = "The next gen private virtual filesystem."
authors = ["you"]
authors = ["NerdHouse, Inc.", "Jamie Pine"]
license = ""
repository = ""
default-run = "spacedrive"
repository = "https://github.com/jamiepine/spacedrive"
edition = "2018"
build = "src/build.rs"
include = ["lib/**/*.rs"]
[build-dependencies]
tauri-build = { version = "1.0.0-beta.3" }
swift-rs = "0.2.3"
[lib]
name = "sdcorelib"
# crate-type = ["cdylib"]
# bench = false
path = "lib/main.rs"
[dependencies]
tauri = { version = "1.0.0-beta.8", features = ["api-all"] }
swift-rs = "0.2.3"
# Universal Dependencies
anyhow = "1.0.44"
log = "0.4.14"
base64 = "0.13.0"
serde = { version = "1.0", features = ["derive"] }
chrono = { version = "0.4.0", features = ["serde"] }
strum = { version = "0.21.0", features = ["derive"] }
serde_json = "1.0"
futures = "0.3"
rebind = "0.2.1"
data-encoding = "2.3.2"
ring = "0.17.0-alpha.10"
chrono = { version = "0.4.0", features = ["serde"] }
crossbeam = "0.8.1"
cargo-edit = "0.8.0"
sha256 = "1.0.2"
once_cell = "1.8.0"
int-enum = "0.4.0"
# Project dependencies
rusqlite = "0.25.3"
refinery = { version = "0.6.0", features = ["rusqlite"] }
sqlx = { version = "0.5.7", features = ["sqlite"] }
sea-orm = { version = "^0.3.1", features = [ "sqlx-sqlite", "runtime-async-std-rustls", "macros", "debug-print" ], default-features = false }
env_logger = "0.9.0"
# libusb-sys = "0.2.3"
anyhow = "1.0.44"
once_cell = "1.8.0"
walkdir = "^2.3.2"
strum = { version = "0.21.0", features = ["derive"] }
snafu = "0.6.10"
bytesize = "1.1.0"
libc = "0.2.103"
nix = "0.23.0"
log = "0.4.14"
objc = "0.2.7"
cocoa = "0.24.0"
objc-foundation = "0.1.1"
swift-rs = "0.2.3"
base64 = "0.13.0"
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

View file

@ -0,0 +1,54 @@
use crate::CONFIG;
use anyhow::Result;
use once_cell::sync::OnceCell;
use rusqlite::Connection;
use sea_orm::{Database, DatabaseConnection, DbErr};
// use sqlx::sqlite::{SqliteConnectOptions, SqliteJournalMode};
// use sqlx::{ConnectOptions, Connection};
// use std::str::FromStr;
pub async fn get_connection() -> Result<DatabaseConnection, DbErr> {
let config = CONFIG.get().unwrap();
let db_url = format!("{}{}", "sqlite://", config.primary_db.to_str().unwrap());
let db = Database::connect(&db_url).await?;
Ok(db)
}
pub static DB_INSTANCE: OnceCell<DatabaseConnection> = OnceCell::new();
pub async fn db_instance() -> Result<&'static DatabaseConnection, String> {
if DB_INSTANCE.get().is_none() {
let db = get_connection().await.map_err(|e| e.to_string())?;
DB_INSTANCE.set(db).unwrap_or_default();
Ok(DB_INSTANCE.get().unwrap())
} else {
Ok(DB_INSTANCE.get().unwrap())
}
}
pub async fn create_primary_db() -> Result<(), sqlx::Error> {
let config = CONFIG.get().unwrap();
let db_url = config.primary_db.to_str().unwrap();
// establish connection, this is only used to create the db if missing
// replace in future
let mut connection = Connection::open(db_url).unwrap();
println!("Primary database initialized: {}", &db_url);
// migrate db
mod embedded_primary {
use refinery::embed_migrations;
embed_migrations!("lib/db/migrations/primary");
}
embedded_primary::migrations::runner()
.run(&mut connection)
.unwrap();
// close and exit cause we don't need this connection anymore
connection.close().unwrap();
Ok(())
}

Some files were not shown because too many files have changed in this diff Show more