-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
51 lines (46 loc) · 1.13 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
'use strict';
const gulp = require('gulp');
const babel = require('gulp-babel');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify-es').default;
const banner = require('gulp-banner');
const pkg = require('./package.json');
const clean = require('gulp-clean');
const jasmineBrowser = require('gulp-jasmine-browser');
const bannerString =
'/*\n' +
' * <%= pkg.name %> <%= pkg.version %>\n' +
' * <%= pkg.description %>\n' +
' * <%= pkg.homepage %>\n' +
' *\n' +
' * Copyright ' +
new Date().getFullYear() +
', <%= pkg.author %>\n' +
' * Released under the <%= pkg.license %> license.\n' +
'*/\n\n';
gulp.task('clean', () => {
return gulp.src('dist/*.js', { read: false }).pipe(clean());
});
gulp.task('test', function() {
return gulp
.src(['maari.js', 'spec/*Spec.js'])
.pipe(jasmineBrowser.specRunner())
.pipe(jasmineBrowser.server({ port: 8888 }));
});
gulp.task('release', () => {
return gulp
.src('./maari.js')
.pipe(
babel({
presets: ['env']
})
)
.pipe(rename('maari.min.js'))
.pipe(uglify())
.pipe(
banner(bannerString, {
pkg: pkg
})
)
.pipe(gulp.dest('dist/'));
});