forked from js-csp/js-csp
-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
42 lines (37 loc) · 982 Bytes
/
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
var gulp = require("gulp");
var mocha = require("gulp-mocha");
var browserify = require("browserify");
var source = require('vinyl-source-stream');
gulp.task("dev:test", function() {
return gulp.src("test/*.js", {read: false})
.pipe(mocha({
reporter: "nyan"
}));
});
gulp.task("dev:watch", function() {
return gulp.watch(["test/*.js", "src/**/*.js"], ["dev:test"]);
});
gulp.task("bundle:browser", function() {
return browserify({
})
.require("./src/csp.js", {expose: "csp"})
.bundle()
.pipe(source("csp.bundled.browser.js"))
.pipe(gulp.dest("./build/"));
});
gulp.task("bundle:node", function() {
return browserify({
standalone: "csp"
})
.require("./src/csp.js", {expose: "csp"})
.bundle()
.pipe(source("csp.bundled.node.js"))
.pipe(gulp.dest("./build/"));
});
// TODO: Test bundles
gulp.task("test", function() {
return gulp.src("test/*.js", {read: false})
.pipe(mocha({
reporter: "spec"
}));
});