pear-electron 1.3.13 → 1.3.15

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/package.json +16 -4
  2. package/runtime.js +16 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-electron",
3
- "version": "1.3.13",
3
+ "version": "1.3.15",
4
4
  "description": "Pear User-Interface Library for Electron",
5
5
  "main": "index.js",
6
6
  "bin": "bin.js",
@@ -19,16 +19,28 @@
19
19
  ],
20
20
  "pear": {
21
21
  "name": "pear-electron",
22
- "bootstrap": "pear://0.2599.yceb7sjhgfzsnza7oc38hy3oxu9dhnywi3mzxdm9ubc48kjnxqgo",
22
+ "bootstrap": "pear://0.2614.yceb7sjhgfzsnza7oc38hy3oxu9dhnywi3mzxdm9ubc48kjnxqgo",
23
23
  "stage": {
24
24
  "skipWarmup": "true",
25
25
  "only": [
26
26
  "boot.bundle",
27
27
  "by-arch",
28
- "prebuilds"
28
+ "CHANGELOG.md",
29
+ "prebuilds",
30
+ "template"
29
31
  ]
30
32
  }
31
33
  },
34
+ "standard": {
35
+ "globals": [
36
+ "Bare",
37
+ "Pear",
38
+ "LOG"
39
+ ],
40
+ "ignore": [
41
+ "template"
42
+ ]
43
+ },
32
44
  "keywords": [
33
45
  "pear",
34
46
  "runtime",
@@ -51,7 +63,7 @@
51
63
  "iambus": "^1.0.3",
52
64
  "localdrive": "^1.12.1",
53
65
  "paparam": "^1.6.1",
54
- "pear-api": "^1.11.5",
66
+ "pear-api": "^1.13.0",
55
67
  "pear-ipc": "^6.1.0",
56
68
  "script-linker": "^2.5.3",
57
69
  "streamx": "^2.20.2",
package/runtime.js CHANGED
@@ -12,7 +12,7 @@ const constants = require('pear-api/constants')
12
12
  const parseLink = require('pear-api/parse-link')
13
13
  const Logger = require('pear-api/logger')
14
14
  const { ERR_INVALID_INPUT, ERR_INVALID_APPLING } = require('pear-api/errors')
15
- const { ansi, byteSize, byteDiff, outputter } = require('pear-api/terminal')
15
+ const { ansi, byteSize, indicator, outputter } = require('pear-api/terminal')
16
16
  const run = require('pear-api/cmd/run')
17
17
  const pear = require('pear-api/cmd')
18
18
  const pkg = require('./package.json')
@@ -56,11 +56,14 @@ class PearElectron {
56
56
  }
57
57
  }
58
58
  return {
59
- dumping: ({ link, dir }) => 'Syncing runtime from peers\nfrom: ' + link + '\ninto: ' + dir + '\n',
60
- byteDiff,
61
- file: ({ key }) => key,
62
- complete: () => 'Asset fetch complete',
63
- error: (err) => `Asset fetch Failure (code: ${err.code || 'none'}) ${err.stack}`
59
+ dumping: ({ link, dir }) => this.LOG.format('INF', 'Syncing runtime from peers\nfrom: ' + link + '\ninto: ' + dir + '\n'),
60
+ byteDiff: ({ type, sizes, message }) => {
61
+ sizes = sizes.map((size) => (size > 0 ? '+' : '') + byteSize(size)).join(', ')
62
+ return this.LOG.format('INF', indicator(type, 'diff') + ' ' + message + ' (' + sizes + ')')
63
+ },
64
+ file: ({ key }) => this.LOG.format('INF', key),
65
+ complete: () => this.LOG.format('INF', 'Asset fetch complete'),
66
+ error: (err) => this.LOG.format('INF', `Asset fetch Failure (code: ${err.code || 'none'}) ${err.stack}`)
64
67
  }
65
68
  }
66
69
 
@@ -79,6 +82,7 @@ class PearElectron {
79
82
  }
80
83
 
81
84
  async start (opts = {}) {
85
+ this.LOG.info('Fetching asset & determining bin path')
82
86
  this.bin = await this.#asset(opts)
83
87
  // if disk tampered then resync:
84
88
  if (fs.existsSync(this.bin) === false) this.bin = await this.#asset(opts, true)
@@ -133,16 +137,21 @@ class PearElectron {
133
137
  }
134
138
  let sp = null
135
139
  if (args.appling) {
140
+ this.LOG.info('Spawning UI (appling)')
136
141
  const { appling } = args
137
142
  const applingApp = isMac ? appling.split('.app')[0] + '.app' : appling
138
143
  if (fs.existsSync(applingApp) === false) throw ERR_INVALID_APPLING('Appling does not exist')
139
144
  if (isMac) sp = spawn('open', [applingApp, '--args', ...argv], options)
140
145
  else sp = spawn(applingApp, argv, options)
141
146
  } else {
147
+ this.LOG.info('Spawning UI (asset)')
142
148
  sp = spawn(this.bin, argv, options)
143
149
  }
144
150
 
145
- sp.on('exit', (code) => { Pear.exitCode = code })
151
+ sp.on('exit', (code) => {
152
+ this.LOG.info('UI exited with code', code)
153
+ Pear.exitCode = code
154
+ })
146
155
 
147
156
  const pipe = sp.stdio[3]
148
157