-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
74 lines (71 loc) · 2 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
// List all available tasks
const src = 'src';
const dest = 'dist';
const build = 'build';
const path = require('path');
// This is just a random number, so that we try not to pollute the global
// namespace too much.
const schedulerGlobalName = 'sdl1478015358318';
const organiser = require('gulp-organiser');
organiser.registerAll('./gulp-tasks', {
'transpile-to-es5': {
controller: {
src: path.join(src, 'controller.js'),
dest: build,
config: {
moduleName: 'flBooking', // This will be the main module name for the project
},
},
scheduler: {
src: path.join(src, 'scheduler.js'),
dest: build,
config: {
moduleName: schedulerGlobalName,
},
},
},
replace: {
'timekit-booking': {
src: 'lib/timekit-booking/dist/booking.js',
dest: build,
pattern: /var\s+timekit\s+=[^;]+/,
replacement: `var timekit = window["${schedulerGlobalName}"]`,
outputName: 'modified-booking.js',
},
controller: {
src: 'build/controller.js',
dest: build,
pattern: '$$ scheduler id $$',
replacement: schedulerGlobalName,
outputName: 'modified-controller.js',
},
},
'link-dependencies': {
dest: 'lib',
},
concat: {
src: ['build/scheduler.js', 'build/modified-booking.js', 'build/modified-controller.js'],
dest,
fileName: 'fl-booking.js',
},
build: {
src: './',
tasks: ['link-dependencies', 'transpile-to-es5', 'replace', 'concat'],
},
'browser-sync': {
src: '.', // it doesn't matter, it's just so the task object is not ignored.
reloadOn: ['transpile-react'], // reload page when these tasks happen
startPath: 'examples/bookings.html',
baseDir: './',
},
'karma-test': {
src: [
'http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js',
'./dist/fl-booking.js',
'./examples/fake-events-creator.js',
'./tests/*-spec.js',
],
// Whether to close the browser after the tests or not.
singleRun: false,
},
});