Detailed Flow

NOTE: This document requires revision.

Introduction

This document serves to map the interconnectedness of the maze of modules that are involved in the process of creating, developing and building a Tauri app. Note, this is a living document. The current status is reflected below.

Initialization (JS ONLY)

$ tauri init
  Options
    --help, -h        Displays this message
    --force, -f       Force init to overwrite [conf|template|all]
    --log, -l         Logging [boolean]
    --directory, -d   Set target directory for init
    --tauri-path, -t   Path of the Tauri project to use (relative to the cwd)

=> runs /cli/tauri.js/bin/tauri.js
 handoff to /cli/tauri.js/bin/tauri-init.js
 handoff to /cli/tauri.js/api/init.js
 uses /cli/tauri.js/template.js
     ? parses CWD (or --directory) as DIR
     ! creates $DIR/tauri.conf.js (if not found or --force)
       - renders /cli/tauri.js/templates/tauri.conf.js
     ! creates $DIR/src-tauri (if not found or --force)
       - renders /cli/tauri.js/templates/src-tauri
process.exit()

Using Rust

One thing to recognise is that we don't use command line flags for tauri dev or tauri build. This is because we are using the tauri.conf.js file to manage all settings.

Development (JS + RUST)

$ tauri dev
  Options
    --help, -h        Displays this message

=> runs /cli/tauri.js/bin/tauri.js
 handoff to /cli/tauri.js/bin/tauri-dev.js
 handoff to /cli/tauri.js/api/dev.js
    ? /cli/tauri.js/helpers/tauri-config merges tauri.conf.js
      * This is where the following ENV values are being set.
        TAURI_DIST_DIR
        TAURI_DIR
    ! merges config with `ctx`
    => runs generator at /cli/tauri.js/generator.js
    => runs entry at /cli/tauri.js/entry.js
    => returns tauri Runner from /cli/tauri.js/runner.js
 new Runner()
   Runner.run:
   -> get paths
   -> inline assets if needed
   -> transform tauri.conf.js:conf.allowlist to toml
     -> manipulate Cargo.toml for API allow features
   -> start chokidar filewatcher (to restart dev-service on changes)
   -> spawn cargo run with dev-server arg (if needed ?)
 cargo run -features [dev-server]
  [WIP]
   spawn webview with settings from tauri.conf.js
   point webview at dev-server
   inject tauri.js into webview
   init tauri

Build (JS + RUST + BASH)

$ tauri build
  Options
    --help, -h        Displays this message

=> runs /cli/tauri.js/bin/tauri.js
 handoff to /helpers/tauri-configbin/tauri-dev.js
    // notably, the only difference between dev and build up to this point
    // is that the build command is passed a ctx.debug = argv.debug
 handoff to /cli/tauri.js/api/dev.js
    ? /cli/tauri.js/helpers/tauri-config merges tauri.conf.js
      * This is where the following ENV values are being set.
        TAURI_DIST_DIR
        TAURI_DIR
    ! merges config with `ctx`
      // notably, the only difference between dev and build up to this point
      // is that build modifies the `ctx` of the config to prod:true
    => runs generator at /cli/tauri.js/generator.js
    => runs entry at /cli/tauri.js/entry.js
    => returns tauri Runner from /cli/tauri.js/runner.js
 new Runner()
   Runner.build:
   -> get paths
   -> inline assets if needed
   -> transform tauri.conf.js:conf.allowlist to toml
     -> manipulate Cargo.toml for API allow features
   -> spawns cargo 'module' `tauri-cli` (using /cli/tauri.js/helpers/spawn.js)
      - feature 'embedded-server' : 'no-server'
      - --release (or debug)
      - --target
        // The target is currently implicit based upon the OS
        // We need to add configurations for e.g. .app / .dmg on macOS
 cargo tauri-cli
   [WIP]
   -> detect the OS
   -> handoff to respective OS builder
   -> run cargo build
     - parse the config settings in the project's Cargo.toml
   -> package assets

module reference

TITLESCOPELANG/ENVSTATUSCODEOWNERS
Ccli/tauri.jsbootstrapping, template renderingTS, ES5 / NODE, DENO(SOON)activeLucas, Daniel, Noah
Ctaurilib / apirustactiveLucas, Tensor, Khionu, Daniel
Ctauri-buildbindingsrustactiveLucas, Tensor, Khionu, Daniel
Ctauri-updateupdate, optionalrustactiveLucas, Tensor, Khionu, Daniel
Ccli/tauri-cliasset bundlerrust, bashactiveTensor, Daniel
Otauri-webpackdevland-dep, webpack, no-serverES6activeLucas, Benoit
Otauri-inlinercli-depES5forkLucas, Daniel
Otauri-includedirtauri-deprustforkLucas, Tensor
Otauri-tomlcli-depES5forkLucas, Daniel, Noah
Ssmoke-teststestinghtml/js/css/rustin userespective authors
Otauri.studiodocsquasarin devDaniel
Uboscop/web-viewupstreamrustactiveboscop/xsey
Uzserge/webviewupstream @boscopc,cpp,objcmolasseszserge
Sgh-actionsallyaml / bash-likeactiveJacob, Daniel, Rajiv
Ovue-cli-pluginvueES6activeNoah
Legend

entry points

rust js/ts/deno tauri init (consumer)

modes

  • build
    • embedded-server
    • no-server
  • dev
    • their devserver
    • our devserver (future possibility, after alpha)