This repository has been archived by the owner on Mar 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 114
/
gulpfile.js
106 lines (88 loc) · 3.99 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
96
97
98
99
100
101
102
103
104
105
106
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE in the project root for license information.
var gulp = require('gulp');
var Plugins = require('./gulp/modules/Plugins');
var Config = require('./gulp/modules/Config');
var ConsoleHelper = require('./gulp/modules/ConsoleHelper');
var Server = require('./gulp/modules/Server');
var Utilites = require('./gulp/modules/Utilities');
var ErrorHandling = require('./gulp/modules/ErrorHandling');
var BuildConfig = require('./gulp/modules/BuildConfig');
//////////////////////////
// INCLUDE FABRIC TASKS
//////////////////////////
Plugins.requireDir('../../gulp');
//
// Local Server Configuration and Testing Website
// ----------------------------------------------------------------------------
Server.configServer(
Config.port, // Port Number
Config.projectURL, // URL To access the server
Config.projectDirectory // Directory to serve up
);
// Config Paths
Server.serveSpecificPaths(Config.servePaths);
//
// Nuke Tasks
// ---------------------------------------------------------------------------
gulp.task('nuke', BuildConfig.nukeTasks);
//
// Watch Tasks
// ----------------------------------------------------------------------------
gulp.task('watch-build-tasks', BuildConfig.buildTasks);
gulp.task('watch-build', BuildConfig.buildTasks, function () {
return gulp.watch(Config.paths.src + '/**/*', Plugins.batch(function (events, done) {
Plugins.runSequence('watch-build-tasks', done);
}));
});
gulp.task('watch', ['watch-build', 'Server', 'BuildMessages-server']);
// Debug Tasks
gulp.task('watch-debug-build-tasks', BuildConfig.buildTasks);
gulp.task('watch-debug-build', BuildConfig.buildTasks, function () {
return gulp.watch(Config.paths.src + '/**/*', Plugins.batch(function (events, done) {
Plugins.runSequence('watch-debug-build-tasks', 'BuildMessages-updated', done);
}));
});
gulp.task('watch-debug', ['ConfigureEnvironment-setDebugMode', 'Server', 'watch-debug-build', 'BuildMessages-server']);
//
// Check For errors
//
gulp.task('Errors-checkAllErrors', BuildConfig.buildTasks, function() {
var returnFailedBuild = false;
if (ErrorHandling.numberOfErrors() > 0) {
ErrorHandling.generateError("------------------------------------------");
ErrorHandling.generateBuildError("Errors in build, please fix and re build Fabric");
ErrorHandling.showNumberOfErrors(ErrorHandling.numberOfErrors());
ErrorHandling.generateError("------------------------------------------");
ErrorHandling.generateBuildError("Exiting build");
ErrorHandling.generateError("------------------------------------------");
returnFailedBuild = true;
}
if (ErrorHandling.numberOfWarnings() > 0) {
ErrorHandling.generateError("------------------------------------------");
ErrorHandling.generateBuildError("Warnings in build, please fix and re build Fabric");
ErrorHandling.showNumberOfWarnings(ErrorHandling.numberOfWarnings());
ErrorHandling.generateError("------------------------------------------");
ErrorHandling.generateBuildError("Exiting build");
ErrorHandling.generateError("------------------------------------------");
returnFailedBuild = true;
}
if (returnFailedBuild) {
process.exit(1);
} else {
return;
}
});
//
// Default Build
// ----------------------------------------------------------------------------
var buildWithMessages = BuildConfig.buildTasks.concat(['Errors-checkAllErrors', 'BuildMessages-finished']);
gulp.task('build', buildWithMessages);
var rebuildWithMessages = BuildConfig.buildTasks.concat(['BuildMessages-finished']);
gulp.task('re-build', rebuildWithMessages);
gulp.task('default', ['build']);
//
// Packaging tasks
// ----------------------------------------------------------------------------
gulp.task('nuget-pack', function(callback) {
Plugins.nugetpack(Config.nugetConfig, Config.nugetPaths, callback);
});