This repository has been archived by the owner on May 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Gulpfile.js
95 lines (79 loc) · 2.46 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var path = require('path');
var gulp = require('gulp');
var run = require('gulp-run');
var del = require('del');
var changed = require('gulp-changed');
var webpack = require('webpack-stream');
var config = require('./webpack.config.js');
var purescript = require('gulp-purescript');
var projectRoot = __dirname + '/';
var srcRoot = 'src/';
var destRoot = 'dest/';
var releaseRoot = 'demo/scripts/release';
var sources = [
"src/**/*.purs",
"test/**/*.purs",
"bower_components/purescript-*/src/**/*.purs",
];
var foreigns = [
"src/**/*.js",
"bower_components/purescript-*/src/**/*.js"
];
var demoSources = [
"demo/scripts/**/*.purs",
"src/**/*.purs",
"bower_components/purescript-*/src/**/*.purs",
];
var demoForeigns = [
"src/**/*.js",
"demo/scripts/ui/**/*.js",
"bower_components/purescript-*/src/**/*.js"
];
gulp.task('webpack', function() {
return gulp.src('output/DemoApp.WithRedux/index.js')
.pipe(webpack(config))
.pipe(gulp.dest('./demo/scripts/release/'));
});
gulp.task("make", function () {
return purescript.compile({ src: sources, ffi: foreigns });
});
gulp.task("make-demo", function () {
return purescript.compile({ src: demoSources, ffi: demoForeigns });
});
gulp.task("bundle", ["make"], function () {
return purescript.bundle({ src: "output/**/*.js", output: "dist/bundle.js" });
});
gulp.task("bundle-demo", ["make-demo"], function () {
return purescript.bundle({ src: "output/DemoApp.WithRedux/**/*.js", output: "dist/demo/bundle.js" });
});
gulp.task("docs", function () {
return purescript.docs({
src: sources,
docgen: {
"Name.Of.Module1": "docs/Name/Of/Module1.md",
"Name.Of.Module2": "docs/Name/Of/Module2.md"
}
});
});
gulp.task("dotpsci-demo", function () {
return purescript.psci({ src: demoSources, ffi: demoForeigns })
.pipe(gulp.dest("."));
});
gulp.task("dotpsci", function () {
return purescript.psci({ src: sources, ffi: foreigns })
.pipe(gulp.dest("."));
});
gulp.task('clean', function (cb) {
del([releaseRoot + '**/*'], function (err, deletedFiles) {
if(err){
console.log('Error during deletion: ' + err);
}
});
cb();
});
gulp.task("test", ["make"], function() {
return purescript.bundle({ src: "output/**/*.js", main: "Test.Main" })
.pipe(run("node"));
});
gulp.task("build-demo", ["bundle-demo", "dotpsci-demo","webpack"]);
gulp.task("default", ["bundle", "dotpsci"]);