-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.js
49 lines (37 loc) · 976 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict'
try {
const envVars = require('./electronEnv.json')
for (const [key, val] of Object.entries(envVars)) {
if (typeof process.env[key] !== 'undefined') {
continue
}
process.env[key] = val
}
} catch (err) {}
const { app } = require('electron')
require('./src/i18next')
.initI18next()
const isTestEnv = process.env.NODE_ENV === 'test'
const productName = require('./src/helpers/product-name')
app.setName(productName)
process.traceProcessWarnings = true
app.allowRendererProcessReuse = true
require('./src/error-manager')
.initLogger()
const initializeApp = require('./src/initialize-app')
const makeSingleInstance = require('./src/make-single-instance')
const shouldQuit = makeSingleInstance()
if (shouldQuit) {
app.quit()
} else {
;(async () => {
try {
if (isTestEnv) {
require('wdio-electron-service/main')
}
await initializeApp()
} catch (err) {
console.error(err)
}
})()
}