forked from iotaledger/iota.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
51 lines (42 loc) · 1.15 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
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
source = require("vinyl-source-stream"),
buffer = require("vinyl-buffer"),
browserify = require('browserify'),
del = require('del'),
gulpNSP = require('gulp-nsp');
var DEST = './dist/'
/**
Lint the JS code
**/
gulp.task('lint', [], function(){
return gulp.src(['./lib/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
/**
Remove existing dist folder
**/
gulp.task('clean', ['lint'], function(cb) {
del([DEST]).then(cb.bind(null, null));
});
//To check your package.json
gulp.task('nsp', function (cb) {
gulpNSP({package: __dirname + '/package.json'}, cb);
});
/**
Build for the browser
**/
gulp.task('dist', function() {
return browserify("./iota-browser.js")
.bundle()
.pipe(source('iota.js'))
.pipe(gulp.dest(DEST))
.pipe(rename('iota.min.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest(DEST));
});
gulp.task('default', ['lint', 'clean', 'nsp', 'dist']);