diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fd684fd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +max_line_length = 120 +indent_size = 4 +indent_style = space + +[*.json] +indent_size = 2 diff --git a/cfg/postcss.config.ts b/cfg/postcss.config.ts new file mode 100644 index 0000000..97bcfd7 --- /dev/null +++ b/cfg/postcss.config.ts @@ -0,0 +1,25 @@ +import tailwind from "tailwindcss"; +import autoprefixer from "autoprefixer"; +import cssnanoPlugin from "cssnano"; + +import tailwindConfig from "./tailwind.config"; +const mode = process.env.NODE_ENV; +const dev = mode === "development"; + +export default { + plugins: (() => { + let plugins = [ + // Some plugins, like TailwindCSS/Nesting, need to run before Tailwind. + tailwind(tailwindConfig), + + // But others, like autoprefixer, need to run after. + autoprefixer() + ]; + + !dev && cssnanoPlugin({ + preset: "default" + }); + + return plugins; + })() +}; diff --git a/cfg/tailwind.config.ts b/cfg/tailwind.config.ts new file mode 100644 index 0000000..848a213 --- /dev/null +++ b/cfg/tailwind.config.ts @@ -0,0 +1,11 @@ +import { Config } from "tailwindcss"; + +export default { + content: ["./src/**/*.{html,js,tsx,ts}"], + mode: "jit", + theme: { + extend: {} + }, + darkMode: "class", + plugins: [] +} as Config; diff --git a/package.json b/package.json index e20bcff..092f09d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cultivation", "private": true, - "version": "0.0.0", + "version": "2.0.0", "type": "module", "scripts": { "dev": "vite", @@ -10,13 +10,24 @@ "tauri": "tauri" }, "dependencies": { + "@tauri-apps/api": "^1.5.1", "preact": "^10.16.0", - "@tauri-apps/api": "^1.5.1" + "react-icons": "^4.12.0", + "zustand": "^4.4.6" }, "devDependencies": { "@preact/preset-vite": "^2.5.0", + "@tauri-apps/cli": "^1.5.6", + "@types/node": "^20.10.0", + "autoprefixer": "^10.4.16", + "cssnano": "^6.0.1", + "postcss": "^8.4.31", + "postcss-load-config": "^4.0.2", + "prettier": "^3.1.0", + "sass": "^1.69.5", + "tailwindcss": "^3.3.5", "typescript": "^5.0.2", "vite": "^4.4.4", - "@tauri-apps/cli": "^1.5.6" + "vite-tsconfig-paths": "^4.2.1" } } diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 65f5a2c..4fa5b71 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -501,7 +501,7 @@ dependencies = [ [[package]] name = "cultivation" -version = "0.0.0" +version = "2.0.0" dependencies = [ "serde", "serde_json", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 16435e5..3ac70ff 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "cultivation" -version = "0.0.0" -description = "A Tauri App" -authors = ["you"] -license = "" -repository = "" +version = "2.0.0" +description = "Anime game launcher" +authors = ["KingRainbow44", "SpikeHD"] +license = "MIT" +repository = "https://github.com/Grasscutters/Cultivation" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 7afafc5..1da6d01 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -36,9 +36,9 @@ { "fullscreen": false, "resizable": true, - "title": "cultivation", - "width": 800, - "height": 600 + "title": "Cultivation", + "width": 1280, + "height": 730 } ] } diff --git a/tsconfig.node.json b/tsconfig.node.json index 42872c5..0f9c174 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -6,5 +6,9 @@ "moduleResolution": "bundler", "allowSyntheticDefaultImports": true }, - "include": ["vite.config.ts"] + "include": [ + "vite.config.ts", + "cfg/postcss.config.ts", + "cfg/tailwind.config.ts", + ] } diff --git a/vite.config.ts b/vite.config.ts index ed91d56..eca1271 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,17 +1,24 @@ import { defineConfig } from "vite"; import preact from "@preact/preset-vite"; +import tsconfigPaths from "vite-tsconfig-paths"; +import postcss from "./cfg/postcss.config"; // https://vitejs.dev/config/ export default defineConfig(async () => ({ - plugins: [preact()], + plugins: [ + preact(), + tsconfigPaths() + ], - // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` - // - // 1. prevent vite from obscuring rust errors - clearScreen: false, - // 2. tauri expects a fixed port, fail if that port is not available - server: { - port: 1420, - strictPort: true, - } + css: { postcss }, + + // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` + // + // 1. prevent vite from obscuring rust errors + clearScreen: false, + // 2. tauri expects a fixed port, fail if that port is not available + server: { + port: 1420, + strictPort: true, + } }));