@juit/capacitor-updater 0.0.6 → 0.1.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 +3 -6
- package/dist/index.d.ts +16 -16
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -57,12 +57,9 @@ When successful, this function will asynchronously return a callback
|
|
|
57
57
|
`() => Promise<void>` that needs to be invoked to reload the web view with the
|
|
58
58
|
updated contents.
|
|
59
59
|
|
|
60
|
-
If
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
In case of errors during downloading or unzipping, this function will throw an
|
|
65
|
-
error asynchronously (returning a rejected promise).
|
|
60
|
+
If the update could not be performed (either due to live-reload in Capacitor or
|
|
61
|
+
when on the web) or in case of errors during downloading or unzipping, this
|
|
62
|
+
function will throw an error asynchronously (returning a rejected promise).
|
|
66
63
|
|
|
67
64
|
#### `persistUpdates()`
|
|
68
65
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* Update Capactitor contents by downloading and unzipping the specified URL.
|
|
3
3
|
*
|
|
4
4
|
* @param url - The URL to download the update from.
|
|
5
|
-
* @returns A function that will reload the WebView with the new contents
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* @returns A function that will reload the WebView with the new contents.
|
|
6
|
+
* @throws If the update fails for any reason (platform is not native, using
|
|
7
|
+
* "live reload", update fails to download, read, extract, write, ...)
|
|
8
8
|
*/
|
|
9
|
-
export declare function updateCapacitor(url: string | URL): Promise<(
|
|
9
|
+
export declare function updateCapacitor(url: string | URL): Promise<() => Promise<void>>;
|
|
10
10
|
/**
|
|
11
11
|
* Update Capactitor contents by downloading and unzipping the specified URL.
|
|
12
12
|
*
|
|
13
13
|
* @param url - The URL to download the update from.
|
|
14
14
|
* @param verbose - Log the progress of the update (default: `false`).
|
|
15
|
-
* @returns A function that will reload the WebView with the new contents
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* @returns A function that will reload the WebView with the new contents.
|
|
16
|
+
* @throws If the update fails for any reason (platform is not native, using
|
|
17
|
+
* "live reload", update fails to download, read, extract, write, ...)
|
|
18
18
|
*/
|
|
19
|
-
export declare function updateCapacitor(url: string | URL, verbose: boolean): Promise<(
|
|
19
|
+
export declare function updateCapacitor(url: string | URL, verbose: boolean): Promise<() => Promise<void>>;
|
|
20
20
|
/**
|
|
21
21
|
* Update Capactitor contents by downloading and unzipping the specified URL.
|
|
22
22
|
*
|
|
@@ -25,11 +25,11 @@ export declare function updateCapacitor(url: string | URL, verbose: boolean): Pr
|
|
|
25
25
|
* function will receive a number between 0 and 1; when this
|
|
26
26
|
* number between 0 and 0.5, the update is downloading, and
|
|
27
27
|
* when it's between 0.5 and 1, the update is extracting.
|
|
28
|
-
* @returns A function that will reload the WebView with the new contents
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* @returns A function that will reload the WebView with the new contents.
|
|
29
|
+
* @throws If the update fails for any reason (platform is not native, using
|
|
30
|
+
* "live reload", update fails to download, read, extract, write, ...)
|
|
31
31
|
*/
|
|
32
|
-
export declare function updateCapacitor(url: string | URL, progress: (progress: number) => any): Promise<(
|
|
32
|
+
export declare function updateCapacitor(url: string | URL, progress: (progress: number) => any): Promise<() => Promise<void>>;
|
|
33
33
|
/**
|
|
34
34
|
* Update Capactitor contents by downloading and unzipping the specified URL.
|
|
35
35
|
*
|
|
@@ -39,11 +39,11 @@ export declare function updateCapacitor(url: string | URL, progress: (progress:
|
|
|
39
39
|
* number between 0 and 0.5, the update is downloading, and
|
|
40
40
|
* when it's between 0.5 and 1, the update is extracting.
|
|
41
41
|
* @param verbose - Log the progress of the update (default: `false`).
|
|
42
|
-
* @returns A function that will reload the WebView with the new contents
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* @returns A function that will reload the WebView with the new contents.
|
|
43
|
+
* @throws If the update fails for any reason (platform is not native, using
|
|
44
|
+
* "live reload", update fails to download, read, extract, write, ...)
|
|
45
45
|
*/
|
|
46
|
-
export declare function updateCapacitor(url: string | URL, progress: (progress: number) => any, verbose: boolean): Promise<(
|
|
46
|
+
export declare function updateCapacitor(url: string | URL, progress: (progress: number) => any, verbose: boolean): Promise<() => Promise<void>>;
|
|
47
47
|
/**
|
|
48
48
|
* Persist the current server base path if and only if it is an update path.
|
|
49
49
|
*
|
package/dist/index.js
CHANGED
|
@@ -10,12 +10,10 @@ async function updateCapacitor(url, progressOrVerbose, maybeVerbose) {
|
|
|
10
10
|
const log = verbose ? console.log : () => {
|
|
11
11
|
};
|
|
12
12
|
if (!Capacitor.isNativePlatform()) {
|
|
13
|
-
|
|
14
|
-
return;
|
|
13
|
+
throw new Error("Update is only supported on native platforms");
|
|
15
14
|
}
|
|
16
15
|
if (window.location.protocol !== "capacitor:") {
|
|
17
|
-
|
|
18
|
-
return;
|
|
16
|
+
throw new Error("Update is not supported in Capacitor LiveReload");
|
|
19
17
|
}
|
|
20
18
|
const uuid = crypto.randomUUID();
|
|
21
19
|
const zipFileName = `update-${uuid}.zip`;
|
package/dist/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"mappings": ";AACA,SAAS,WAAW,eAAe;AACnC,SAAS,WAAW,kBAAkB;AACtC,OAAO,WAAW;AAmBlB,IAAM,oBAAoB;AAoD1B,eAAsB,gBAClB,KACA,mBACA,
|
|
4
|
+
"mappings": ";AACA,SAAS,WAAW,eAAe;AACnC,SAAS,WAAW,kBAAkB;AACtC,OAAO,WAAW;AAmBlB,IAAM,oBAAoB;AAoD1B,eAAsB,gBAClB,KACA,mBACA,cAC4B;AAE9B,QAAM,WAAW,OAAO,sBAAsB,aAAa,oBAAoB,MAAM;AAAA,EAAC;AACtF,QAAM,UAAU,OAAO,sBAAsB,YAAY,oBAAoB,CAAC,CAAC;A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,OAAO;AACL,YAAQ,KAAK,qCAAqC,IAAI,GAAG;AACzD,WAAO;AAAA,EACT;AACF;",
|
|
5
5
|
"names": ["data"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juit/capacitor-updater",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Capacitor utility to update an app from a ZIP file",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@capacitor/filesystem": "^7.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@plugjs/build": "^0.6.
|
|
32
|
+
"@plugjs/build": "^0.6.40"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"*.md",
|