pear-runtime-updater 3.0.4 → 3.0.6

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 +4 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -85,7 +85,6 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
85
85
 
86
86
  async _update() {
87
87
  if (this.updating || !this.updates) return
88
- this.updating = true
89
88
 
90
89
  await this.drive.update()
91
90
 
@@ -110,7 +109,6 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
110
109
  }
111
110
 
112
111
  if (!remote || current.compare(remote) >= 0) {
113
- this.updating = false
114
112
  this.checkout = null
115
113
  await co.close()
116
114
  if (this.drive.core.length > length) this._updateBackground()
@@ -119,8 +117,11 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
119
117
 
120
118
  const local = new Localdrive(next)
121
119
 
122
- this.emit('updating')
123
120
  const prefix = prefixFor(host, this.name)
121
+ const exists = await co.get(prefix)
122
+ if (!exists) throw new Error('update not found')
123
+ this.updating = true
124
+ this.emit('updating')
124
125
  for await (const data of co.mirror(local, { prefix })) {
125
126
  this.emit('updating-delta', data)
126
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-runtime-updater",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "Listens for OTA Pear App updates",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Holepunch Inc",