diff --git a/.gitignore b/.gitignore index e07cf486..a1abdabc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,14 @@ # Prisma crates/prisma/src/prisma.rs +dev.db +dev.db-journal + +# Vendor +dist +.eslintcache +.env* +vendor/ # Created by https://www.toptal.com/developers/gitignore/api/node,rust,yarn,linux,macos,windows,rust-analyzer,visualstudiocode,git # Edit at https://www.toptal.com/developers/gitignore?templates=node,rust,yarn,linux,macos,windows,rust-analyzer,visualstudiocode,git diff --git a/.npmrc b/.npmrc index 4001a875..db68d46a 100644 --- a/.npmrc +++ b/.npmrc @@ -2,3 +2,6 @@ engine-strict=true ; tempfix for pnpm#5909: https://github.com/pnpm/pnpm/issues/5909#issuecomment-1397758156 prefer-symlinked-executables=false +auto-install-peers=true +max-old-space-size=4096 +enable-pre-post-scripts=true diff --git a/Cargo.toml b/Cargo.toml index c04f1303..95da2aca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,17 +6,25 @@ members = [ ] [workspace.package] -license = "GPL-3.0-only" +license = "AGPL-3.0-only" edition = "2021" repository = "https://github.com/Polyfrost/Nexus" +documentation = "https://docs.polyfrost.org/nexus" +readme = "README.md" +homepage = "https://polyfrost.org" +authors = [ "Polyfrost" ] [workspace.dependencies] prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false, features = [ "sqlite" ] } prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false, features = [ "sqlite" ] } -uuid = { version = "1.7.0", features = [ "serde" ] } +uuid = { version = "1.8", features = [ "serde" ] } serde = { version = "1", features = [ "derive" ] } serde_json = { version = "1" } +flate2 = { version = "1" } +tar = { version = "0.4" } +zip = { version = "0.6" } tokio = { version = "1", features = [ "full" ] } +async-trait = { version = "0.1" } [profile.dev] # Make compilation faster on macOS diff --git a/crates/prisma-cli/Cargo.toml b/crates/prisma-cli/Cargo.toml index 2c529713..3fa52bbe 100644 --- a/crates/prisma-cli/Cargo.toml +++ b/crates/prisma-cli/Cargo.toml @@ -2,8 +2,12 @@ name = "prisma-cli" version = "0.1.0" license = { workspace = true } -repository = { workspace = true } edition = { workspace = true } +repository = { workspace = true } +documentation = { workspace = true } +readme = { workspace = true } +homepage = { workspace = true } +authors = { workspace = true } [dependencies] prisma-client-rust-cli = { workspace = true } diff --git a/crates/prisma/Cargo.toml b/crates/prisma/Cargo.toml index e4b3bdd3..65719fe9 100644 --- a/crates/prisma/Cargo.toml +++ b/crates/prisma/Cargo.toml @@ -1,7 +1,13 @@ [package] name = "poly-prisma" version = "0.1.0" -edition = "2021" +license = { workspace = true } +edition = { workspace = true } +repository = { workspace = true } +documentation = { workspace = true } +readme = { workspace = true } +homepage = { workspace = true } +authors = { workspace = true } [dependencies] prisma-client-rust = { workspace = true } diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml new file mode 100644 index 00000000..e5d6b77b --- /dev/null +++ b/crates/utils/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "poly-utils" +version = "0.1.0" +license = { workspace = true } +edition = { workspace = true } +repository = { workspace = true } +documentation = { workspace = true } +readme = { workspace = true } +homepage = { workspace = true } +authors = { workspace = true } + +[dependencies] diff --git a/crates/utils/src/lib.rs b/crates/utils/src/lib.rs new file mode 100644 index 00000000..e69de29b diff --git a/eslint.config.js b/eslint.config.js index 8d17009f..fa12bc5a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -5,4 +5,17 @@ import petal from '@flowr/eslint-config'; export default petal({ typescript: true, solid: true, -}); + gitignore: true, + ignores: [ + '**/target', + '**/dist', + '**/types', + '**/cache', + '**/dist', + '**/.temp', + '**/*.svg', + '*.rs', + 'pnpm-lock.yaml', + './src-tauri/prisma/migrations/migration_lock.toml', + ], +}, { rules: { 'petal/consistent-list-newline': 'off' } }); diff --git a/package.json b/package.json index f24ff0b2..f0ffb38b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "license": "MIT", "scripts": { "start": "vite", - "dev": "vite", + "dev": "pnpm tauri dev", "build": "vite build", "serve": "vite preview", "tauri": "tauri", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 788ae2e1..2f47f6b2 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -2,25 +2,31 @@ name = "polyfrost-launcher" version = "0.0.0" description = "A Tauri App" -authors = [ "Polyfrost" ] -edition = "2021" +license = { workspace = true } +edition = { workspace = true } +repository = { workspace = true } +documentation = { workspace = true } +readme = { workspace = true } +homepage = { workspace = true } +authors = { workspace = true } [build-dependencies] tauri-build = { version = "2.0.0-beta", features = [] } [dependencies] poly-prisma = { path = "../crates/prisma" } +poly-utils = { path = "../crates/utils" } tauri = { version = "2.0.0-beta", features = [] } tauri-plugin-shell = "2.0.0-beta.2" tauri-plugin-http = "2.0.0-beta" tokio = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } -flate2 = "1.0.28" -tar = "0.4.40" -zip = "0.6.6" +flate2 = { workspace = true } +tar = { workspace = true } +zip = { workspace = true } uuid = { workspace = true } -async-trait = "0.1.78" +async-trait = { workspace = true } prisma-client-rust = { workspace = true } [features] diff --git a/src-tauri/prisma/migrations/20240320193141_init/migration.sql b/src-tauri/prisma/migrations/20240320193141_init/migration.sql new file mode 100644 index 00000000..42b19115 --- /dev/null +++ b/src-tauri/prisma/migrations/20240320193141_init/migration.sql @@ -0,0 +1,32 @@ +-- CreateTable +CREATE TABLE "instance" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "name" TEXT, + "path" TEXT, + "hidden" BOOLEAN, + "time_played" DATETIME NOT NULL, + "last_played" DATETIME NOT NULL, + "date_created" DATETIME NOT NULL +); + +-- CreateTable +CREATE TABLE "java_instance" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "name" TEXT, + "path" TEXT, + "version" TEXT, + "arch" TEXT, + "instance_id" INTEGER +); + +-- CreateTable +CREATE TABLE "location" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "name" TEXT, + "path" TEXT, + "enabled" BOOLEAN NOT NULL DEFAULT true, + "hidden" BOOLEAN, + "date_added" DATETIME, + "instance_id" INTEGER, + CONSTRAINT "location_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instance" ("id") ON DELETE SET NULL ON UPDATE CASCADE +); diff --git a/src-tauri/prisma/migrations/migration_lock.toml b/src-tauri/prisma/migrations/migration_lock.toml new file mode 100644 index 00000000..e5e5c470 --- /dev/null +++ b/src-tauri/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "sqlite" \ No newline at end of file diff --git a/src-tauri/prisma/schema.prisma b/src-tauri/prisma/schema.prisma index 5f44851d..f771d1a8 100644 --- a/src-tauri/prisma/schema.prisma +++ b/src-tauri/prisma/schema.prisma @@ -1,60 +1,60 @@ datasource db { - provider = "sqlite" - url = "file:dev.db" + provider = "sqlite" + url = "file:dev.db" } generator client { - provider = "cargo prisma" - output = "../../crates/prisma/src/prisma.rs" + provider = "cargo prisma" + output = "../../crates/prisma/src/prisma.rs" } // todo: replace all `path` fields with a model with a checksum n shit // represents a single minecraft instance model Instance { - id Int @id @default(autoincrement()) - name String? - path String? - hidden Boolean? + id Int @id @default(autoincrement()) + name String? + path String? + hidden Boolean? - time_played DateTime - last_played DateTime - date_created DateTime + time_played DateTime + last_played DateTime + date_created DateTime - mods Mod[] - // java_instance JavaInstance + mods Mod[] - @@map("instance") + java_instance JavaInstance @relation(fields: [java_instance_id], references: [id]) + java_instance_id Int + + @@map("instance") } model JavaInstance { - id Int @id @default(autoincrement()) - name String? - path String? - version String? - arch String? + id Int @id @default(autoincrement()) + name String? + path String? + version String? + arch String? - /// @local - instance_id Int? - // instance Instance? @relation(fields: [instance_id], references: [id]) + instance Instance[] - @@map("java_instance") + @@map("java_instance") } model Mod { - id Int @id @default(autoincrement()) + id Int @id @default(autoincrement()) - name String? - path String? - enabled Boolean @default(true) - hidden Boolean? - date_added DateTime? + name String? + path String? + enabled Boolean @default(true) + hidden Boolean? + date_added DateTime? - /// @local - instance_id Int? - instance Instance? @relation(fields: [instance_id], references: [id], onDelete: SetNull) + /// @local + instance_id Int? + instance Instance? @relation(fields: [instance_id], references: [id], onDelete: SetNull) - @@map("location") + @@map("location") } // todo the rest of this shit loll