mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 10:00:17 +05:30
chore: production build setup - capabilities, vite config, build instructions
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -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 |
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
|
"dev": "vite",
|
||||||
|
"build:frontend": "vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"test:coverage": "jest --coverage",
|
"test:coverage": "jest --coverage",
|
||||||
|
|||||||
@@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -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,
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user