-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
77 lines (58 loc) · 1.68 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
require('babel-register')
const gulp = require('gulp');
const loadPlugins = require('gulp-load-plugins');
const del = require('del');
const babel = require('gulp-babel');
const path = require('path');
const manifest = require('./package.json');
// Load all of our Gulp plugins
const $ = loadPlugins();
// Gather the library data from `package.json`
const config = manifest.babelBoilerplateOptions;
const mainFile = manifest.main;
const destinationFolder = path.dirname(mainFile);
const exportFileName = path.basename(mainFile, path.extname(mainFile));
const webpackConfig = require('./test/config/webpack.config')
function cleanDist(done) {
del([destinationFolder]).then(() => done());
}
function cleanTmp(done) {
del(['tmp']).then(() => done());
}
// Lint a set of files
function lint(files) {
return gulp.src(files)
.pipe($.eslint())
.pipe($.eslint.format())
.pipe($.eslint.failAfterError());
}
function lintSrc() {
return lint('src/**/*.js');
}
function lintTest() {
return lint('test/**/*.js');
}
function lintGulpfile() {
return lint('gulpfile.js');
}
function build() {
return gulp.src('src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('dist'))
}
// Remove the built files
gulp.task('clean', cleanDist);
// Remove our temporary files
gulp.task('clean-tmp', cleanTmp);
// Lint our source code
gulp.task('lint-src', lintSrc);
// Lint our test code
gulp.task('lint-test', lintTest);
// Lint this file
gulp.task('lint-gulpfile', lintGulpfile);
// Lint everything
gulp.task('lint', ['lint-src', 'lint-test', 'lint-gulpfile']);
// Build two versions of the library
gulp.task('build', ['lint', 'clean'], build);
// An alias of build
gulp.task('default', ['build']);