forked from camunda/camunda-modeler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.js
55 lines (41 loc) · 1.49 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
/**
* 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-devtools-installer');
const getAppVersion = require('./app/util/get-version');
// 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(pkg, {
buildName: 'dev',
increment: true
});
// 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 () => {
try {
const name = await installExtension(REACT_DEVELOPER_TOOLS);
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' ] });
} catch (err) {
// ignore it
}