- Feature Name: tauri_config_restructure
- Start Date: 2023-12-20
- RFC PR: tauri-apps/rfcs#13
- Tracking Issue:
Restructuring the tauri.conf.json
for more simplicity, consistency and clarity.
The current tauri.conf.json
has a bunch of objects that don't necessarily follow a rule that could reason why they exist there and thus makes it awkward to figure out where to add new fields
for example tauri > bundle
object is a configuration for the CLI, why does it exist inside tauri
object, another example is the plugins
object which is a tauri feature, why does it exist outside of tauri
object?
These inconsistencies will make it harder to add new fields to the config.
- Unpack
package
fields to the root object. - Rename
tauri
object toapp
. - Move
tauri > bundle > identifier
to the root object as it is used by other places in tauri other than bundling. - Remove
bundle > updater
as the only useful key it has, ispubkey
field and that should be moveed toplugin > updater > pubkey
. This will require changes in the CLI to only sign the bundles whenTAURI_SIGNING_PRIVATE_KEY
key is set . This will also fix a huge DX when usingtauri-plugin-updater
and you endup having to configure updater-related configs once inbundle > updater
andplugin > updater
. - Move
build > withGlobalTauri
to the newapp > withGlobaltauri
object. - Move
tauri > pattern
toapp > security > pattern
and make it accept a simple string forbrownfield
. - Move
tauri > cli
andtauri > update
fields toplugins > cli
andplugins > update
as they are plugins now. - Rename
build > distDir
tobuild > frontendDist
to explicitly set the intent of the option. - Rename
build > devPath
tobuild > devUrl
and only accept urls, if users don't have a devServer, they should remove this field and only setbuild > frontendDist
which will make the CLI start its built-in devServer or fallback to embed the assets if--no-dev-server
is used. - Move
tauri > bundle
to root object.
Current Config | New Config |
---|---|
{
"build": {
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build",
"devPath": "http://localhost:8080/",
"distDir": "../src",
"withGlobalTauri": true
},
"package": {
"productName": "tauri-app",
"version": "0.0.0"
},
"tauri": {
"allowlist": {
"all": true
},
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.taasduri.dev",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
},
"updater": {
"active": true,
"pubkey": "",
"endpoints": ["http://localhost:8080/update.json"],
"windows": {
"installMode": "basicUi"
}
},
"cli": {},
"macOSPrivateApi": false,
"security": {
"csp": null
},
"pattern": {
"use": "brownfield"
},
"systemTray": {
"iconPath": "./path/to/icon"
},
"windows": [
{
"title": "tauri-app",
"width": 800,
"height": 600
}
]
}
} |
{
"productName": "tauri-app",
"version": "0.1.0",
"identifier": "com.tauri.dev",
"build": {
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build",
"devUrl": "http://localhost:8080/",
"frontendDist": "../src" // or ["../src/index.html", "../src/main.js"] if need to include specific files
},
"app": {
"windows": [
{
"title": "tauri-app",
"width": 800,
"height": 600
}
],
"withGlobalTauri": true,
"macosPrivateApi": false,
"trayIcon": {
"iconPath": "./path/to/icon"
},
"allowlist": { // soon to be replaced with permissions and cababilities
"all": true
},
"security": {
"pattern": "brownfield",
"csp": null
},
"plugins": {
"cli": {},
"updater": {
"pubkey": "",
"endpoints": ["http://localhost:8080/update.json"],
"windows": {
"installMode": "basicUi"
}
}
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
}
} |
This will be a breaking change and so users will need to restructure the config themselves or rely on tauri migrate
command.
Almost all current Tauri users will need to migrate to the new breaking changes but it is better to do this now in a major release.