Skip to content

Commit 4d23b2c

Browse files
committed
switched from grunt to gulp
1 parent 5cfe2c0 commit 4d23b2c

23 files changed

+884
-584
lines changed

Gruntfile.js

-185
This file was deleted.

build.ps1

+4-4
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,17 @@ Function PackageTests()
191191

192192
Function RunGrunt()
193193
{
194-
Write-Host "##teamcity[progressStart 'Running Grunt']"
195-
$gruntPath = [environment]::getfolderpath("applicationdata") + '\npm\node_modules\grunt-cli\bin\grunt'
194+
Write-Host "##teamcity[progressStart 'Running Gulp']"
195+
$gulpPath = '.\node_modules\gulp\bin\gulp'
196196
Invoke-Expression 'npm install'
197197
CheckExitCode
198198

199-
Invoke-Expression ('node ' + $gruntPath + ' packagerjs') -ErrorAction Continue -Verbose
199+
Invoke-Expression ('node ' + $gulpPath + ' build') -ErrorAction Continue -Verbose
200200
CheckExitCode
201201

202202
Remove-Item $outputFolder\UI\build.txt -ErrorAction Continue
203203

204-
Write-Host "##teamcity[progressFinish 'Running Grunt']"
204+
Write-Host "##teamcity[progressFinish 'Running Gulp']"
205205
}
206206

207207
Function CheckExitCode()

gulp/build.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var gulp = require('gulp');
2+
var runSequence = require('run-sequence');
3+
4+
require('./clean');
5+
require('./requirejs');
6+
require('./less');
7+
require('./handlebars');
8+
require('./copy');
9+
10+
gulp.task('build', function () {
11+
return runSequence('clean',
12+
['requireJs', 'less', 'handlebars', 'copyIndex', 'copyContent']);
13+
});

gulp/clean.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var gulp = require('gulp');
2+
var clean = require('gulp-clean');
3+
4+
var paths = require('./paths');
5+
6+
gulp.task('clean', function () {
7+
return gulp.src(paths.dest.root, {read: false})
8+
.pipe(clean());
9+
});

gulp/copy.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var gulp = require('gulp');
2+
var print = require('gulp-print');
3+
var cache = require('gulp-cached');
4+
5+
var paths = require('./paths.js');
6+
7+
gulp.task('copyJs', function () {
8+
return gulp.src([paths.src.scripts])
9+
.pipe(cache())
10+
.pipe(gulp.dest(paths.dest.root));
11+
});
12+
13+
gulp.task('copyIndex', function () {
14+
return gulp.src(paths.src.index)
15+
.pipe(cache())
16+
.pipe(gulp.dest(paths.dest.root));
17+
});
18+
19+
gulp.task('copyContent', function () {
20+
return gulp.src([paths.src.content + '**/*.*', '!**/*.less'])
21+
.pipe(gulp.dest(paths.dest.content));
22+
});

gulp/gulpFile.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require('./watch.js');
2+
require('./build.js');
3+
require('./clean.js');
4+
require('./requirejs.js');
5+
require('./jshint.js');
6+
require('./handlebars.js');
7+
require('./copy.js');
8+
require('./less.js');
9+
require('./stripBom.js');
10+
11+

gulp/handlebars.js

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
var gulp = require('gulp');
2+
var handlebars = require('gulp-handlebars');
3+
var declare = require('gulp-declare');
4+
var concat = require('gulp-concat');
5+
var wrapAmd = require('gulp-wrap-amd');
6+
var wrap = require("gulp-wrap");
7+
var path = require('path');
8+
var streamqueue = require('streamqueue');
9+
10+
var paths = require('./paths.js');
11+
var bom = require('./pipelines/gulp-bom.js');
12+
13+
gulp.task('handlebars', function () {
14+
15+
var coreStream = gulp.src([paths.src.templates, '!*/**/*Partial.*'])
16+
.pipe(bom())
17+
.pipe(handlebars())
18+
.pipe(declare({
19+
namespace: 'T',
20+
noRedeclare: true,
21+
processName: function (filePath) {
22+
23+
filePath = path.relative(paths.src.root, filePath);
24+
25+
return filePath.replace(/\\/g, '/')
26+
.toLocaleLowerCase()
27+
.replace('template', '')
28+
.replace('.js', '');
29+
}
30+
}));
31+
32+
var partialStream = gulp.src([paths.src.partials])
33+
.pipe(bom())
34+
.pipe(handlebars())
35+
.pipe(wrap('Handlebars.template(<%= contents %>)'))
36+
.pipe(wrap('Handlebars.registerPartial(<%= processPartialName(file.relative) %>, <%= contents %>)', {}, {
37+
imports: {
38+
processPartialName: function (fileName) {
39+
return JSON.stringify(
40+
path.basename(fileName, '.js')
41+
);
42+
}
43+
}
44+
}));
45+
46+
47+
return streamqueue({ objectMode: true },
48+
partialStream,
49+
coreStream
50+
).pipe(concat('templates.js'))
51+
.pipe(wrapAmd({
52+
deps: ['handlebars'],
53+
params: ['Handlebars'],
54+
exports: 'this["T"]'
55+
}))
56+
.pipe(gulp.dest(paths.dest.root));
57+
});

gulp/jshint.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var gulp = require('gulp');
2+
var jshint = require('gulp-jshint');
3+
var stylish = require('jshint-stylish');
4+
var cache = require('gulp-cached');
5+
var paths = require('./paths.js');
6+
7+
8+
gulp.task('jshint', function () {
9+
return gulp.src([paths.src.scripts, paths.src.exclude.libs])
10+
.pipe(cache())
11+
.pipe(jshint({
12+
'-W030': false,
13+
'-W064': false,
14+
'-W097': false,
15+
'-W100': false,
16+
'undef': true,
17+
'globals': {
18+
'require': true,
19+
'define': true,
20+
'window': true,
21+
'document': true,
22+
'console': true
23+
}
24+
}))
25+
.pipe(jshint.reporter(stylish));
26+
});

gulp/less.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
var gulp = require('gulp');
2+
var less = require('gulp-less');
3+
var print = require('gulp-print');
4+
5+
var paths = require('./paths');
6+
7+
gulp.task('less', function () {
8+
return gulp.src([
9+
paths.src.content + 'bootstrap.less',
10+
paths.src.content + 'theme.less',
11+
paths.src.content + 'overrides.less',
12+
paths.src.root + 'Series/series.less',
13+
paths.src.root + 'History/history.less',
14+
paths.src.root + 'AddSeries/addSeries.less',
15+
paths.src.root + 'Calendar/calendar.less',
16+
paths.src.root + 'Cells/cells.less',
17+
paths.src.root + 'Settings/settings.less',
18+
paths.src.root + 'System/Logs/logs.less',
19+
paths.src.root + 'System/Update/update.less',
20+
])
21+
.pipe(print())
22+
.pipe(less({
23+
dumpLineNumbers: 'false',
24+
compress: true,
25+
yuicompress: true,
26+
ieCompat: true,
27+
strictImports: true
28+
}))
29+
.pipe(gulp.dest(paths.dest.content));
30+
});

0 commit comments

Comments
 (0)