Skip to content

Commit ca160ad

Browse files
feat(cli): warn when productName is left as the default (#15895)
* feat(cli): warn when productName is left as the default (fix #14968) The default productName tauri-app is used to derive the default WiX installer upgrade code, so every app published without changing it gets the same upgrade code and collides with unrelated apps in winget. tauri build now warns when productName is still tauri-app, and the config docs for productName and identifier explain what must be changed before publishing. The upgrade code derivation itself is unchanged. * docs(config): document the full surface of productName The productName doc now lists everything the field controls on each platform instead of focusing on the WiX upgrade code. Requested in review of #15895. * fix(cli): broaden the default productName warning The warning and the change file described only the WiX upgrade code, which is one of several things productName controls. Also bump @tauri-apps/cli alongside tauri-cli, matching the other change files. * Update crates/tauri-cli/src/build.rs --------- Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
1 parent ce3f13b commit ca160ad

5 files changed

Lines changed: 35 additions & 4 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"tauri-cli": patch:enhance
3+
"@tauri-apps/cli": patch:enhance
4+
"tauri-utils": patch:enhance
5+
---
6+
7+
`tauri build` now warns when `productName` is still set to the default `tauri-app`, since it names the generated bundles and is written into install paths and metadata that are expected to be unique to your application. The config documentation for `productName` now lists what the field controls on each platform, and `identifier`'s documentation notes that the default value is rejected.

‎crates/tauri-cli/config.schema.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
]
1717
},
1818
"productName": {
19-
"description": "App name.",
19+
"description": "App name.\n\n This is the name your app is known by on the user's system, so it must be changed from the\n default before publishing. Besides naming the generated bundles, it is written into platform\n metadata and install paths that are expected to be unique to your application.\n\n ## Platform-specific\n\n - **macOS**: Names the `.app` bundle and the `.dmg`, and sets the bundle's\n `CFBundleDisplayName` and `CFBundleName` properties. `CFBundleName` can be overridden with\n [`bundle > macOS > bundleName`](MacConfig::bundle_name).\n - **Linux**: Kebab-cased for the Debian and RPM package names, used as the `Name` entry of\n the desktop file and as the resource directory name under `/usr/lib`.\n - **Windows**: Names the installers, the installation directory, the Start Menu folder and\n the `HKCU\\Software\\<publisher>\\<product name>` registry key. It also derives the default\n WiX upgrade code, which must be unique across applications and can be set explicitly with\n [`bundle > windows > wix > upgradeCode`](WixConfig::upgrade_code).",
2020
"type": [
2121
"string",
2222
"null"
@@ -38,7 +38,7 @@
3838
]
3939
},
4040
"identifier": {
41-
"description": "The application identifier in reverse domain name notation (e.g. `com.tauri.example`).\n This string must be unique across applications since it is used in system configurations like\n the bundle ID and path to the webview data directory.\n This string must contain only alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-),\n and periods (.).",
41+
"description": "The application identifier in reverse domain name notation (e.g. `com.tauri.example`).\n This string must be unique across applications since it is used in system configurations like\n the bundle ID and path to the webview data directory.\n This string must contain only alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-),\n and periods (.).\n The default value `com.tauri.dev` is rejected by `tauri build` and must be changed before\n building your application.",
4242
"type": "string"
4343
},
4444
"app": {

‎crates/tauri-cli/src/build.rs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ pub fn setup(
193193
);
194194
}
195195

