pear-runtime-updater 3.0.0 → 3.0.1

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.
Files changed (2) hide show
  1. package/index.js +9 -18
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -26,21 +26,12 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
26
26
  this.bundled = opts.bundled || !!this.app
27
27
  this.win32RestartAfterUpdate = opts.win32 && opts.win32.restart
28
28
 
29
- if (this.updates) {
30
- const { drive: upgrade } = link.parse(opts.upgrade)
31
- this.key = hid.decode(upgrade.key)
32
- this.length = upgrade.length || 0
33
- this.fork = upgrade.fork || 0
34
- this.link = link.serialize({ drive: { fork: this.fork, length: this.length, key: this.key } })
35
- this.drive = new Hyperdrive(this.store, this.key)
36
- } else {
37
- this.key = null
38
- this.length = null
39
- this.fork = null
40
- this.link = null
41
- this.store = null
42
- this.drive = null
43
- }
29
+ const { drive: upgrade } = link.parse(opts.upgrade)
30
+ this.key = hid.decode(upgrade.key)
31
+ this.length = upgrade.length || 0
32
+ this.fork = upgrade.fork || 0
33
+ this.link = link.serialize({ drive: { fork: this.fork, length: this.length, key: this.key } })
34
+ this.drive = new Hyperdrive(this.store, this.key)
44
35
 
45
36
  this.next = null
46
37
  this.checkout = null
@@ -51,8 +42,8 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
51
42
  }
52
43
 
53
44
  async _open() {
54
- if (!this.updates) return
55
45
  await this.drive.ready()
46
+ if (!this.updates) return
56
47
 
57
48
  if (this.bundled) {
58
49
  await fs.promises.rm(path.join(this.dir, 'pear-runtime/next'), {
@@ -66,9 +57,9 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
66
57
  }
67
58
 
68
59
  async _close() {
69
- if (!this.updates) return
70
-
71
60
  await this.drive.close()
61
+
62
+ if (!this.updates) return
72
63
  if (this.checkout !== null) await this.checkout.close()
73
64
  }
74
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-runtime-updater",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Listens for OTA Pear App updates",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Holepunch Inc",