forked from OfficeDev/office-ui-fabric-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
115 lines (96 loc) · 4.06 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
107
108
109
110
111
112
113
114
115
// 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');
//////////////////////////
// BUILD TASKS
//////////////////////////
Plugins.requireDir('../../gulp');
var {buildMessagesFinished, buildMessagesServer, buildMessagesUpdated} = require('./gulp/BuildMessages');
var {documentationBuild,documentationNuke} = require('./gulp/Documentation');
var {fabricBuild, fabricNuke} = require('./gulp/FabricBuild');
var {setDebugMode} = require('./gulp/ConfigureEnvironment')
var {linting} = require('./gulp/Linting');
var {server} = require('./gulp/Server');
//////////////////////////
// MAIN BUILD
//////////////////////////
var build = gulp.parallel(documentationBuild, fabricBuild, linting);
//
// 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
// ---------------------------------------------------------------------------
exports.nuke = gulp.parallel(fabricNuke, documentationNuke)
//
// Watch Tasks
// ----------------------------------------------------------------------------
function watchBuild(done) {
gulp.watch(Config.paths.src + '/**/*', build);
done();
};
exports.watch = gulp.series(build, server, watchBuild, buildMessagesServer);
//
// Debug Tasks
// ---------------------------------------------------------------------------
function watchDebugBuild(done) {
gulp.watch(Config.paths.src + '/**/*', gulp.series(build, buildMessagesUpdated));
done();
};
exports.watchDebug = gulp.series(setDebugMode, build, server, watchDebugBuild, buildMessagesServer);
//
// Check For errors
//
function checkAllErrors(done) {
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);
done();
} else {
done();
}
};
//
// Default Build
// ----------------------------------------------------------------------------
exports.default = gulp.series(build, checkAllErrors, buildMessagesFinished);
//
// Re-Build
// ----------------------------------------------------------------------------
exports.rebuild = gulp.series(build, buildMessagesFinished);
//
// Packaging tasks
// ----------------------------------------------------------------------------
exports.nugetPack = function(callback) {
Plugins.nugetpack(Config.nugetConfig, Config.nugetPaths, callback);
};