forked from littlebee/bumble-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntConfig.coffee
99 lines (71 loc) · 2.9 KB
/
gruntConfig.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
92
93
94
95
96
97
98
99
###
webpack setup and external grunt tasks borrowed from:
https://github.com/felixhao28/using-coffee-react-for-frontend-dev-walkthrough
###
Path = require('path')
_ = require('lodash')
BUMBLE_DOCS_SCRIPTS = './node_modules/bumble-docs/bin/'
bumbleScriptCommand = (scriptFile, args="")->
return "coffee #{Path.join(BUMBLE_DOCS_SCRIPTS, scriptFile)} #{args}"
module.exports = (grunt, initConfig={}) ->
# load plugins
# this loads all of the grunt-... packages in package.json. clever
require('load-grunt-tasks')(grunt, {config: 'node_modules/bumble-build/package'})
pkg = grunt.file.readJSON("package.json")
# configuration
grunt.initConfig
pkg: pkg
# args to initConfig method are the tasks
clean:
distrib: ["dist/#{pkg.name}.*"]
# these are the things created by bumble-docs/scripts
docs: ["docs/**/*"]
cssmin:
options:
shorthandCompacting: false,
keepBreaks: true
distrib:
files:
"dist/#{pkg.name}.css": [
'css/**/*.css'
]
shell:
buildExamples:
command: bumbleScriptCommand('buildExamples.coffee')
buildDocIndex:
command: bumbleScriptCommand('buildDocIndex.coffee')
buildApiDocs:
command: bumbleScriptCommand('buildApiDocs.coffee')
deploy:
options:
# should gracefully fail if it doesn't find zukeeper src. see comment at top of the script
failOnError: false
command: 'coffee ./scripts/deploy.coffee'
npmInstall:
command: 'npm install'
test:
command: 'coffee node_modules/bumble-test/bin/testRunner.coffee'
availabletasks:
tasks:
options:
filter: 'include'
tasks: ['build', 'test', 'watch', 'clean', 'docs']
descriptions:
build: "Builds everything including docs, examples"
test: "Builds everything and then run tests in /test"
watch: "Watch for changing files and calls build. Also watches examples and docs"
docs: "Build the docs. To publish to github.io, you must pull master into gh-pages"
clean: "Remove all compiled files. Use `grunt clean build` to rebuild everything from scratch"
watch:
build:
files: ["src/**/*", "css/**/*", "lib/**/*", "scripts/**/*", "webpack.config.coffee"]
tasks: ["build"]
webpack:
distrib: require("./webpack.config.coffee")
optimize: require("./webpack.optimized.config.coffee")
# tasks
grunt.registerTask 'test', ["shell:test"]
grunt.registerTask 'distrib', ['cssmin:distrib', 'webpack:distrib', 'webpack:optimize','shell:deploy']
grunt.registerTask 'docs', ['shell:buildDocIndex', 'shell:buildApiDocs', 'shell:buildExamples']
grunt.registerTask 'build', ['docs', 'distrib']
grunt.registerTask 'default', ['availabletasks']