diff options
author | eric thul <thul.eric@gmail.com> | 2015-04-08 19:49:24 -0400 |
---|---|---|
committer | eric thul <thul.eric@gmail.com> | 2015-04-12 11:19:22 -0400 |
commit | c194f84cab66fa6e18b78c32f9cdf2bddf8d1e68 (patch) | |
tree | 5470b97ffc561915796f5a8a2a9541d9ebef50ae /gulpfile.js | |
parent | 9d38968bbe4bbf54e2ca836d9a1550d74d4da703 (diff) | |
download | purs-loader-c194f84cab66fa6e18b78c32f9cdf2bddf8d1e68.tar.gz purs-loader-c194f84cab66fa6e18b78c32f9cdf2bddf8d1e68.tar.zst purs-loader-c194f84cab66fa6e18b78c32f9cdf2bddf8d1e68.zip |
Rewrite using purescript for the implementation
Diffstat (limited to 'gulpfile.js')
-rw-r--r-- | gulpfile.js | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..e217480 --- /dev/null +++ b/gulpfile.js | |||
@@ -0,0 +1,68 @@ | |||
1 | 'use strict'; | ||
2 | |||
3 | var path = require('path'); | ||
4 | |||
5 | var gulp = require('gulp'); | ||
6 | |||
7 | var gutil = require('gulp-util'); | ||
8 | |||
9 | var plumber = require('gulp-plumber'); | ||
10 | |||
11 | var purescript = require('gulp-purescript'); | ||
12 | |||
13 | var sequence = require('run-sequence'); | ||
14 | |||
15 | var del = require('del'); | ||
16 | |||
17 | var config = { del: ['build', 'index.js'] | ||
18 | , purescript: { src: [ 'bower_components/purescript-*/src/**/*.purs*' | ||
19 | , 'src/**/*.purs' | ||
20 | ] | ||
21 | , dest: 'build' | ||
22 | , docs: 'MODULE.md' | ||
23 | } | ||
24 | } | ||
25 | ; | ||
26 | |||
27 | function error(e) { | ||
28 | gutil.log(gutil.colors.magenta('>>>> Error <<<<') + '\n' + e.toString().trim()); | ||
29 | this.emit('end'); | ||
30 | } | ||
31 | |||
32 | gulp.task('del', function(cb){ | ||
33 | del(config.del, cb); | ||
34 | }); | ||
35 | |||
36 | gulp.task('make', function(){ | ||
37 | return gulp.src(config.purescript.src). | ||
38 | pipe(plumber()). | ||
39 | pipe(purescript.pscMake({output: config.purescript.dest})). | ||
40 | on('error', error); | ||
41 | }); | ||
42 | |||
43 | gulp.task('psci', function(){ | ||
44 | return gulp.src(config.purescript.src). | ||
45 | pipe(plumber()). | ||
46 | pipe(purescript.dotPsci()). | ||
47 | on('error', error); | ||
48 | }); | ||
49 | |||
50 | gulp.task('docs', function(){ | ||
51 | return gulp.src(config.purescript.src[1]). | ||
52 | pipe(plumber()). | ||
53 | pipe(purescript.pscDocs()). | ||
54 | on('error', error). | ||
55 | pipe(gulp.dest(config.purescript.docs)); | ||
56 | }); | ||
57 | |||
58 | gulp.task('watch', function(){ | ||
59 | gulp.watch(config.purescript.src, ['make']); | ||
60 | }); | ||
61 | |||
62 | gulp.task('default', function(callback){ | ||
63 | sequence('del', 'make', ['psci', 'docs'], callback); | ||
64 | }); | ||
65 | |||
66 | gulp.task('build', function(callback){ | ||
67 | sequence('del', 'make', callback); | ||
68 | }); | ||