mirror of
https://github.com/tauri-apps/tauri.studio.git
synced 2026-02-04 02:21:17 +01:00
fix(docs&wiki) tauri config is src-tauri/tauri.conf.json
This commit is contained in:
@@ -26,7 +26,7 @@ chainWebpack (chain) {
|
||||
The official helper waits for
|
||||
|
||||
|
||||
They are configured in the `tauri.conf.js` file with the following object:
|
||||
They are configured in the `src-tauri/tauri.conf.json` file with the following object:
|
||||
|
||||
## Whitelist
|
||||
```
|
||||
@@ -51,7 +51,7 @@ These features will be added to your project's `src-taurl/Cargo.toml` at build t
|
||||
* @module tauri
|
||||
* @description This API interface makes powerful interactions available
|
||||
* to be run on client side applications. They are opt-in features, and
|
||||
* must be enabled in tauri.conf.js
|
||||
* must be enabled in src-tauri/tauri.conf.json > tauri > whitelist
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -241,7 +241,7 @@ tauri.addEventListener('reply', res => {
|
||||
})
|
||||
```
|
||||
|
||||
But as long as `event: true` is set in `tauri.conf.js`, you can always emit from any part of your code. Here are a few more examples of things you can do:
|
||||
But as long as `event: true` is set in `src-tauri/tauri.conf.json > tauri > whitelist`, you can always emit from any part of your code. Here are a few more examples of things you can do:
|
||||
```rust
|
||||
tauri::event::emit(handle, "reply", serde_json::to_string(&reply).unwrap());
|
||||
tauri::event::emit(handle, "reply", "{'msg': 'changed by rust emit'}".to_string());
|
||||
|
||||
@@ -93,7 +93,7 @@ This is an early outline of the contents that we expect to publish. Contents sub
|
||||
- Icons
|
||||
- Splash Screens
|
||||
- Window
|
||||
- `tauri.conf.js`
|
||||
- `src-tauri/tauri.conf.json`
|
||||
6. Preparing your code
|
||||
- Transpile dynamic imports
|
||||
- Remove webpack chunking
|
||||
|
||||
@@ -8,7 +8,7 @@ The main Tauri CLI is a NodeJS program that has a number of subcommands:
|
||||
## init
|
||||
```
|
||||
Description
|
||||
Inits the Tauri template. If Tauri cannot find the tauri.conf.js
|
||||
Inits the Tauri template. If Tauri cannot find the src-tauri/tauri.conf.json
|
||||
it will create one.
|
||||
Usage
|
||||
$ tauri init
|
||||
@@ -29,7 +29,7 @@ The main Tauri CLI is a NodeJS program that has a number of subcommands:
|
||||
Options
|
||||
--help, -h Displays this message
|
||||
```
|
||||
This command is rigged via your `tauri.conf.js`.
|
||||
This command is rigged via your `src-tauri/tauri.conf.json`.
|
||||
|
||||
|
||||
## build
|
||||
@@ -41,7 +41,7 @@ This command is rigged via your `tauri.conf.js`.
|
||||
Options
|
||||
--help, -h Displays this message
|
||||
```
|
||||
This command is rigged via your `tauri.conf.js`.
|
||||
This command is rigged via your `src-tauri/tauri.conf.json`.
|
||||
|
||||
## icon
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## tauri.conf.js
|
||||
## src-tauri/tauri.conf.json
|
||||
|
||||
```
|
||||
const path = require('path')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## No Server?
|
||||
|
||||
If you want the highest degree of security, then you will never ship a server with your app if you don't have to. The `no-server` mode that you can configure in `tauri.conf.js` will do just that: Ship your app without a server. It requires a bit of extra effort on your part, in that you will need to modify your webpack config or chain and add an extra node module to your project dependencies.
|
||||
If you want the highest degree of security, then you will never ship a server with your app if you don't have to. The `no-server` mode that you can configure in `src-tauri/tauri.conf.json` will do just that: Ship your app without a server. It requires a bit of extra effort on your part, in that you will need to modify your webpack config or chain and add an extra node module to your project dependencies.
|
||||
|
||||
|
||||
### Installation and Setup
|
||||
@@ -9,7 +9,7 @@ yarn add @tauri-apps/tauri-webpack
|
||||
```
|
||||
|
||||
|
||||
In your `tauri.conf.js`
|
||||
In your `src-tauri/tauri.conf.json`
|
||||
```js
|
||||
tauri: {
|
||||
embeddedServer: {
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
We are assuming that you know what the command line is, how to install packages on your operating system and generally know your way around the development side of computing. Obviously, you must first make sure that all required languages / compilers are available and in your PATH. Then you globally install the Tauri CLI with your Node package manager.
|
||||
|
||||
### Initializing an App
|
||||
The initialization phase creates a folder and places a few template files into your project directory. The most important file that it creates is the `tauri.conf.js` file, as this is where you manage the configuration of your project.
|
||||
The initialization phase creates a folder and places a few template files into your project directory. The most important file that it creates is the `src-tauri/tauri.conf.json` file, as this is where you manage the configuration of your project.
|
||||
|
||||
### Developing an App
|
||||
There are several methods for developing an App and using the built-in development App Window. The most common is to point the Tauri configuration at a localhost port that your front-end framework's development server provides you with. If your framework doesn't provide you with this, or you like everything vanilla, then you can instruct Tauri to serve (and transpile if needed) from a relative file path. In both cases you will have HMR (Hot Module Reloading).
|
||||
|
||||
### Making App Icons
|
||||
Your app will need icons, and Tauri also provides a command for making all the icons your app will need, no matter which platform you are using. Simply place a 1240x1240 png (with transparency) named `app-icon.png` in your project folder (where the `tauri.conf.js` file is to be found) and run `tauri icon`. The icons will be placed in `src-tauri/icons` and automatically consumed by Tauri during the build process.
|
||||
Your app will need icons, and Tauri also provides a command for making all the icons your app will need, no matter which platform you are using. Simply place a 1240x1240 png (with transparency) named `app-icon.png` in your project folder (where the `src-tauri/tauri.conf.json` file is to be found) and run `tauri icon`. The icons will be placed in `src-tauri/icons` and automatically consumed by Tauri during the build process.
|
||||
|
||||
### Bundling an App
|
||||
The basic process of building a Tauri App is very straightforward and unopinionated. In the Tauri configuration file you reference a distribution folder e.g. `../dist/spa` where your HTML, CSS, JS and other assets can be found. Then you tell the Tauri CLI to build your app. Tauri prepares your code depending upon your configuration and bundles everything up into a nice and tidy binary.
|
||||
@@ -47,7 +47,7 @@ We are currently working on enabling the Web APIs and most of them may not be av
|
||||
|
||||
## The Templates
|
||||
|
||||
First is the tauri.conf.js file - it is injected into the CWD at tauri init.
|
||||
First is the src-tauri/tauri.conf.json file - it is injected into the CWD at tauri init.
|
||||
Then is the src-tauri folder, which is injected into the CWD and contains the base Rust application that you can extend as you wish.
|
||||
|
||||
The node CLI has a bunch of "syntactic" sugar that sets up the dev env or prepares assets for the bundle process (as well as the tauri icon command for making icons.)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div id="padding" style="padding-top:40px"></div>
|
||||
<p class="q-mt-xl">Tauri patterns are descriptions of use-cases that are entirely configurable within the tauri.conf.js file. These are not the limits of what Tauri can do, and there are probably more out there. If you discover one, why not get in touch and help us update this collection!
|
||||
<p class="q-mt-xl">Tauri patterns are descriptions of use-cases that are entirely configurable within the src-tauri/tauri.conf.json file. These are not the limits of what Tauri can do, and there are probably more out there. If you discover one, why not get in touch and help us update this collection!
|
||||
</p>
|
||||
<p>If you haven't read about the general design of Tauri, then it would make the most sense for you to visit the
|
||||
<router-link :to="{name: 'introduction'}">INTRODUCTION</router-link> and become familiar with the basic architecture and terminology used in these patterns.
|
||||
@@ -66,7 +66,7 @@
|
||||
<q-separator></q-separator>-->
|
||||
<q-card-section>
|
||||
<h6 id="configuration">Configuration</h6>
|
||||
<span>tauri.conf.json</span>
|
||||
<span>src-tauri/tauri.conf.json</span>
|
||||
<q-markdown :src="active.configMD" no-line-numbers toc @data="onToc"/>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -39,7 +39,7 @@ The first generation User Interface in Tauri apps leverages Cocoa/WebKit on macO
|
||||
> We are currently working on enabling the Web APIs and many of them may not be available on your platform.
|
||||
|
||||
## The Templates
|
||||
First is the `tauri.conf.json` file - it is injected into the CWD at tauri init.
|
||||
First is the `src-tauri/tauri.conf.json` file - it is injected into the CWD at tauri init.
|
||||
Then is the src-tauri folder, which is injected into the CWD and contains the base Rust application that you can extend as you wish.
|
||||
|
||||
The node CLI has a bunch of "syntactic" sugar that sets up the dev env or prepares assets for the bundle process (as well as the tauri icon command for making icons.)
|
||||
|
||||
@@ -23,7 +23,7 @@ quasar dev
|
||||
## Inform tauri about localhost port
|
||||
Once your devserver is up and running, be sure that you have configured the `src-tauri/tauri.conf.json` to correctly point at the devserver. Normally, you will be informed about its port in the terminal where you spawned the devserver in the previous step.
|
||||
|
||||
Edit tauri.conf.json:
|
||||
Edit src-tauri/tauri.conf.json:
|
||||
```
|
||||
{
|
||||
"build": {
|
||||
|
||||
@@ -33,7 +33,7 @@ $ cargo install tauri-cli --force
|
||||
|
||||
## Inform tauri about your distributables location
|
||||
Be sure that you have configured the `src-tauri/tauri.conf.json` to correctly point at the assets.
|
||||
Edit `tauri.conf.json`:
|
||||
Edit `src-tauri/tauri.conf.json`:
|
||||
|
||||
```
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ There are two basic modes of tauri: with or without a localhost server.
|
||||
|
||||
## Localhost Server
|
||||
Shipped by default, this is the easiest way to get up and running. It provides your app with a localhost server that uses an ephemeral port (i.e. a port that changes on every run, based on what is available on the device).
|
||||
In your `tauri.conf.json`:
|
||||
In your `src-tauri/tauri.conf.json`:
|
||||
```json
|
||||
"tauri": {
|
||||
"embeddedServer": {
|
||||
@@ -16,7 +16,7 @@ In your `tauri.conf.json`:
|
||||
## No Server
|
||||
A more advanced and secure configuration, and currently only available for webpack users, is the no-server. The main reason for its complexity is that tauri needs to rebuild your code by removing dynamic imports.
|
||||
|
||||
In your `tauri.conf.json`:
|
||||
In your `src-tauri/tauri.conf.json`:
|
||||
```json
|
||||
"tauri": {
|
||||
"embeddedServer": {
|
||||
|
||||
@@ -21,7 +21,7 @@ The main Tauri CLI is a NodeJS program that has a number of subcommands:
|
||||
## tauri init
|
||||
```
|
||||
Description
|
||||
Inits the Tauri template. If Tauri cannot find the tauri.conf.js
|
||||
Inits the Tauri template. If Tauri cannot find the src-tauri/tauri.conf.json
|
||||
it will create one.
|
||||
Usage
|
||||
$ tauri init
|
||||
@@ -42,7 +42,7 @@ The main Tauri CLI is a NodeJS program that has a number of subcommands:
|
||||
Options
|
||||
--help, -h Displays this message
|
||||
```
|
||||
This command is rigged via your `tauri.conf.json`.
|
||||
This command is rigged via your `src-tauri/tauri.conf.json`.
|
||||
|
||||
|
||||
## tauri build
|
||||
@@ -55,7 +55,7 @@ This command is rigged via your `tauri.conf.json`.
|
||||
--help, -h Displays this message
|
||||
--debug, -d Build a tauri app with debugging
|
||||
```
|
||||
This command is rigged via your `tauri.conf.json`.
|
||||
This command is rigged via your `src-tauri/tauri.conf.json`.
|
||||
|
||||
## icon
|
||||
```
|
||||
|
||||
@@ -24,15 +24,15 @@ $ tauri init
|
||||
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/tauri.conf.json (if not found or --force)
|
||||
- renders /cli/tauri.js/templates/src-tauri/tauri.conf.json
|
||||
! 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.
|
||||
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 `src-tauri/tauri.conf.json` file to manage all settings.
|
||||
|
||||
### Development (JS + RUST)
|
||||
```
|
||||
@@ -43,7 +43,7 @@ $ tauri dev
|
||||
=> 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
|
||||
? /cli/tauri.js/helpers/tauri-config merges src-tauri/tauri.conf.json
|
||||
* This is where the following ENV values are being set.
|
||||
TAURI_DIST_DIR
|
||||
TAURI_DIR
|
||||
@@ -55,13 +55,13 @@ $ tauri dev
|
||||
Runner.run:
|
||||
-> get paths
|
||||
-> inline assets if needed
|
||||
-> transform tauri.conf.js:conf.whitelist to toml
|
||||
-> transform src-tauri/tauri.conf.json:conf.whitelist to toml
|
||||
-> manipulate Cargo.toml for API whitelist 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
|
||||
spawn webview with settings from src-tauri/tauri.conf.json
|
||||
point webview at dev-server
|
||||
inject tauri.js into webview
|
||||
init tauri
|
||||
@@ -78,7 +78,7 @@ $ tauri build
|
||||
// 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
|
||||
? /cli/tauri.js/helpers/tauri-config merges src-tauri/tauri.conf.json
|
||||
* This is where the following ENV values are being set.
|
||||
TAURI_DIST_DIR
|
||||
TAURI_DIR
|
||||
@@ -92,7 +92,7 @@ $ tauri build
|
||||
Runner.build:
|
||||
-> get paths
|
||||
-> inline assets if needed
|
||||
-> transform tauri.conf.js:conf.whitelist to toml
|
||||
-> transform src-tauri/tauri.conf.json:conf.whitelist to toml
|
||||
-> manipulate Cargo.toml for API whitelist features
|
||||
-> spawns cargo 'module' `tauri-cli` (using /cli/tauri.js/helpers/spawn.js)
|
||||
- feature 'embedded-server' : 'no-server'
|
||||
|
||||
Reference in New Issue
Block a user