196+
if config.product_name.as_deref() == Some("tauri-app") {
197+
log::warn!(
198+
"The `productName` is still set to the default value `tauri-app`, it must be unique across applications since it is written into install paths and platform metadata that are expected to be unique to your application, like the Windows installer upgrade code."
199+
);
200+
}
201+
196202
if let Some(before_build) = config.build.before_build_command.clone() {
197203
helpers::run_hook(
198204
"beforeBuildCommand",

‎crates/tauri-schema-generator/schemas/config.schema.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
]
1717
},
1818
"productName": {
19-
"description": "App name.",
19+
"description": "App name.\n\n This is the name your app is known by on the user's system, so it must be changed from the\n default before publishing. Besides naming the generated bundles, it is written into platform\n metadata and install paths that are expected to be unique to your application.\n\n ## Platform-specific\n\n - **macOS**: Names the `.app` bundle and the `.dmg`, and sets the bundle's\n `CFBundleDisplayName` and `CFBundleName` properties. `CFBundleName` can be overridden with\n [`bundle > macOS > bundleName`](MacConfig::bundle_name).\n - **Linux**: Kebab-cased for the Debian and RPM package names, used as the `Name` entry of\n the desktop file and as the resource directory name under `/usr/lib`.\n - **Windows**: Names the installers, the installation directory, the Start Menu folder and\n the `HKCU\\Software\\<publisher>\\<product name>` registry key. It also derives the default\n WiX upgrade code, which must be unique across applications and can be set explicitly with\n [`bundle > windows > wix > upgradeCode`](WixConfig::upgrade_code).",
2020
"type": [
2121
"string",
2222
"null"
@@ -38,7 +38,7 @@
3838
]
3939
},
4040
"identifier": {
41-
"description": "The application identifier in reverse domain name notation (e.g. `com.tauri.example`).\n This string must be unique across applications since it is used in system configurations like\n the bundle ID and path to the webview data directory.\n This string must contain only alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-),\n and periods (.).",
41+
"description": "The application identifier in reverse domain name notation (e.g. `com.tauri.example`).\n This string must be unique across applications since it is used in system configurations like\n the bundle ID and path to the webview data directory.\n This string must contain only alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-),\n and periods (.).\n The default value `com.tauri.dev` is rejected by `tauri build` and must be changed before\n building your application.",
4242
"type": "string"
4343
},
4444
"app": {

‎crates/tauri-utils/src/config.rs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3744,6 +3744,22 @@ pub struct Config {
37443744
#[serde(rename = "$schema")]
37453745
pub schema: Option<String>,
37463746
/// App name.
3747+
///
3748+
/// This is the name your app is known by on the user's system, so it must be changed from the
3749+
/// default before publishing. Besides naming the generated bundles, it is written into platform
3750+
/// metadata and install paths that are expected to be unique to your application.
3751+
///
3752+
/// ## Platform-specific
3753+
///
3754+
/// - **macOS**: Names the `.app` bundle and the `.dmg`, and sets the bundle's
3755+
/// `CFBundleDisplayName` and `CFBundleName` properties. `CFBundleName` can be overridden with
3756+
/// [`bundle > macOS > bundleName`](MacConfig::bundle_name).
3757+
/// - **Linux**: Kebab-cased for the Debian and RPM package names, used as the `Name` entry of
3758+
/// the desktop file and as the resource directory name under `/usr/lib`.
3759+
/// - **Windows**: Names the installers, the installation directory, the Start Menu folder and
3760+
/// the `HKCU\Software\<publisher>\<product name>` registry key. It also derives the default
3761+
/// WiX upgrade code, which must be unique across applications and can be set explicitly with
3762+
/// [`bundle > windows > wix > upgradeCode`](WixConfig::upgrade_code).
37473763
#[serde(alias = "product-name")]
37483764
#[cfg_attr(feature = "schema", validate(regex(pattern = "^[^/\\:*?\"<>|]+$")))]
37493765
pub product_name: Option<String>,
@@ -3784,6 +3800,8 @@ pub struct Config {
37843800
/// the bundle ID and path to the webview data directory.
37853801
/// This string must contain only alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-),
37863802
/// and periods (.).
3803+
/// The default value `com.tauri.dev` is rejected by `tauri build` and must be changed before
3804+
/// building your application.
37873805
pub identifier: String,
37883806
/// The App configuration.
37893807
#[serde(default)]

0 commit comments

Comments
 (0)