pear-runtime-updater 1.0.1 → 1.1.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.
Files changed (2) hide show
  1. package/index.js +4 -2
  2. package/package.json +22 -5
package/index.js CHANGED
@@ -23,7 +23,9 @@ module.exports = class PearRuntime extends ReadyResource {
23
23
  this.app = opts.app
24
24
  this.name = opts.name ?? (this.app && path.basename(this.app))
25
25
  if (isWindows) this.name = path.basename(this.name, path.extname(this.name)) + '.msix'
26
+ this.bootstrap = opts.bootstrap
26
27
  this.bundled = opts.bundled || !!this.app
28
+ this.win32RestartAfterUpdate = opts.win32 && opts.win32.restart
27
29
 
28
30
  if (this.updates) {
29
31
  const { drive: upgrade } = link.parse(opts.upgrade)
@@ -63,7 +65,7 @@ module.exports = class PearRuntime extends ReadyResource {
63
65
 
64
66
  if (!this.swarm) {
65
67
  const keyPair = await this.store.createKeyPair('pear-container')
66
- this.swarm = new Hyperswarm({ keyPair })
68
+ this.swarm = new Hyperswarm({ keyPair, bootstrap: this.bootstrap })
67
69
  }
68
70
 
69
71
  this.swarm.on('connection', (connection) => this.store.replicate(connection))
@@ -94,7 +96,7 @@ module.exports = class PearRuntime extends ReadyResource {
94
96
  if (isWindows) {
95
97
  const MSIXManager = require('msix-manager') // require must be here for platform compatibility
96
98
  const manager = new MSIXManager()
97
- await manager.addPackage(nextApp)
99
+ await manager.addPackage(nextApp, { restartOnUpdate: this.win32RestartAfterUpdate })
98
100
  } else {
99
101
  await fsx.swap(nextApp, this.app)
100
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-runtime-updater",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Listens for OTA Pear App updates",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Holepunch Inc",
@@ -19,8 +19,10 @@
19
19
  ],
20
20
  "scripts": {
21
21
  "format": "prettier . --write",
22
- "test": "prettier . --check && lunte",
23
- "lint": "lunte"
22
+ "test": "npm run test:node && npm run test:bare",
23
+ "test:node": "brittle-node test/updates.test.js",
24
+ "test:bare": "brittle-bare test/updates.test.js",
25
+ "lint": "prettier --check . && lunte"
24
26
  },
25
27
  "imports": {
26
28
  "fs": {
@@ -30,6 +32,14 @@
30
32
  "path": {
31
33
  "bare": "bare-path",
32
34
  "default": "path"
35
+ },
36
+ "os": {
37
+ "bare": "bare-os",
38
+ "default": "os"
39
+ },
40
+ "child_process": {
41
+ "bare": "bare-subprocess",
42
+ "default": "child_process"
33
43
  }
34
44
  },
35
45
  "dependencies": {
@@ -41,14 +51,21 @@
41
51
  "hyperdrive": "^13.2.1",
42
52
  "hyperswarm": "^4.16.0",
43
53
  "localdrive": "^2.2.0",
44
- "msix-manager": "^0.1.1",
54
+ "msix-manager": "^0.1.2",
45
55
  "pear-link": "^4.2.1",
46
56
  "ready-resource": "^1.2.0",
47
57
  "which-runtime": "^1.3.2"
48
58
  },
49
59
  "devDependencies": {
60
+ "@hyperswarm/testnet": "^3.1.4",
61
+ "bare-env": "^3.0.0",
62
+ "bare-os": "^3.7.0",
63
+ "bare-subprocess": "^5.2.2",
64
+ "brittle": "^3.19.1",
50
65
  "lunte": "^1.6.0",
66
+ "pear-build": "^0.2.0",
51
67
  "prettier": "^3.8.1",
52
- "prettier-config-holepunch": "^2.0.0"
68
+ "prettier-config-holepunch": "^2.0.0",
69
+ "test-tmp": "^1.4.0"
53
70
  }
54
71
  }