This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgulpfile.js
95 lines (85 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
85
86
87
88
89
90
91
92
93
94
95
const del = require('del');
const gulp = require('gulp');
const rename = require('gulp-rename');
const runSeq = require('run-sequence');
const typescript = require('gulp-typescript');
const webpack = require('webpack-stream');
const sass = require('gulp-sass');
const ENV = process.env.NODE_ENV || 'production';
/**
* Clean Task
*
* Clean up old build. Nice and clean.
*/
gulp.task('clean', () => del(['./app.js', './main.js']));
/**
* Main Task
*
* Build the main file for Electron
*/
gulp.task('main', () =>
{
var tsProject = typescript.createProject('tsconfig.main.json');
var res = gulp.src('src/js/Main.ts')
.pipe(tsProject());
return res.js
.pipe(rename('main.js'))
.pipe(gulp.dest('./'));
});
/**
* Bundle Task
*
* Bundle our application in to a single file.
*/
gulp.task('bundle', () =>
{
var webpackConfig = ENV === 'production'
? './webpack.config.js'
: './webpack.dev.config.js';
return gulp.src('./src/js/App.ts')
.pipe(webpack(require(webpackConfig)))
.pipe(gulp.dest('./'));
});
/*
* Styles Task
*
* Use Node Sass to build our main stylesheet
*/
gulp.task('styles', () =>
{
return gulp.src('./src/scss/hawkeye.scss')
.pipe(sass({
outputStyle : 'compressed',
includePaths : [
'./node_modules/compass-mixins/lib'
]
}).on('err', sass.logError))
.pipe(gulp.dest('./'));
});
/*
* Default Config Task
*
* This is for CI builds to test a project can build
*/
gulp.task('configdefault', () =>
{
return gulp.src('./src/js/Config/HawkEye.default.ts')
.pipe(rename('HawkEye.ts'))
.pipe(gulp.dest('./src/js/Config'));
});
/**
* Default Task
*
* Do all the things.
*/
gulp.task('default', cb => runSeq('clean', 'main', 'bundle', 'styles', cb));
/**
* Watch Task
*
* Watch for changes
*/
gulp.task('watch', () =>
{
gulp.watch('./src/js/**/*', {}, () => gulp.start('default'));
gulp.watch('./src/scss/**/*.scss', {}, () => gulp.start('styles'));
});