pear-mobile 1.0.1 → 2.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 +3 -2
- package/index.js +5 -9
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -50,10 +50,11 @@ For end-to-end instructions from building to deploying with [Pear](https://docs.
|
|
|
50
50
|
|
|
51
51
|
Create a runtime. `opts` may include:
|
|
52
52
|
|
|
53
|
-
- **`dir`**
|
|
53
|
+
- **`dir`** Directory to store data (e.g. app data dir). Defaults to `/Documents`.
|
|
54
54
|
- **`upgrade`** – (required) Pear link for OTA updates (e.g. from `package.json` `upgrade` field).
|
|
55
|
+
- **`app`** – (required) The package.json prductName or name of the app. required for `applyUpdate()` to swap in the new build.
|
|
56
|
+
- **`name`** - The package.json prductName or name of the app.
|
|
55
57
|
- **`version`** – Current app version (e.g. from `package.json`); used for update checks.
|
|
56
|
-
- **`app`** – Path to the native boot bundle override; required for `applyUpdate()` to swap in the new build. Defaults to `path/to/Documents/pear-runtime/upgrades`
|
|
57
58
|
- **`updates`** – Set to `false` to disable P2P OTA updates.
|
|
58
59
|
- **`storage`** – Saves the app storage path.
|
|
59
60
|
|
package/index.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
const PearRuntimeUpdater = require('pear-runtime-updater')
|
|
2
2
|
const ReadyResouce = require('ready-resource')
|
|
3
3
|
const path = require('bare-path')
|
|
4
|
-
const fs = require('bare-fs')
|
|
5
4
|
const dir = require('bare-storage')
|
|
6
5
|
|
|
7
6
|
module.exports = class PearRuntime extends ReadyResouce {
|
|
8
7
|
constructor(opts = {}) {
|
|
9
8
|
super()
|
|
9
|
+
opts.name = opts.name || opts.app
|
|
10
|
+
if (!opts.name) throw new Error('need to pass name or app')
|
|
10
11
|
if (!opts.dir) opts.dir = dir.persistent()
|
|
11
|
-
|
|
12
|
-
if (!fs.existsSync(appPath)) fs.mkdirSync(appPath, { recursive: true, force: true })
|
|
13
|
-
if (fs.existsSync(path.join(appPath, 'package.json'))) {
|
|
14
|
-
const manifest = fs.readFileSync(path.join(appPath, 'package.json'))
|
|
15
|
-
opts.version = JSON.parse(manifest).version
|
|
16
|
-
}
|
|
17
|
-
opts = { app: appPath, ...opts }
|
|
12
|
+
|
|
18
13
|
this.dir = opts.dir
|
|
19
14
|
this.storage = opts.storage || path.join(this.dir, 'app-storage')
|
|
20
15
|
|
|
21
|
-
|
|
16
|
+
const appPath = path.join(opts.dir, 'pear-runtime', 'upgrade')
|
|
17
|
+
this.updater = new PearRuntimeUpdater({ ...opts, app: appPath })
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
async _open() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pear-mobile",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Embeddable Pear runtime for mobile applications",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -38,10 +38,9 @@
|
|
|
38
38
|
"prettier-config-holepunch": "^2.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"bare-fs": "^4.5.4",
|
|
42
41
|
"bare-path": "^3.0.0",
|
|
43
42
|
"bare-storage": "^1.0.1",
|
|
44
|
-
"pear-runtime-updater": "
|
|
43
|
+
"pear-runtime-updater": "file:../pear-runtime-updater/pear-runtime-updater-0.0.14.tgz",
|
|
45
44
|
"ready-resource": "^1.2.0"
|
|
46
45
|
}
|
|
47
46
|
}
|