pear-runtime-updater 3.0.0 → 3.0.2

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 +11 -21
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -24,23 +24,13 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
24
24
  this.app = opts.app
25
25
  this.name = opts.name
26
26
  this.bundled = opts.bundled || !!this.app
27
- this.win32RestartAfterUpdate = opts.win32 && opts.win32.restart
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
- }
27
+
28
+ const { drive: upgrade } = link.parse(opts.upgrade)
29
+ this.key = hid.decode(upgrade.key)
30
+ this.length = upgrade.length || 0
31
+ this.fork = upgrade.fork || 0
32
+ this.link = link.serialize({ drive: { fork: this.fork, length: this.length, key: this.key } })
33
+ this.drive = new Hyperdrive(this.store, this.key)
44
34
 
45
35
  this.next = null
46
36
  this.checkout = null
@@ -51,8 +41,8 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
51
41
  }
52
42
 
53
43
  async _open() {
54
- if (!this.updates) return
55
44
  await this.drive.ready()
45
+ if (!this.updates) return
56
46
 
57
47
  if (this.bundled) {
58
48
  await fs.promises.rm(path.join(this.dir, 'pear-runtime/next'), {
@@ -66,9 +56,9 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
66
56
  }
67
57
 
68
58
  async _close() {
69
- if (!this.updates) return
70
-
71
59
  await this.drive.close()
60
+
61
+ if (!this.updates) return
72
62
  if (this.checkout !== null) await this.checkout.close()
73
63
  }
74
64
 
@@ -80,7 +70,7 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
80
70
  if (isWindows) {
81
71
  const MSIXManager = require('msix-manager') // require must be here for platform compatibility
82
72
  const manager = new MSIXManager()
83
- await manager.addPackage(nextApp, { restartOnUpdate: this.win32RestartAfterUpdate })
73
+ await manager.addPackage(nextApp)
84
74
  } else {
85
75
  await fsx.swap(nextApp, this.app)
86
76
  }
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.2",
4
4
  "description": "Listens for OTA Pear App updates",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Holepunch Inc",