tauri-clojurescript-template icon indicating copy to clipboard operation
tauri-clojurescript-template copied to clipboard

Tauri + ClojureScript template

#+TITLE: Tauri + ClojureScript template #+AUTHOR: rome-user #+LANGUAGE: en

#+CAPTION: A demonstration of the app provided by this template. #+NAME: App Demonstration #+ATTR_HTML: :width 500px [[./app-demo.png]]

This project lays out a bare minimum template for using ClojureScript with Tauri. Out of the box, the following is provided:

  • Shadow CLJS
  • React
  • Helix
  • Getting Started

** Starting the development environment

After cloning this repository, run the following commands in a terminal.

#+begin_example npm ci npm run tauri dev #+end_example

The =tauri dev= script will ensure a Shadow CLJS watch is started. If you are using Emacs, then you can =M-x cider-connect-cljs= and start coding!

** Source structure

The source code is organized exactly as any other Shadow CLJS project, but there is an additional =src-tauri= folder. This folder contains Rust code.

** Producing a release build

First ensure =tauri.bundle.identifier= in =src-tauri/tauri.conf.json= contains a value other than =com.tauri.dev=. Otherwise the build will fail, since this value is expected to be unique.

After you have changed this value, you can simply run the following command. #+begin_example npm run tauri build #+end_example

If you use Mac, then this process produces a disk image with a release build of the app inside.

  • Caveats

** CIDER integration

Since this project is launched with an NPM script, we need to provide fixed versions of =nrepl=, =cider/cider-nrepl=, and =cider/piggieback=. Depending on the version of CIDER being used in your editor, you may need to downgrade the versions in use by this template.

  • Learning more

To learn more about ClojureScript, check out the official [[https://clojurescript.org/guides/quick-start][Quick Start guide]].

To learn more about Tauri, see the official [[https://tauri.app/v1/guides/][Tauri v1 Guide]].