forked from elixirscript/elixirscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
57 lines (43 loc) · 1.78 KB
/
gulpfile.js
File metadata and controls
57 lines (43 loc) · 1.78 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
48
49
50
51
52
53
54
55
56
57
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var concat = require('gulp-concat');
var babel = require('gulp-babel');
var eslint = require('gulp-eslint');
var rollup = require('gulp-rollup');
var sourcemaps = require('gulp-sourcemaps');
var path = './priv/javascript';
var stdLibPath = path + '/lib/**/*.js';
var testPath = path + '/build/tests/**/*.spec.js';
var libPath = path + '/lib';
gulp.task('build', function() {
return gulp.src([libPath + '/**/*.js'])
.pipe(babel({sourceMap: false, modules:'common'}))
.pipe(gulp.dest('./priv/javascript/build/lib'));
});
gulp.task('build_test', function() {
return gulp.src(['./priv/javascript/tests/**/*.spec.js'])
.pipe(babel({sourceMap: false, modules:'common'}))
.pipe(gulp.dest('./priv/javascript/build/tests'));
});
gulp.task('test',['build', 'build_test'], function () {
return gulp.src(testPath, {read: false})
.pipe(mocha({reporter: 'nyan'}));
});
gulp.task('lint', function () {
return gulp.src([stdLibPath, testPath, '!./priv/javascript/build/**/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('dist_build', function() {
return gulp.src(['./priv/javascript/**/*.js', '!./priv/javascript/build/**/*.js', '!./priv/javascript/dist/**/*.js', '!./priv/javascript/dist_build/**/*.js', '!./priv/javascript/tests/**/*.js'])
.pipe(babel({whitelist: ['flow'], optional: ["minification.deadCodeElimination"]}))
.pipe(gulp.dest('./priv/javascript/dist_build'));
});
gulp.task('dist_add_source_map', function() {
return gulp.src(['./priv/javascript/dist/elixir.js'])
.pipe(sourcemaps.init())
.pipe(sourcemaps.write())
.pipe(gulp.dest('./priv/javascript/dist'));
});
gulp.task('default', ['lint', 'test']);