forked from joneshf/purescript-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
102 lines (88 loc) · 2.33 KB
/
gulpfile.js
File metadata and controls
102 lines (88 loc) · 2.33 KB
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
96
97
98
99
100
101
102
'use strict'
var gulp = require('gulp')
, bump = require('gulp-bump')
, filter = require('gulp-filter')
, git = require('gulp-git')
, purescript = require('gulp-purescript')
, runSequence = require('run-sequence')
, tagVersion = require('gulp-tag-version')
;
var paths = {
src: 'src/**/*.purs',
bowerSrc: [
'bower_components/purescript-*/src/**/*.purs',
'bower_components/purescript-*/src/**/*.purs.hs'
],
dest: '',
docsDest: 'README.md',
manifests: [
'bower.json',
'package.json'
]
};
var options = {
compiler: {},
pscDocs: {}
};
var compile = function(compiler) {
var psc = compiler(options.compiler);
psc.on('error', function(e) {
console.error(e.message);
psc.end();
});
return gulp.src([paths.src].concat(paths.bowerSrc))
.pipe(psc)
.pipe(gulp.dest(paths.dest));
};
function bumpType(type) {
return gulp.src(paths.manifests)
.pipe(bump({type: type}))
.pipe(gulp.dest('./'));
}
gulp.task('tag', function() {
return gulp.src(paths.manifests)
.pipe(git.commit('Update versions.'))
.pipe(filter('bower.json'))
.pipe(tagVersion());
});
gulp.task('bump-major', function() {
return bumpType('major')
});
gulp.task('bump-minor', function() {
return bumpType('minor')
});
gulp.task('bump-patch', function() {
return bumpType('patch')
});
gulp.task('bump-tag-major', function() {
return runSequence('bump-major', 'tag');
});
gulp.task('bump-tag-minor', function() {
return runSequence('bump-minor', 'tag');
});
gulp.task('bump-tag-patch', function() {
return runSequence('bump-patch', 'tag');
});
gulp.task('make', function() {
return compile(purescript.pscMake);
});
gulp.task('browser', function() {
return compile(purescript.psc);
});
gulp.task('docs', function() {
var pscDocs = purescript.pscDocs(options.pscDocs);
pscDocs.on('error', function(e) {
console.error(e.message);
pscDocs.end();
});
return gulp.src(paths.src)
.pipe(pscDocs)
.pipe(gulp.dest(paths.docsDest));
});
gulp.task('watch-browser', function() {
gulp.watch(paths.src, ['browser', 'docs']);
});
gulp.task('watch-make', function() {
gulp.watch(paths.src, ['make', 'docs']);
});
gulp.task('default', ['make', 'docs']);