pear-mobile 4.0.0 → 4.0.1
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 -5
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,9 +20,7 @@ This boilerplate is MVP and Experimental.
|
|
|
20
20
|
const PearRuntime = require('pear-mobile')
|
|
21
21
|
const { version, upgrade, productName, name } = require('./package.json')
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const runtime = new PearRuntime({ version, upgrade, app })
|
|
23
|
+
const runtime = new PearRuntime({ version, upgrade, name: productName })
|
|
26
24
|
runtime.updater.on('updated', async () => {
|
|
27
25
|
await runtime.updater.applyUpdate()
|
|
28
26
|
conosle.log('restart for update')
|
|
@@ -52,8 +50,8 @@ Create a runtime. `opts` may include:
|
|
|
52
50
|
|
|
53
51
|
- **`dir`** Directory to store data (e.g. app data dir). Defaults to `/Documents`.
|
|
54
52
|
- **`upgrade`** – (required) Pear link for OTA updates (e.g. from `package.json` `upgrade` field).
|
|
55
|
-
- **`
|
|
56
|
-
- **`
|
|
53
|
+
- **`name`** - (required) The package.json prductName of the app.
|
|
54
|
+
- **`app`** – The path to the local OTA react-native bundle as booted from native code. (defaults to [pear-runtime-react-native](https://github.com/holepunchto/pear-runtime-react-native) default)
|
|
57
55
|
- **`version`** – Current app version (e.g. from `package.json`); used for update checks.
|
|
58
56
|
- **`updates`** – Set to `false` to disable P2P OTA updates.
|
|
59
57
|
- **`storage`** – Saves the app storage path.
|
package/index.js
CHANGED
|
@@ -12,7 +12,7 @@ module.exports = class PearRuntime extends ReadyResouce {
|
|
|
12
12
|
this.dir = opts.dir
|
|
13
13
|
this.storage = opts.storage || path.join(this.dir, 'app-storage')
|
|
14
14
|
|
|
15
|
-
const appPath = path.join(opts.dir, 'pear-runtime', 'ota')
|
|
15
|
+
const appPath = opts.app || path.join(opts.dir, 'pear-runtime', 'ota')
|
|
16
16
|
if (!fs.existsSync(appPath)) fs.mkdirSync(appPath, { recursive: true, force: true })
|
|
17
17
|
this.updater = new PearRuntimeUpdater({ ...opts, app: appPath })
|
|
18
18
|
this.updater.on('error', (err) => this.emit('error', err))
|