forked from kefirjs/kefir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
91 lines (74 loc) · 2.14 KB
/
Gruntfile.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
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
timeGrunt = require('time-grunt')
loadGruntTasks = require('load-grunt-tasks')
babel = require('rollup-plugin-babel')
uglify = require('rollup-plugin-uglify')
nodeResolve = require('rollup-plugin-node-resolve')
commonjs = require('rollup-plugin-commonjs')
module.exports = (grunt) ->
pkg = grunt.file.readJSON('package.json')
banner = """
/*! Kefir.js v#{pkg.version}
* #{pkg.homepage}
*/
"""
rollupPlugins = [
babel({presets: ['es2015-loose-rollup']}),
nodeResolve({main: true}),
commonjs(),
]
timeGrunt(grunt)
grunt.initConfig(
browserify:
tests:
src: ['test/specs/*.js', 'test/specs/*.coffee']
dest: 'test/in-browser/spec/KefirSpecs.js'
options:
transform: [
'coffeeify',
['babelify', {presets: ['es2015-loose'], only: /test\/specs\/.*\.js$/}],
]
rollup:
options:
moduleName: 'Kefir'
format: 'umd'
banner: banner
dev:
options:
plugins: rollupPlugins
files:
'dist/kefir.js': ['src/index.js']
prod:
options:
sourceMap: true
plugins: rollupPlugins.concat uglify(output: { comments: /\!\s\w/ })
files:
'dist/kefir.min.js': ['src/index.js']
jade:
docs:
options:
data: {pkg}
filters:
escapehtml: (block) ->
block
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''')
files:
'index.html': 'docs-src/index.jade'
clean:
main:
src: ['dist', 'index.html']
bower:
install:
options:
cleanup: true
verbose: true
targetDir: './bower-packages'
)
loadGruntTasks(grunt)
grunt.registerTask 'build-browser-tests', ['browserify:tests']
grunt.registerTask 'build-kefir', ['rollup:dev', 'rollup:prod']
grunt.registerTask 'build-docs', ['jade:docs']
grunt.registerTask 'default', ['clean', 'build-docs', 'build-kefir', 'build-browser-tests']