pear-runtime-updater 0.0.10 → 0.0.11
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/index.js +10 -3
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -8,7 +8,8 @@ const fsx = require('fs-native-extensions')
|
|
|
8
8
|
const ReadyResource = require('ready-resource')
|
|
9
9
|
const link = require('pear-link')
|
|
10
10
|
const hid = require('hypercore-id-encoding')
|
|
11
|
-
const
|
|
11
|
+
const MSIXManager = require('msix-manager')
|
|
12
|
+
const { platform, arch, isWindows } = require('which-runtime')
|
|
12
13
|
const isMobile = platform === 'ios' || platform === 'android'
|
|
13
14
|
const host = platform + '-' + arch
|
|
14
15
|
|
|
@@ -90,8 +91,14 @@ module.exports = class PearRuntime extends ReadyResource {
|
|
|
90
91
|
|
|
91
92
|
// mac only for now, linux similar, windows, more pain
|
|
92
93
|
const segments = [this.next, 'by-arch', host, 'app']
|
|
93
|
-
if (!isMobile) segments.push(this.name)
|
|
94
|
-
|
|
94
|
+
if (!isMobile && !isWindows) segments.push(this.name)
|
|
95
|
+
if (isWindows) {
|
|
96
|
+
const manager = new MSIXManager()
|
|
97
|
+
const msix = this.name.slice(0, -3) + 'msix'
|
|
98
|
+
await manager.addPackage(...segments, msix)
|
|
99
|
+
} else {
|
|
100
|
+
await fsx.swap(path.join(...segments), this.app)
|
|
101
|
+
}
|
|
95
102
|
await fs.promises.rm(this.next, { recursive: true, force: true })
|
|
96
103
|
}
|
|
97
104
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pear-runtime-updater",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "Listens for OTA Pear App updates",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Holepunch Inc",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"hyperdrive": "^13.2.1",
|
|
42
42
|
"hyperswarm": "^4.16.0",
|
|
43
43
|
"localdrive": "^2.2.0",
|
|
44
|
+
"msix-manager": "^0.1.1",
|
|
44
45
|
"pear-link": "^4.2.1",
|
|
45
46
|
"ready-resource": "^1.2.0",
|
|
46
47
|
"which-runtime": "^1.3.2"
|