This repository was archived by the owner on Apr 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
69 lines (62 loc) · 1.93 KB
/
gulpfile.js
File metadata and controls
69 lines (62 loc) · 1.93 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
58
59
60
61
62
63
64
65
66
67
68
69
var browserify = require( 'browserify' );
var gulp = require( 'gulp' );
var source = require( 'vinyl-source-stream' );
var reactify = require( 'reactify' );
var jshint = require( 'gulp-jshint' );
var uglify = require( 'gulp-uglify' );
var rename = require( 'gulp-rename' );
var mocha = require( 'gulp-mocha' );
var mochaPhantomJS = require( 'gulp-mocha-phantomjs' );
gulp.task( 'browserify', function() {
var b = browserify();
b.transform( reactify ); // use the reactify transform
b.add( './src/index.js' );
b.bundle()
.pipe( source( 'scReactPresenter.js' ) )
.pipe( gulp.dest( './dist/' ) );
var componentFile = browserify();
componentFile.transform( reactify ); // use the reactify transform
componentFile.add( './testClient/component/text.jsx' );
componentFile.bundle()
.pipe( source( 'text.js' ) )
.pipe( gulp.dest( './testClient/component/' ) );
} );
gulp.task('build', [ 'browserify', 'lint', 'test', 'clientTest' ], function() {
return gulp.src( './dist/scReactPresenter.js' )
.pipe( uglify() )
.pipe( rename( 'scReactPresenter.min.js' ) )
.pipe( gulp.dest('./dist') );
});
gulp.task('test', function () {
return gulp.src( ['./test/**/*.js'] )
.pipe( mocha() );
});
gulp.task('clientTest', function () {
return gulp
.src('testClient/basic-01/runner.html')
.pipe(mochaPhantomJS());
});
gulp.task('lint', function() {
return gulp.src( ['./src/**/*.js', './test/*.js'] )
.pipe( jshint( {
curly: true,
eqeqeq: true,
immed: false,
latedef: true,
quotmark: "single",
noarg: true,
forin: true,
newcap: true,
sub: true,
undef: false,
boss: true,
strict: false,
unused: false,
eqnull: true,
node: true,
browser: true,
expr: "warn"
} ) )
.pipe( jshint.reporter( 'default' ) );
});
gulp.task( 'default' , [ 'build' ] );