Skip to content

Commit 5811941

Browse files
feat: add env vars and primitives module to migration guide (#1681)
* feat: add env vars and primitives module to migration guide * remove app and window plugins --------- Co-authored-by: Fabian-Lars <[email protected]>
1 parent 4fe31e3 commit 5811941

File tree

1 file changed

+27
-116
lines changed

1 file changed

+27
-116
lines changed

src/content/docs/guides/upgrade-migrate/from-tauri-1.mdx

Lines changed: 27 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Below is a summary of the changes from Tauri 1.0 to Tauri 2.0:
8888

8989
The `@tauri-apps/api` package no longer provides non-core modules. Only the `tauri`, `path` and `event` modules are exported. All others have been moved to plugins.
9090

91-
- `@tauri-apps/api/app` module removed. Use `@tauri-apps/plugin-app` instead. [Migration](#migrate-to-app-plugin)
91+
- `@tauri-apps/api/tauri` module renamed to `@tauri-apps/api/primitives`. [Migration](#migrate-to-primitives-module)
9292
- `@tauri-apps/api/cli` module removed. Use `@tauri-apps/plugin-cli` instead. [Migration](#migrate-to-cli-plugin)
9393
- `@tauri-apps/api/clipboard` module removed. Use `@tauri-apps/plugin-clipboard` instead. [Migration](#migrate-to-clipboard-plugin)
9494
- `@tauri-apps/api/dialog` module removed. Use `@tauri-apps/plugin-dialog` instead. [Migration](#migrate-to-dialog-plugin)
@@ -100,72 +100,41 @@ The `@tauri-apps/api` package no longer provides non-core modules. Only the `tau
100100
- `@tauri-apps/api/process` module removed. Use `@tauri-apps/plugin-process` instead. [Migration](#migrate-to-process-plugin)
101101
- `@tauri-apps/api/shell` module removed. Use `@tauri-apps/plugin-shell` instead. [Migration](#migrate-to-shell-plugin)
102102
- `@tauri-apps/api/updater` module removed. Use `@tauri-apps/plugin-updater` instead [Migration](#migrate-to-updater-plugin)
103-
- `@tauri-apps/api/window` module removed. Use `@tauri-apps/plugin-window` instead [Migration](#migrate-to-window-plugin)
103+
104+
### Environment Variables Changes
105+
106+
Most of the environment variables read and written by the Tauri CLI were renamed for consistency and prevention of mistakes:
107+
108+
- `TAURI_PRIVATE_KEY` -> `TAURI_SIGNING_PRIVATE_KEY`
109+
- `TAURI_KEY_PASSWORD` -> `TAURI_SIGNING_PRIVATE_KEY_PASSWORD`
110+
- `TAURI_SKIP_DEVSERVER_CHECK` -> `TAURI_CLI_NO_DEV_SERVER_WAIT`
111+
- `TAURI_DEV_SERVER_PORT` -> `TAURI_CLI_PORT`
112+
- `TAURI_PATH_DEPTH` -> `TAURI_CLI_CONFIG_DEPTH`
113+
- `TAURI_FIPS_COMPLIANT` -> `TAURI_BUNDLER_WIX_FIPS_COMPLIANT`
114+
- `TAURI_DEV_WATCHER_IGNORE_FILE` -> `TAURI_CLI_WATCHER_IGNORE_FILENAME`
115+
- `TAURI_TRAY` -> `TAURI_LINUX_AYATANA_APPINDICATOR`
116+
- `TAURI_APPLE_DEVELOPMENT_TEAM` -> `APPLE_DEVELOPMENT_TEAM`
117+
- `TAURI_PLATFORM` -> `TAURI_ENV_PLATFORM`
118+
- `TAURI_ARCH` -> `TAURI_ENV_ARCH`
119+
- `TAURI_FAMILY` -> `TAURI_ENV_FAMILY`
120+
- `TAURI_PLATFORM_VERSION` -> `TAURI_ENV_PLATFORM_VERSION`
121+
- `TAURI_PLATFORM_TYPE` -> `TAURI_ENV_PLATFORM_TYPE`
122+
- `TAURI_DEBUG` -> `TAURI_ENV_DEBUG`
104123

105124
## Detailed Migration Steps
106125

107126
Common scenarios you may encounter when migrating your Tauri 1.0 app to Tauri 2.0.
108127

109-
### Migrate to App Plugin
110-
111-
The JavaScript `@tauri-apps/api/app` APIs have been removed. Use the `@tauri-apps/plugin-app` plugin instead:
112-
113-
1. Add to cargo dependencies:
114-
115-
```toml
116-
# Cargo.toml
117-
[dependencies]
118-
tauri-plugin-app = "2"
119-
```
120-
121-
2. Use in JavaScript or Rust project:
122-
123-
<Tabs>
124-
<TabItem label="JavaScript">
125-
126-
```rust
127-
fn main() {
128-
tauri::Builder::default()
129-
.plugin(tauri_plugin_app::init())
130-
}
131-
```
132-
133-
```json
134-
// package.json
135-
{
136-
"dependencies": {
137-
"@tauri-apps/plugin-app": "^2.0.0"
138-
}
139-
}
140-
```
141-
142-
```js
143-
import { show, hide } from '@tauri-apps/plugin-app';
144-
await hide();
145-
await show();
146-
```
128+
### Migrate to Primitives Module
147129

148-
</TabItem>
149-
<TabItem label="Rust">
130+
The `@tauri-apps/api/tauri` module was renamed to `@tauri-apps/api/primitives`.
131+
Simply rename the module import:
150132

151-
```rust
152-
fn main() {
153-
tauri::Builder::default()
154-
.plugin(tauri_plugin_app::init())
155-
.setup(|app| {
156-
#[cfg(target_os = "macos")]
157-
{
158-
app.hide()?;
159-
app.show()?;
160-
}
161-
Ok(())
162-
})
163-
}
133+
```diff
134+
- import { invoke } from "@tauri-apps/api/tauri"
135+
+ import { invoke } from "@tauri-apps/api/primitives"
164136
```
165137

166-
</TabItem>
167-
</Tabs>
168-
169138
### Migrate to CLI Plugin
170139

171140
The Rust `App::get_cli_matches` JavaScript `@tauri-apps/api/cli` APIs have been removed. Use the `@tauri-apps/plugin-cli` plugin instead:
@@ -1072,64 +1041,6 @@ fn main() {
10721041
</TabItem>
10731042
</Tabs>
10741043

1075-
### Migrate to Window Plugin
1076-
1077-
The Rust `tauri::window` JavaScript `@tauri-apps/api/window` APIs have been removed. Use the `@tauri-apps/plugin-window` plugin instead:
1078-
1079-
1. Add to cargo dependencies:
1080-
1081-
```toml
1082-
# Cargo.toml
1083-
[dependencies]
1084-
tauri-plugin-window = "2"
1085-
```
1086-
1087-
2. Use in JavaScript or Rust project:
1088-
1089-
<Tabs>
1090-
<TabItem label="JavaScript">
1091-
1092-
```rust
1093-
fn main() {
1094-
tauri::Builder::default()
1095-
.plugin(tauri_plugin_window::init())
1096-
}
1097-
```
1098-
1099-
```json
1100-
// package.json
1101-
{
1102-
"dependencies": {
1103-
"@tauri-apps/plugin-window": "^2.0.0"
1104-
}
1105-
}
1106-
```
1107-
1108-
```js
1109-
import { appWindow } from '@tauri-apps/plugin-window';
1110-
await appWindow.setTitle('Tauri');
1111-
```
1112-
1113-
</TabItem>
1114-
<TabItem label="Rust">
1115-
1116-
```rust
1117-
use tauri::Manager;
1118-
1119-
fn main() {
1120-
tauri::Builder::default()
1121-
.plugin(tauri_plugin_window::init())
1122-
.setup(|app| {
1123-
let window = app.get_window("main").unwrap();
1124-
window.set_title("Tauri")?;
1125-
Ok(())
1126-
})
1127-
}
1128-
```
1129-
1130-
</TabItem>
1131-
</Tabs>
1132-
11331044
### Migrate Path to Tauri Manager
11341045

11351046
The Rust `tauri::api::path` module functions and `tauri::PathResolver` have been moved to `tauri::Manager::path`:

0 commit comments

Comments
 (0)