pear-runtime-updater 3.0.7 → 3.0.8

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 +10 -2
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -118,8 +118,16 @@ module.exports = class PearRuntimeUpdater extends ReadyResource {
118
118
  const local = new Localdrive(next)
119
119
 
120
120
  const prefix = prefixFor(host, this.name)
121
- const exists = await co.get(prefix)
122
- if (!exists) throw new Error('update not found')
121
+ // Binary may be a file or a directory bundle
122
+ // Entries exist only for files, so try exact path first, then iterate under it
123
+ let hasContent = (await co.entry(prefix)) !== null
124
+ if (!hasContent) {
125
+ for await (const _entry of co.list(prefix)) {
126
+ hasContent = true
127
+ break
128
+ }
129
+ }
130
+ if (!hasContent) throw new Error('update not found')
123
131
  this.updating = true
124
132
  this.emit('updating')
125
133
  for await (const data of co.mirror(local, { prefix })) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-runtime-updater",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "description": "Listens for OTA Pear App updates",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Holepunch Inc",
@@ -20,8 +20,8 @@
20
20
  "scripts": {
21
21
  "format": "prettier . --write",
22
22
  "test": "npm run test:node && npm run test:bare",
23
- "test:node": "brittle-node test/index.test.js",
24
- "test:bare": "brittle-bare test/index.test.js",
23
+ "test:node": "brittle-node test/index.test.js test/e2e.test.js",
24
+ "test:bare": "brittle-bare test/index.test.js test/e2e.test.js",
25
25
  "lint": "prettier --check . && lunte"
26
26
  },
27
27
  "imports": {