forked from pavoldanis/este-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
137 lines (117 loc) · 3.4 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
module.exports = (grunt) ->
depsDirs = [
'bower_components/closure-library'
'bower_components/closure-templates'
'este'
]
depsPath = 'build/deps.js'
depsPrefix = '../../../../'
grunt.initConfig
clean:
all:
options:
force: true
src: 'este/**/*.{js,css}'
coffee:
all:
options:
bare: true
files: [
expand: true
src: 'este/**/*.coffee'
ext: '.js'
]
coffee2closure:
all:
files: [
expand: true
src: 'este/**/*.coffee'
ext: '.js'
]
esteTemplates:
all:
src: 'este/**/*.soy'
esteDeps:
all:
options:
outputFile: depsPath
prefix: depsPrefix
root: depsDirs
esteUnitTests:
app:
options:
depsPath: depsPath
prefix: depsPrefix
src: 'este/**/*_test.js'
esteBuilder:
options:
root: depsDirs
depsPath: depsPath
compilerFlags: [
# You will love advanced compilation with verbose warning level.
'--output_wrapper="(function(){%output%})();"'
'--compilation_level="ADVANCED_OPTIMIZATIONS"'
'--warning_level="VERBOSE"'
# Remove code for ancient browsers (IE<8, very old Gecko/Webkit).
'--define=goog.net.XmlHttp.ASSUME_NATIVE_XHR=true'
'--define=este.json.SUPPORTS_NATIVE_JSON=true'
'--define=goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS=true'
'--define=goog.DEBUG=false'
# Externs. They allow us to use thirdparty code without [] syntax.
'--externs=externs/react.js'
]
all:
options:
namespace: '*'
outputFilePath: 'build/all.js'
release:
options:
bump: true
add: true
commit: true
tag: true
push: true
pushTags: true
npm: false
'npm-contributors':
options:
file: 'package.json'
commit: true
commitMessage: 'Update contributors'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-este'
grunt.loadNpmTasks 'grunt-npm'
grunt.loadNpmTasks 'grunt-release'
grunt.registerTask 'test', ->
grunt.task.run [
'clean'
'coffee'
'coffee2closure'
'esteTemplates'
'esteDeps'
'esteUnitTests'
'esteBuilder'
]
grunt.registerTask 'incorporateReact', ->
src = grunt.file.read 'bower_components/react/react.min.js'
desc = """
###*
@fileoverview Facebook React UI library incorporated into Este.
Supported browsers: all evergreen and IE9+. To support IE8, add
https://github.com/kriskowal/es5-shim.
Learn React.
@see http://facebook.github.io/react
React demos:
@see bower_components/este-library/este/demos/thirdparty/react/index.html
Remember to use externs for advanced compilation demo.
@see https://github.com/steida/este/blob/master/Gruntfile.coffee
Copyright 2013 Facebook, Inc.
###
goog.provide 'este.thirdParty.react'
goog.globalEval #{JSON.stringify src}
# Hint for compiler dead code removal. Prevents src duplication.
# GZip probably can't reduce such a long string.
goog.globalEval ';'
"""
grunt.file.write 'este/thirdparty/react.coffee', desc