diff --git a/docs/TAURI_BUILD_INSTRUCTIONS.md b/docs/TAURI_BUILD_INSTRUCTIONS.md new file mode 100644 index 0000000..4308460 --- /dev/null +++ b/docs/TAURI_BUILD_INSTRUCTIONS.md @@ -0,0 +1,96 @@ +# Building MarkdownConverter with Tauri 2.x + +## Prerequisites + +1. **Node.js 18+** and npm +2. **Rust 1.75+** — install via [rustup](https://rustup.rs/) + +```bash +# Install Rust +winget install Rust.Rustup # Windows +# OR +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # macOS/Linux + +# Set stable as default +rustup default stable + +# Install Tauri CLI (alternative to npm package) +cargo install tauri-cli --locked +``` + +## Development + +```bash +# Install dependencies +npm install + +# Run frontend dev server +npm run dev + +# In another terminal, run Tauri dev +npm run tauri:dev + +# Or use Tauri CLI directly (if installed globally via cargo) +cargo tauri dev +``` + +## Production Build + +```bash +# Build the frontend first +npm run build:frontend + +# Then build Tauri app +npm run tauri:build + +# Output: +# Windows: src-tauri/target/release/markdown-converter.exe +# Installer: dist/MarkdownConverter-Setup-4.3.0.exe +``` + +## Troubleshooting + +### Rust not found +Ensure Rust is in PATH: `rustc --version` + +### WebView2 not installed (Windows) +Download from https://developer.microsoft.com/en-us/microsoft-edge/webview2/ + +### pandoc not found +Pandoc must be installed and in PATH. Download from https://pandoc.org/installing.html + +## File Structure + +``` +src-tauri/ + src/ + main.rs # Binary entry point + lib.rs # Tauri app setup + command registration + commands/ # Rust commands (file, git, pdf, export, etc.) + menu.rs # Native menu + tray.rs # System tray + pdf_ops.rs # PDF processing + plugin_manager.rs + error.rs + Cargo.toml + tauri.conf.json + capabilities/default.json + icons/ +src/ + renderer.js # Main renderer (updated for Tauri invoke/listen) + tauri-commands.js # Tauri command bridge + index.html # Main HTML (copied to dist/index.html) +dist/ + index.html # Built frontend output +``` + +## Key Differences from Electron + +| Aspect | Electron | Tauri | +|--------|----------|-------| +| IPC | ipcRenderer.invoke() | invoke() from @tauri-apps/api | +| Events | ipcRenderer.on() | listen() from @tauri-apps/api | +| File access | Node.js fs module | Rust std::fs or tauri-plugin-fs | +| Native menus | Electron Menu API | tauri menu API | +| Settings | electron-store | tauri-plugin-store | +| Binary size | ~150MB | ~10MB | \ No newline at end of file diff --git a/package.json b/package.json index 8e2655f..e918d28 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "main": "src/main.js", "scripts": { "start": "electron .", + "dev": "vite", + "build:frontend": "vite build", + "preview": "vite preview", "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage", diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json new file mode 100644 index 0000000..6f4a542 --- /dev/null +++ b/src-tauri/capabilities/default.json @@ -0,0 +1,49 @@ +{ + "$schema": "https://schema.tauri.app/config/2/capabilities", + "identifier": "default", + "description": "MarkdownConverter capabilities", + "windows": ["main"], + "permissions": [ + "core:default", + "core:event:default", + "core:window:default", + "core:window:allow-create", + "core:window:allow-close", + "core:window:allow-set-focus", + "core:window:allow-show", + "core:window:allow-hide", + "core:window:allow-minimize", + "core:window:allow-maximize", + "core:window:allow-unmaximize", + "core:window:allow-set-title", + "core:webview:default", + "core:webview:allow-create-webview-window", + "shell:allow-open", + "shell:allow-execute", + "dialog:allow-open", + "dialog:allow-save", + "dialog:allow-message", + "dialog:allow-ask", + "dialog:allow-confirm", + "fs:allow-read", + "fs:allow-write", + "fs:allow-exists", + "fs:allow-mkdir", + "fs:allow-remove", + "fs:allow-rename", + "fs:allow-copy-file", + "fs:default", + "fs:allow-read-dir", + "fs:allow-read-file", + "fs:allow-write-file", + "process:allow-exit", + "process:allow-restart", + "clipboard-manager:allow-read", + "clipboard-manager:allow-write", + "notification:default", + "os:default", + "opener:default", + "store:default", + "log:default" + ] +} \ No newline at end of file diff --git a/src/vite.config.js b/src/vite.config.js new file mode 100644 index 0000000..a0a01bf --- /dev/null +++ b/src/vite.config.js @@ -0,0 +1,15 @@ +import { defineConfig } from 'vite'; + +export default defineConfig({ + root: '.', + base: './', + build: { + outDir: '../dist', + emptyOutDir: true, + }, + server: { + port: 1420, + strictPort: true, + }, + clearScreen: false, +}); \ No newline at end of file