create-arsh-tauri 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -2
  3. package/index.js +239 -0
  4. package/package.json +43 -4
  5. package/template/.eslintrc.cjs +18 -0
  6. package/template/.github/workflows/ci.yml +50 -0
  7. package/template/AGENTS.md +50 -0
  8. package/template/README.md +51 -0
  9. package/template/gitignore +37 -0
  10. package/template/index.html +12 -0
  11. package/template/package-lock.json +4454 -0
  12. package/template/package.json +42 -0
  13. package/template/src/App.tsx +35 -0
  14. package/template/src/index.css +8 -0
  15. package/template/src/lib/tauri.ts +21 -0
  16. package/template/src/lib/utils.test.ts +17 -0
  17. package/template/src/lib/utils.ts +6 -0
  18. package/template/src/main.tsx +10 -0
  19. package/template/src/ui/appLayout.tsx +35 -0
  20. package/template/src/ui/button.tsx +63 -0
  21. package/template/src/ui/dialog.tsx +71 -0
  22. package/template/src/ui/index.ts +8 -0
  23. package/template/src/ui/navItem.tsx +37 -0
  24. package/template/src/ui/spinner.tsx +33 -0
  25. package/template/src/ui/styles.css +96 -0
  26. package/template/src/ui/switch.tsx +77 -0
  27. package/template/src/ui/titleBar.tsx +157 -0
  28. package/template/src/ui/tooltip.tsx +141 -0
  29. package/template/src/vite-env.d.ts +1 -0
  30. package/template/src-tauri/Cargo.lock +4316 -0
  31. package/template/src-tauri/Cargo.toml +26 -0
  32. package/template/src-tauri/build.rs +3 -0
  33. package/template/src-tauri/capabilities/default.json +16 -0
  34. package/template/src-tauri/icons/128x128.png +0 -0
  35. package/template/src-tauri/icons/128x128@2x.png +0 -0
  36. package/template/src-tauri/icons/32x32.png +0 -0
  37. package/template/src-tauri/icons/icon.icns +0 -0
  38. package/template/src-tauri/icons/icon.ico +0 -0
  39. package/template/src-tauri/src/lib.rs +14 -0
  40. package/template/src-tauri/src/main.rs +6 -0
  41. package/template/src-tauri/tauri.conf.json +40 -0
  42. package/template/temp/.gitkeep +0 -0
  43. package/template/tsconfig.json +25 -0
  44. package/template/tsconfig.node.json +12 -0
  45. package/template/vite.config.ts +24 -0
