-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
47 lines (40 loc) · 1.28 KB
/
gulpfile.js
File metadata and controls
47 lines (40 loc) · 1.28 KB
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
'use strict';
const pkg = require('./package.json'),
gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sourcemaps = require('gulp-sourcemaps'),
header = require('gulp-header'),
eslint = require('gulp-eslint'),
mocha = require('gulp-mocha'),
benchmark = require('gulp-benchmark'),
banner = '/*! <%= pkg.name %> v<%= pkg.version %> | Copyright (c) 2025-present, <%= pkg.author %> | <%= pkg.license %> */\n';
gulp.task('benchmark', () => {
return gulp
.src('benchmark/*.js', { read: false })
.pipe(benchmark());
});
gulp.task('lint', () => {
return gulp
.src('src/*.js')
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('test', ['lint'], () => {
return gulp
.src('test/*.js', { read: false })
.pipe(mocha({ reporter: 'nyan' }));
});
gulp.task('dist', ['test'], () => {
gulp.src('src/*.js')
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest('dist'));
return gulp.src('src/*.js')
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(header(banner, { pkg: pkg }))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
});
gulp.task('default', ['dist']);