@tauri-apps/plugin-updater 2.10.1 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -69,6 +69,7 @@ import { relaunch } from '@tauri-apps/plugin-process'
69
69
  const update = await check()
70
70
  if (update) {
71
71
  await update.downloadAndInstall()
72
+ // Relaunch the app on macOS and Linux to run the newly install version
72
73
  await relaunch()
73
74
  }
74
75
  ```
package/dist-js/index.cjs CHANGED
@@ -15,7 +15,7 @@ class Update extends core.Resource {
15
15
  this.body = metadata.body;
16
16
  this.rawJson = metadata.rawJson;
17
17
  }
18
- /** Download the updater package */
18
+ /** Download the updater package. Call {@linkcode install} later to install it */
19
19
  async download(onEvent, options) {
20
20
  convertToRustHeaders(options);
21
21
  const channel = new core.Channel();
@@ -29,19 +29,34 @@ class Update extends core.Resource {
29
29
  });
30
30
  this.downloadedBytes = new core.Resource(downloadedBytesRid);
31
31
  }
32
- /** Install downloaded updater package */
33
- async install() {
32
+ /**
33
+ * Install downloaded updater package. Must be called after {@linkcode download}.
34
+ *
35
+ * ## Platform-specific:
36
+ *
37
+ * - **Windows:** This function exits the app after launching the updater installer successfully
38
+ * - **macOS / Linux:** You need to relaunch the app to run the newly install version
39
+ */
40
+ async install(options) {
34
41
  if (!this.downloadedBytes) {
35
42
  throw new Error('Update.install called before Update.download');
36
43
  }
37
44
  await core.invoke('plugin:updater|install', {
38
45
  updateRid: this.rid,
39
- bytesRid: this.downloadedBytes.rid
46
+ bytesRid: this.downloadedBytes.rid,
47
+ ...options
40
48
  });
41
49
  // Don't need to call close, we did it in rust side already
42
50
  this.downloadedBytes = undefined;
43
51
  }
44
- /** Downloads the updater package and installs it */
52
+ /**
53
+ * Downloads the updater package and installs it
54
+ *
55
+ * ## Platform-specific:
56
+ *
57
+ * - **Windows:** This function exits the app after launching the updater installer successfully
58
+ * - **macOS / Linux:** You need to relaunch the app to run the newly install version
59
+ */
45
60
  async downloadAndInstall(onEvent, options) {
46
61
  convertToRustHeaders(options);
47
62
  const channel = new core.Channel();
@@ -17,10 +17,6 @@ interface CheckOptions {
17
17
  * Target identifier for the running application. This is sent to the backend.
18
18
  */
19
19
  target?: string;
20
- /**
21
- * Allow downgrades to previous versions by not checking if the current version is greater than the available version.
22
- */
23
- allowDowngrades?: boolean;
24
20
  }
25
21
  /** Options used when downloading an update */
26
22
  interface DownloadOptions {
@@ -33,6 +29,13 @@ interface DownloadOptions {
33
29
  */
34
30
  timeout?: number;
35
31
  }
32
+ /** Options used when installing an update */
33
+ interface InstallOptions {
34
+ /**
35
+ * If the Windows installer should restart the app after installed, default is `true`
36
+ */
37
+ restartAfterInstall?: boolean;
38
+ }
36
39
  interface UpdateMetadata {
37
40
  rid: number;
38
41
  currentVersion: string;
@@ -65,12 +68,26 @@ declare class Update extends Resource {
65
68
  rawJson: Record<string, unknown>;
66
69
  private downloadedBytes?;
67
70
  constructor(metadata: UpdateMetadata);
68
- /** Download the updater package */
71
+ /** Download the updater package. Call {@linkcode install} later to install it */
69
72
  download(onEvent?: (progress: DownloadEvent) => void, options?: DownloadOptions): Promise<void>;
70
- /** Install downloaded updater package */
71
- install(): Promise<void>;
72
- /** Downloads the updater package and installs it */
73
- downloadAndInstall(onEvent?: (progress: DownloadEvent) => void, options?: DownloadOptions): Promise<void>;
73
+ /**
74
+ * Install downloaded updater package. Must be called after {@linkcode download}.
75
+ *
76
+ * ## Platform-specific:
77
+ *
78
+ * - **Windows:** This function exits the app after launching the updater installer successfully
79
+ * - **macOS / Linux:** You need to relaunch the app to run the newly install version
80
+ */
81
+ install(options?: InstallOptions): Promise<void>;
82
+ /**
83
+ * Downloads the updater package and installs it
84
+ *
85
+ * ## Platform-specific:
86
+ *
87
+ * - **Windows:** This function exits the app after launching the updater installer successfully
88
+ * - **macOS / Linux:** You need to relaunch the app to run the newly install version
89
+ */
90
+ downloadAndInstall(onEvent?: (progress: DownloadEvent) => void, options?: DownloadOptions & InstallOptions): Promise<void>;
74
91
  close(): Promise<void>;
75
92
  }
76
93
  /** Check for updates, resolves to `null` if no updates are available */
package/dist-js/index.js CHANGED
@@ -13,7 +13,7 @@ class Update extends Resource {
13
13
  this.body = metadata.body;
14
14
  this.rawJson = metadata.rawJson;
15
15
  }
16
- /** Download the updater package */
16
+ /** Download the updater package. Call {@linkcode install} later to install it */
17
17
  async download(onEvent, options) {
18
18
  convertToRustHeaders(options);
19
19
  const channel = new Channel();
@@ -27,19 +27,34 @@ class Update extends Resource {
27
27
  });
28
28
  this.downloadedBytes = new Resource(downloadedBytesRid);
29
29
  }
30
- /** Install downloaded updater package */
31
- async install() {
30
+ /**
31
+ * Install downloaded updater package. Must be called after {@linkcode download}.
32
+ *
33
+ * ## Platform-specific:
34
+ *
35
+ * - **Windows:** This function exits the app after launching the updater installer successfully
36
+ * - **macOS / Linux:** You need to relaunch the app to run the newly install version
37
+ */
38
+ async install(options) {
32
39
  if (!this.downloadedBytes) {
33
40
  throw new Error('Update.install called before Update.download');
34
41
  }
35
42
  await invoke('plugin:updater|install', {
36
43
  updateRid: this.rid,
37
- bytesRid: this.downloadedBytes.rid
44
+ bytesRid: this.downloadedBytes.rid,
45
+ ...options
38
46
  });
39
47
  // Don't need to call close, we did it in rust side already
40
48
  this.downloadedBytes = undefined;
41
49
  }
42
- /** Downloads the updater package and installs it */
50
+ /**
51
+ * Downloads the updater package and installs it
52
+ *
53
+ * ## Platform-specific:
54
+ *
55
+ * - **Windows:** This function exits the app after launching the updater installer successfully
56
+ * - **macOS / Linux:** You need to relaunch the app to run the newly install version
57
+ */
43
58
  async downloadAndInstall(onEvent, options) {
44
59
  convertToRustHeaders(options);
45
60
  const channel = new Channel();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-updater",
3
- "version": "2.10.1",
3
+ "version": "2.12.0",
4
4
  "license": "MIT OR Apache-2.0",
5
5
  "authors": [
6
6
  "Tauri Programme within The Commons Conservancy"
@@ -24,6 +24,6 @@
24
24
  "LICENSE"
25
25
  ],
26
26
  "dependencies": {
27
- "@tauri-apps/api": "^2.10.1"
27
+ "@tauri-apps/api": "^2.11.0"
28
28
  }
29
29
  }