@@ -0,0 +1,26 @@
1
+ [package]
2
+ name = "arsh-tauri-app"
3
+ version = "0.1.0"
4
+ description = "Tauri + React + TypeScript desktop app"
5
+ authors = ["You"]
6
+ edition = "2021"
7
+
8
+ [lib]
9
+ name = "arsh_tauri_app_lib"
10
+ crate-type = ["staticlib", "cdylib", "rlib"]
11
+
12
+ [build-dependencies]
13
+ tauri-build = { version = "2", features = [] }
14
+
15
+ [dependencies]
16
+ tauri = { version = "2", features = [] }
17
+ serde = { version = "1", features = ["derive"] }
18
+ serde_json = "1"
19
+
20
+ [profile.release]
21
+ # 控制产物体积:发布构建去符号 + LTO(需要更快增量编译时可注释掉)
22
+ codegen-units = 1
23
+ lto = true
24
+ opt-level = "s"
25
+ panic = "abort"
26
+ strip = true
@@ -0,0 +1,3 @@
1
+ fn main() {
2
+ tauri_build::build()
3
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "../gen/schemas/desktop-schema.json",
3
+ "identifier": "default",
4
+ "description": "默认权限:核心能力 + 无边框窗口控制(配合 src/ui/titleBar.tsx)",
5
+ "windows": ["main"],
6
+ "permissions": [
7
+ "core:default",
8
+ "core:window:allow-minimize",
9
+ "core:window:allow-toggle-maximize",
10
+ "core:window:allow-maximize",
11
+ "core:window:allow-unmaximize",
12
+ "core:window:allow-close",
13
+ "core:window:allow-is-maximized",
14
+ "core:window:allow-start-dragging"
15
+ ]
16
+ }
@@ -0,0 +1,14 @@
1
+ /// 命令示例:前端 `invoke('greet', { name })` 调用。
2
+ /// 新命令写在这里(或按模块拆分),并注册到下方 `generate_handler!`。
3
+ #[tauri::command]
4
+ fn greet(name: &str) -> String {
5
+ format!("Hello, {name}! You've been greeted from Rust!")
6
+ }
7
+
8
+ #[cfg_attr(mobile, tauri::mobile_entry_point)]
9
+ pub fn run() {
10
+ tauri::Builder::default()
11
+ .invoke_handler(tauri::generate_handler![greet])
12
+ .run(tauri::generate_context!())
13
+ .expect("error while running tauri application")
14
+ }
@@ -0,0 +1,6 @@
1
+ // Prevents an additional console window on Windows in release builds.
2
+ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
3
+
4
+ fn main() {
5
+ arsh_tauri_app_lib::run()
6
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://schema.tauri.app/config/2",
3
+ "productName": "ArshApp",
4
+ "version": "0.1.0",
5
+ "identifier": "com.arshdelight.arshapp",
6
+ "build": {
7
+ "beforeDevCommand": "npm run dev:web",
8
+ "devUrl": "http://localhost:1420",
9
+ "beforeBuildCommand": "npm run build:web",
10
+ "frontendDist": "../dist"
11
+ },
12
+ "app": {
13
+ "windows": [
14
+ {
15
+ "label": "main",
16
+ "title": "ArshApp",
17
+ "width": 1200,
18
+ "height": 800,
19
+ "minWidth": 800,
20
+ "minHeight": 600,
21
+ "decorations": false,
22
+ "backgroundColor": "#f1f5f9"
23
+ }
24
+ ],
25
+ "security": {
26
+ "csp": null
27
+ }
28
+ },
29
+ "bundle": {
30
+ "active": true,
31
+ "targets": "all",
32
+ "icon": [
33
+ "icons/32x32.png",
34
+ "icons/128x128.png",
35
+ "icons/128x128@2x.png",
36
+ "icons/icon.icns",
37
+ "icons/icon.ico"
38
+ ]
39
+ }
40
+ }
File without changes
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true
22
+ },
23
+ "include": ["src", "electron"],
24
+ "references": [{ "path": "./tsconfig.node.json" }]
25
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true,
8
+ "strict": true,
9
+ "types": ["node"]
10
+ },
11
+ "include": ["vite.config.ts"]
12
+ }
@@ -0,0 +1,24 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+ import tailwindcss from '@tailwindcss/vite'
4
+
5
+ // Tauri expects a fixed dev port — the Tauri CLI starts Vite itself via
6
+ // beforeDevCommand (see src-tauri/tauri.conf.json) and proxies the webview to it.
7
+ export default defineConfig({
8
+ plugins: [tailwindcss(), react()],
9
+ clearScreen: false,
10
+ server: {
11
+ port: 1420,
12
+ strictPort: true,
13
+ watch: {
14
+ ignored: ['**/src-tauri/**'],
15
+ },
16
+ },
17
+ envPrefix: ['VITE_', 'TAURI_ENV_'],
18
+ build: {
19
+ target: 'chrome105',
20
+ // Vite 8 (rolldown 内核) 的压缩器是 oxc;'esbuild' 已弃用且需单独安装
21
+ minify: process.env.TAURI_ENV_DEBUG ? false : 'oxc',
22
+ sourcemap: !!process.env.TAURI_ENV_DEBUG,
23
+ },
24
+ })