forked from sidneys/live-wallpaper-ecorp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
111 lines (94 loc) · 2.03 KB
/
gulpfile.babel.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
'use strict';
/**
* Modules
* Node
* @constant
*/
const path = require('path');
/**
* Modules
* Electron
* @constant
*/
const electron = require('electron');
const { app } = electron;
/**
* Modules
* External
* @constant
*/
const appRootPath = require('app-root-path');
const electronConnect = require('electron-connect');
const gulp = require('gulp');
/**
* Modules
* Configuration
*/
appRootPath.setPath(path.join(__dirname));
/**
* Modules
* Internal
* @constant
*/
const packageJson = require(path.join(appRootPath['path'], 'package.json'));
/**
* Filesystem
* @constant
* @default
*/
const applicationPath = path.join(appRootPath['path'], packageJson.main);
/**
* Electron Connect Server
* Init
*/
const electronConnectServer = electronConnect.server.create({
//logLevel: 2,
//verbose: true,
stopOnClose: true,
electron: electron,
path: applicationPath,
useGlobalElectron: false
});
/**
* Electron Connect Server
* Files
*/
let appSources = {
main: [
path.join(appRootPath['path'], 'app', 'fonts', '**', '*.*'),
path.join(appRootPath['path'], 'app', 'html', '**', '*.*'),
path.join(appRootPath['path'], 'app', 'images', '**', '*.*'),
path.join(appRootPath['path'], 'app', 'scripts', 'main', '**', '*.*'),
path.join(appRootPath['path'], 'app', 'styles', '**', '*.*'),
path.join(appRootPath['path'], 'package.json')
],
renderer: [
path.join(appRootPath['path'], 'app', 'scripts', 'renderer', '**', '*.*')
]
};
/**
* Server
* start
*/
gulp.task('livereload', () => {
electronConnectServer.start();
gulp.watch(appSources.main, ['main:restart']);
gulp.watch(appSources.renderer, ['renderer:reload']);
});
/**
* Main Process
* restart
*/
gulp.task('main:restart', (callback) => {
electronConnectServer.restart();
callback();
});
/**
* Renderer Process
* restart
*/
gulp.task('renderer:reload', (callback) => {
electronConnectServer.reload();
callback();
});
gulp.task('default', ['livereload']);