-
Notifications
You must be signed in to change notification settings - Fork 22
/
gulpfile.coffee
57 lines (48 loc) · 1.46 KB
/
gulpfile.coffee
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
del = require 'del'
gulp = require 'gulp'
coffee = require 'gulp-coffee'
gutil = require 'gulp-util'
bump = require 'gulp-bump'
git = require 'gulp-git'
filter = require 'gulp-filter'
tag = require 'gulp-tag-version'
{spawn} = require 'child_process'
inc = (importance) ->
# get all the files to bump version in
return gulp.src ['./package.json', './bower.json']
# bump the version number in those files
.pipe bump({type: importance})
# save it back to filesystem
.pipe gulp.dest('./')
# commit the changed version number
.pipe git.commit('bumps package version')
# read only one file to get the version number
.pipe filter('package.json')
# **tag it in the repository**
.pipe tag()
# compile `index.coffee`
gulp.task 'coffee', ->
gulp.src('index.coffee')
.pipe(coffee bare: true)
.pipe(gulp.dest './')
# remove `index.js` and `coverage` dir
gulp.task 'clean', (cb) ->
del ['dist', 'coverage', 'temp'], cb
# run tests
gulp.task 'test', ['coffee'], ->
spawn 'npm', ['test'], stdio: 'inherit'
# run `md` for testing purposes
gulp.task 'md', ->
markdownIt = require './index.coffee'
gulp.src('./{,test/,test/fixtures/}*.md')
.pipe(markdownIt())
.pipe(gulp.dest './temp')
# start workflow
gulp.task 'default', ['coffee'], ->
gulp.watch ['./{,test/,test/fixtures/}*.coffee'], ['test']
gulp.task 'patch', ->
inc 'patch'
gulp.task 'feature', ->
inc 'minor'
gulp.task 'release', ->
inc 'major'