Uninen / tauri-vue-template

Tauri + Vue + Vite template w/ Vitest, Tailwind, and GH Actions configured.
176 stars 18 forks source link
rust tauri typescript vite vue

Tauri + Vue + Vite Template

Screenshot

Simple project template for Tauri and Vue 3.

Features

Setting Up

  1. Install Tauri Prerequisites
  2. Clone and install dependencies (this template uses pnpm by default):
pnpm i

Usage

A Tauri app has at least two processes:

🦢 Frontend (TS, PnPM)

Running Development Server

Both back- and frontend start with a single command:

pnpm dev

Testing

pnpm test

🦀 Backend (Rust, Cargo)

Backend code lives in src-tauri/ (Following commands are to be run from there.)

Finding Outdated Rust Dependencies

If you have cargo-outdated installed:

cargo outdated

Upgrading Rust Dependencies

If you have cargo-edit installed:

cargo upgrade

Debugging

Building and releasing

Building

The project has GitHub Actions set up which will automatically test and build your app with every push and PR. For building manually:

pnpm build

Releasing a new version

  1. Bump version number in package.json, src-tauri/Cargo.toml, and src-tauri/tauri.conf.json. (This could be easier!)
  2. Run pnpm check to update Cargo.lock
  3. Tag the commit you want to release with vX.Y.Z
  4. Edit the release notes and push (also tags!)
  5. Github workflow will automatically build a new draft release for this version. Publish when ready 🎉

Howto

Custom title bar styles (like titleBarStyle: 'hidden' in Electron)

Tauri doesn't currently offer a method to hide the title bar without hiding all window chrome. There is, however, a fairly simple way to do it manually (with certain limitations; see Tauri issue #2663 for details).

  1. Add cocoa and objc crates to dependencies
  2. Add set_transparent_titlebar and position_traffic_lights from this gist: https://gist.github.com/Uninen/5377381eb81bdcd71b9d1859e46e3e29
  3. Call set_transparent_titlebar and position_traffic_lights from setup and on_window_event (example in the gist starting line 114) on any window you want affected.

This implementation works but results in visible jerkyness of the traffic lights (on macOS) when the window is resized. (Alternatives discussed in detail in the issue #2663)

Elsewhere

Contributing

Contributions are welcome! Please follow the code of conduct when interacting with others.