pear-runtime-updater 0.0.12 → 0.0.14
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 +8 -17
- package/package.json +1 -2
package/index.js
CHANGED
|
@@ -8,8 +8,7 @@ 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
|
|
12
|
-
const { platform, arch, isWindows } = require('which-runtime')
|
|
11
|
+
const { platform, arch } = require('which-runtime')
|
|
13
12
|
const isMobile = platform === 'ios' || platform === 'android'
|
|
14
13
|
const host = platform + '-' + arch
|
|
15
14
|
|
|
@@ -32,15 +31,17 @@ module.exports = class PearRuntime extends ReadyResource {
|
|
|
32
31
|
this.length = upgrade.length || 0
|
|
33
32
|
this.fork = upgrade.fork || 0
|
|
34
33
|
this.link = link.serialize({ drive: { fork: this.fork, length: this.length, key: this.key } })
|
|
34
|
+
this.store = new Corestore(path.join(this.dir, 'pear-runtime/corestore'))
|
|
35
|
+
this.drive = new Hyperdrive(this.store, this.key)
|
|
35
36
|
} else {
|
|
36
37
|
this.key = null
|
|
37
38
|
this.length = null
|
|
38
39
|
this.fork = null
|
|
39
40
|
this.link = null
|
|
41
|
+
this.store = null
|
|
42
|
+
this.drive = null
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
this.store = null
|
|
43
|
-
this.drive = null
|
|
44
45
|
this.swarm = null
|
|
45
46
|
this.next = null
|
|
46
47
|
this.checkout = null
|
|
@@ -51,11 +52,7 @@ module.exports = class PearRuntime extends ReadyResource {
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
async _open() {
|
|
54
|
-
if (!this.
|
|
55
|
-
if (this.store === null) {
|
|
56
|
-
this.store = new Corestore(path.join(this.dir, 'pear-runtime/corestore'))
|
|
57
|
-
}
|
|
58
|
-
if (this.drive === null) this.drive = new Hyperdrive(this.store, this.key)
|
|
55
|
+
if (!this.updates) return
|
|
59
56
|
await this.drive.ready()
|
|
60
57
|
|
|
61
58
|
if (this.bundled) {
|
|
@@ -93,14 +90,8 @@ module.exports = class PearRuntime extends ReadyResource {
|
|
|
93
90
|
|
|
94
91
|
// mac only for now, linux similar, windows, more pain
|
|
95
92
|
const segments = [this.next, 'by-arch', host, 'app']
|
|
96
|
-
if (!isMobile
|
|
97
|
-
|
|
98
|
-
const manager = new MSIXManager()
|
|
99
|
-
const msix = this.name.slice(0, -3) + 'msix'
|
|
100
|
-
await manager.addPackage(...segments, msix)
|
|
101
|
-
} else {
|
|
102
|
-
await fsx.swap(path.join(...segments), this.app)
|
|
103
|
-
}
|
|
93
|
+
if (!isMobile) segments.push(this.name)
|
|
94
|
+
await fsx.swap(path.join(...segments), this.app)
|
|
104
95
|
await fs.promises.rm(this.next, { recursive: true, force: true })
|
|
105
96
|
}
|
|
106
97
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pear-runtime-updater",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Listens for OTA Pear App updates",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Holepunch Inc",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"hyperdrive": "^13.2.1",
|
|
42
42
|
"hyperswarm": "^4.16.0",
|
|
43
43
|
"localdrive": "^2.2.0",
|
|
44
|
-
"msix-manager": "^0.1.1",
|
|
45
44
|
"pear-link": "^4.2.1",
|
|
46
45
|
"ready-resource": "^1.2.0",
|
|
47
46
|
"which-runtime": "^1.3.2"
|