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
54 lines (44 loc) · 1.73 KB
/
gulpfile.js
File metadata and controls
54 lines (44 loc) · 1.73 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
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');
require("babel/polyfill");
var path = './src/javascript';
var stdLibPath = path + '/lib/**/*.js';
var testPath = path + '/test_build/tests/**/*.spec.js';
var libPath = path + '/lib';
gulp.task('test_build', function() {
return gulp.src([path + '/lib/**/*.js'])
.pipe(babel({sourceMap: false, modules:'common'}))
.pipe(gulp.dest(path + '/test_build/lib'));
});
gulp.task('test_build_tests', function() {
return gulp.src([path + '/tests/**/*.spec.js'])
.pipe(babel({sourceMap: false, modules:'common'}))
.pipe(gulp.dest(path + '/test_build/tests'));
});
gulp.task('test', ['test_build', 'test_build_tests'], function () {
return gulp.src(testPath, {read: false})
.pipe(mocha({reporter: 'nyan'}));
});
gulp.task('lint', function () {
return gulp.src([stdLibPath, testPath, '!' + path + '/build/**/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('dist_build', function() {
return gulp.src([path + '/**/*.js', '!' + path + '/build/**/*.js', '!' + path + '/dist/**/*.js', '!' + path + '/dist_build/**/*.js', '!' + path + '/tests/**/*.js'])
.pipe(babel({whitelist: ['flow'], optional: ["minification.deadCodeElimination"]}))
.pipe(gulp.dest(path + '/dist_build'));
});
gulp.task('dist_add_source_map', function() {
return gulp.src(['./priv/Elixir.js'])
.pipe(sourcemaps.init())
.pipe(sourcemaps.write())
.pipe(gulp.dest('./priv'));
});
gulp.task('default', ['lint', 'test']);