-
Notifications
You must be signed in to change notification settings - Fork 484
/
dev.js
65 lines (50 loc) · 1.69 KB
/
dev.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership.
*
* Camunda licenses this file to you under the MIT; you may not use this file
* except in compliance with the MIT License.
*/
const log = require('./app/lib/log')('app:dev');
const { default: installExtension, REACT_DEVELOPER_TOOLS } = require('electron-extension-installer');
const getAppVersion = require('./app/util/get-version');
const AXE_DEVTOOLS = 'lhdoppojpmngadmnindnejefpokejbdd';
// enable development perks
process.env.NODE_ENV = 'development';
// monkey-patch package version to indicate DEV mode in application
const pkg = require('./app/package');
pkg.version = getAppVersion();
// monkey-patch cli args to not open this file in application
process.argv = process.argv.filter(arg => !arg.includes('dev.js'));
const app = require('./app/lib');
// make sure the app quits and does not hang
app.on('before-quit', function() {
app.exit(0);
});
app.on('app:window-created', async () => {
for (const extension of [
REACT_DEVELOPER_TOOLS,
AXE_DEVTOOLS
]) {
try {
const name = await installExtension(extension, {
loadExtensionOptions: {
allowFileAccess: true
}
});
log.info('added extension <%s>', name);
} catch (err) {
log.error('failed to add extension', err);
}
}
});
try {
// reload on changes but ignore client source (we want to watch build dir)
require('electron-reloader')(module, {
ignore: [ 'client/src', 'resources/diagram' ]
});
} catch (err) {
// ignore it
}