pear-mobile 2.0.1 → 3.0.0
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/README.md +4 -4
- package/index.js +3 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -18,11 +18,11 @@ This boilerplate is MVP and Experimental.
|
|
|
18
18
|
|
|
19
19
|
```js
|
|
20
20
|
const PearRuntime = require('pear-mobile')
|
|
21
|
-
const { version, upgrade } = require('./package.json')
|
|
21
|
+
const { version, upgrade, productName, name } = require('./package.json')
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const app = productName ?? name
|
|
24
24
|
|
|
25
|
-
const runtime = new PearRuntime({ version, upgrade,
|
|
25
|
+
const runtime = new PearRuntime({ version, upgrade, app })
|
|
26
26
|
runtime.updater.on('updated', async () => {
|
|
27
27
|
await runtime.updater.applyUpdate()
|
|
28
28
|
conosle.log('restart for update')
|
|
@@ -66,7 +66,7 @@ Suggested storage folder for app storage.
|
|
|
66
66
|
|
|
67
67
|
Instance of [pear-runtime-updater](https://www.github.com/holepunchto/pear-runtime-updater)
|
|
68
68
|
|
|
69
|
-
#### `await
|
|
69
|
+
#### `await pear.ready()`
|
|
70
70
|
|
|
71
71
|
Awaits the open of the updater (p2p connections, drive open ...)
|
|
72
72
|
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ const PearRuntimeUpdater = require('pear-runtime-updater')
|
|
|
2
2
|
const ReadyResouce = require('ready-resource')
|
|
3
3
|
const path = require('bare-path')
|
|
4
4
|
const dir = require('bare-storage')
|
|
5
|
+
const fs = require('bare-fs')
|
|
5
6
|
|
|
6
7
|
module.exports = class PearRuntime extends ReadyResouce {
|
|
7
8
|
constructor(opts = {}) {
|
|
@@ -13,7 +14,8 @@ module.exports = class PearRuntime extends ReadyResouce {
|
|
|
13
14
|
this.dir = opts.dir
|
|
14
15
|
this.storage = opts.storage || path.join(this.dir, 'app-storage')
|
|
15
16
|
|
|
16
|
-
const appPath = path.join(opts.dir, 'pear-runtime', '
|
|
17
|
+
const appPath = path.join(opts.dir, 'pear-runtime', 'ota')
|
|
18
|
+
if (!fs.existsSync(appPath)) fs.mkdirSync(appPath, { recursive: true, force: true })
|
|
17
19
|
this.updater = new PearRuntimeUpdater({ ...opts, app: appPath })
|
|
18
20
|
}
|
|
19
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pear-mobile",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Embeddable Pear runtime for mobile applications",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"prettier-config-holepunch": "^2.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"bare-fs": "^4.5.5",
|
|
41
42
|
"bare-path": "^3.0.0",
|
|
42
43
|
"bare-storage": "^1.0.1",
|
|
43
44
|
"pear-runtime-updater": "^1.0.0",
|