|
| 1 | +'use strict' |
| 2 | + |
| 3 | +var gulp = require('gulp') |
| 4 | + , purescript = require('gulp-purescript') |
| 5 | + ; |
| 6 | + |
| 7 | +var paths = { |
| 8 | + src: 'src/**/*.purs', |
| 9 | + bowerSrc: [ |
| 10 | + 'bower_components/purescript-*/src/**/*.purs', |
| 11 | + 'bower_components/purescript-*/src/**/*.purs.hs' |
| 12 | + ], |
| 13 | + dest: '', |
| 14 | + docsDest: 'README.md' |
| 15 | +}; |
| 16 | + |
| 17 | +var options = {}; |
| 18 | + |
| 19 | +var compile = function(compiler) { |
| 20 | + var psc = compiler(options); |
| 21 | + psc.on('error', function(e) { |
| 22 | + console.error(e.message); |
| 23 | + psc.end(); |
| 24 | + }); |
| 25 | + return gulp.src([paths.src].concat(paths.bowerSrc)) |
| 26 | + .pipe(psc) |
| 27 | + .pipe(gulp.dest(paths.dest)); |
| 28 | +}; |
| 29 | + |
| 30 | +gulp.task('make', function() { |
| 31 | + return compile(purescript.pscMake); |
| 32 | +}); |
| 33 | + |
| 34 | +gulp.task('browser', function() { |
| 35 | + return compile(purescript.psc); |
| 36 | +}); |
| 37 | + |
| 38 | +gulp.task('docs', function() { |
| 39 | + return gulp.src(paths.src) |
| 40 | + .pipe(purescript.docgen()) |
| 41 | + .pipe(gulp.dest(paths.docsDest)); |
| 42 | +}); |
| 43 | + |
| 44 | +gulp.task('watch-browser', function() { |
| 45 | + gulp.watch(paths.src, ['browser', 'docs']); |
| 46 | +}); |
| 47 | + |
| 48 | +gulp.task('watch-make', function() { |
| 49 | + gulp.watch(paths.src, ['make', 'docs']); |
| 50 | +}); |
| 51 | + |
| 52 | +gulp.task('default', ['make', 'docs']); |
0 commit comments