forked from tgdwyer/WebCola
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
120 lines (119 loc) · 2.96 KB
/
Gruntfile.js
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
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
require('./tasks/examples')(grunt);
grunt.loadNpmTasks('typedoc');
grunt.loadNpmTasks('dts-generator');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
d3: {
src: 'node_modules/d3/d3.min.js',
dest: 'WebCola/extern/d3.min.js'
},
qunit: {
src: 'node_modules/qunitjs/qunit/*',
dest: 'WebCola/test/'
},
},
watch: {
typescript: {
files: ["<%= typescript.base.src %>","<%= typescript.examples.src %>"],
tasks: ["typescript"]
},
test: {
files: ["WebCola/test/*.js"],
tasks: ["qunit"]
}
},
typescript: {
base: {
src: ['WebCola/src/*.ts'],
dest: 'WebCola/cola.js',
options: {
module: 'amd',
target: 'es5',
sourceMap: true
}
},
test: {
src: ['WebCola/test/*.ts'],
options: {
module: 'amd',
target: 'es5',
sourceMap: true
}
},
commonjs: {
src: ['WebCola/index.ts'],
dest: 'WebCola/index.js',
options: {
module: 'commonjs',
target: 'es5'
}
},
examples: {
src: ['WebCola/examples/*.ts'],
options: {
module: 'amd',
target: 'es5',
sourceMap: true
}
}
},
dtsGenerator: {
options: {
name: 'cola',
baseDir: 'WebCola',
out: 'WebCola/cola.d.ts',
excludes: ['extern/d3.d.ts']
},
default: {
src: [ 'WebCola/src/*.ts' ]
}
},
umd: {
all: {
src: '<%= dist.dest %>',
template: 'templates/umd.hbs',
objectToExport: 'cola',
deps: {
'default': ['d3']
}
}
},
uglify: {
options: {
sourceMap: true
},
dist: {
files: {
'WebCola/cola.min.js': [
'<%= typescript.base.dest %>'
]
}
}
},
qunit: {
all: ['WebCola/test/*.html']
},
examples: {
all: ["WebCola/examples/*.html"]
},
typedoc: {
options: {
module: 'amd',
target: 'es5',
out: 'doc/',
name: 'WebCoLa AKA cola.js',
theme: 'minimal'
},
src: ["<%= typescript.base.src %>"]
}
});
grunt.registerTask('default', ['copy', 'typescript', 'uglify', 'qunit']);
grunt.registerTask('nougly', ['typescript', 'qunit']);
grunt.registerTask('nougly-notest', ['typescript']);
grunt.registerTask('docs', ['typedoc', 'typescript:examples']);
grunt.registerTask('examples', ['typescript:examples']);
grunt.registerTask('full', ['default', 'typescript:examples', 'examples']);
};