-
Notifications
You must be signed in to change notification settings - Fork 13
/
gulpfile.js
71 lines (56 loc) · 2.45 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
'use strict';
var gulp = require('gulp');
var babel = require("gulp-babel");
var shell = require('gulp-shell')
var sass = require('gulp-sass');
var electron = require('electron-connect').server.create();
var package_info = require('./package.json')
gulp.task('serve', function () {
// Compile
gulp.start('compile');
// Start browser process
electron.start();
// Restart browser process
gulp.watch('main.js', electron.restart);
// Reload renderer process
gulp.watch(['src/**/*.js', 'src/**/*.html', 'src/**/*.scss'], function(){
// Recompile
gulp.start('compile');
electron.reload()
});
});
gulp.task('build-all', shell.task([
'electron-packager . --overwrite --platform=all --arch=all --prune=true --out=release_builds'
]));
gulp.task('build-linux', shell.task([
'electron-packager . --overwrite --platform=linux --icon=assets/icons/icon.xpm --arch=all --prune=true --out=release_builds'
]));
gulp.task('build-mac', shell.task([
'electron-packager . --overwrite --platform=darwin --icon=assets/icons/icon.icns --arch=x64 --prune=true --out=release_builds'
]));
gulp.task('build-windows', shell.task([
'electron-packager . --overwrite --platform=win32 --arch=x64 --prune=true --out=release_builds'
]));
gulp.task('zip', shell.task([
`if [ -d "release_builds/opsdroid-desktop-darwin-x64" ]; then cd release_builds/opsdroid-desktop-darwin-x64 && zip -FSr opsdroid-desktop-v${package_info.version}-macos-x64.zip opsdroid-desktop.app; fi`,
`if [ -d "release_builds/opsdroid-desktop-linux-x64" ]; then cd release_builds/opsdroid-desktop-linux-x64 && tar -cvzf opsdroid-desktop-v${package_info.version}-linux-x64.tar.gz *; fi`,
`if [ -d "release_builds/opsdroid-desktop-linux-ia32" ]; then cd release_builds/opsdroid-desktop-linux-ia32 && tar -cvzf opsdroid-desktop-v${package_info.version}-linux-i386.tar.gz *; fi`,
`if [ -d "release_builds/opsdroid-desktop-linux-armv7l" ]; then cd release_builds/opsdroid-desktop-linux-armv7l && tar -cvzf opsdroid-desktop-v${package_info.version}-linux-armv7l.tar.gz *; fi`
]));
gulp.task('sass', function () {
return gulp.src('./src/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./dist'));
});
gulp.task("babel", function () {
return gulp.src("./src/**/*.js")
.pipe(babel())
.pipe(gulp.dest("./dist"));
});
gulp.task("compile", function() {
// Compile the JavaScript
gulp.start('babel');
// Compile the sass
gulp.start('sass');
})
gulp.task('default', ['serve']);