-
Notifications
You must be signed in to change notification settings - Fork 33
/
config.js
85 lines (72 loc) · 1.79 KB
/
config.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
'use strict';
const pkg = require( './app/package.json' );
const getDependencies = require( 'dependency-list' );
const config = {
name : pkg.name,
devtron : true,
eslint : true,
port : 9080,
vueDevTools : false,
build : {
'app-version' : pkg.version,
packagesToBeIncluded : [ 'electron-settings', 'electron-window-state', 'github', 'default-shell', 'child_pty', 'uuid' ],
overwrite : true,
asar : false,
dmg : {
'background-color' : '#E1E1E1',
contents : [
{
x : 485,
y : 240,
type : 'link',
path : '/Applications'
},
{
x : 120,
y : 240,
type : 'file'
}
],
'icon-size' : 100,
window : {
width : 600,
height : 500
}
},
}
};
/**
*
*/
function getPackConfig( callback ) {
let versionMap = getPackageVersionsFromApp( config.build.packagesToBeIncluded );
// that can be prettier
getDependencies( versionMap, ( error, result ) => {
if ( error ) {
return console.error( error );
}
config.build.files = [
'electron.js',
'package.json',
'main/*',
'dist/**/*',
'!node_modules/*',
...Object.keys( result ).map( dep => `node_modules/${ dep }` )
];
callback( null, config );
} );
}
/**
*
*/
function getPackageVersionsFromApp( packages ) {
const appPackageJson = require( './app/package' );
return packages.reduce( ( versionMap, packageName ) => {
versionMap[ packageName ] = appPackageJson.dependencies[ packageName ];
return versionMap;
}, {} );
}
module.exports = {
config : config,
getPackConfig : getPackConfig
};