This repository has been archived by the owner on Jul 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
gulpfile.js
84 lines (76 loc) · 2.14 KB
/
gulpfile.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
var gulp = require('gulp');
var zip = require('gulp-zip');
var del = require('del');
var babel = require('gulp-babel');
var clear = require('clear');
var exec = require('child_process').exec;
gulp.task('package', ()=> {
return gulp.src('./IcingTaskManager@json/**/**/*')
.pipe(zip('ITM-dist-' + Date.now() + '.zip'))
.pipe(gulp.dest('./builds'));
});
gulp.task('copy', ()=> {
del.sync(['./IcingTaskManager@json/**/**/*']);
return gulp.src('./src/**/**/*')
.pipe(gulp.dest('./IcingTaskManager@json/'));
});
gulp.task('transpile', ['copy'], () =>
gulp.src('./src/*.js')
.pipe(babel({
presets: [
'es2015',
'mozjs24'
],
plugins: [
[
'transform-es2015-classes',
{
loose: true
}
],
[
'babel-plugin-transform-builtin-extend',
{
globals: ['Error', 'Array', 'Set', 'Object'],
approximate: false
}
],
'transform-es2015-parameters',
'transform-es2015-destructuring'
],
ignore: [
'./src/lodash.js'
]
}))
.pipe(gulp.dest('IcingTaskManager@json'))
);
gulp.task('install', ['transpile'], (cb)=>{
exec('cp -avrf IcingTaskManager@json ~/.local/share/cinnamon/applets/', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
})
gulp.task('reload', ['install'], (cb)=>{
exec(`dbus-send --session --dest=org.Cinnamon.LookingGlass --type=method_call /org/Cinnamon/LookingGlass org.Cinnamon.LookingGlass.ReloadExtension string:'IcingTaskManager@json' string:'APPLET'`, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
})
gulp.task('watch', ()=> {
gulp.watch('./src/*.{js,json,py,css,md,po}', ['reload']);
});
gulp.task('clear-terminal', ()=> {
clear();
});
gulp.task('spawn-watch', ['clear-terminal'], ()=> {
var spawnWatch = ()=> {
var proc = require('child_process').spawn('gulp', ['watch'], {stdio: 'inherit'});
proc.on('close', function (code) {
spawnWatch();
});
};
spawnWatch();
});
gulp.task('default', ['spawn-watch'], ()=> {});