-
Notifications
You must be signed in to change notification settings - Fork 38
/
Gruntfile.js
121 lines (103 loc) · 3.87 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
121
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-git-authors');
// N.B. The development build includes paths in the mapfile, at the browserify step, that are not accessable
// from the browser.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
authors: {
prior: [
"Ward Cunningham <ward@c2.com>",
"Stephen Judkins <stephen.judkins@gmail.com>",
"Sam Goldstein <sam@aboutus.org>",
"Steven Black <steveb@stevenblack.com>",
"Don Park <don@donpark.org>",
"Sven Dowideit <SvenDowideit@fosiki.com>",
"Adam Solove <asolove@gmail.com>",
"Nick Niemeir <nick.niemeir@gmail.com>",
"Erkan Yilmaz <erkan77@gmail.com>",
"Matt Niemeir <matt.niemeir@gmail.com>",
"Daan van Berkel <daan.v.berkel.1980@gmail.com>",
"Nicholas Hallahan <nick@theoutpost.io>",
"Ola Bini <ola.bini@gmail.com>",
"Danilo Sato <dtsato@gmail.com>",
"Henning Schumann <henning.schumann@gmail.com>",
"Michael Deardeuff <michael.deardeuff@gmail.com>",
"Pete Hodgson <git@thepete.net>",
"Marcin Cieslak <saper@saper.info>",
"M. Kelley Harris (http://www.kelleyharris.com)",
"Ryan Bennett <nomad.ry@gmail.com>",
"Paul Rodwell <paul.rodwell@btinternet.com>",
"David Turnbull <dturnbull@gmail.com>",
"Austin King <shout@ozten.com>"
]
},
// tidy-up before we start the build
clean: ['build/*', 'client/client.js', 'client/client.map', 'client/client.*.js', 'client/client.*.map', 'client/test/testclient.js'],
browserify: {
// build the client that we will include in the package
packageClient: {
src: ['./client.js'],
dest: 'client/client.max.js'
},
// build for local development version of the client will go here (once mapfile issues are resolved)
// build the browser testclient
testClient: {
src: ['./testclient.js'],
dest: 'client/test/testclient.js'
}
},
uglify: {
packageClient: {
// uglify the client version for including in the NPM package,
// create a map so at least if needed we can get back to the generated javascript
// uglified version is 'client.js', so we don't need changes elsewhere.
options: {
sourceMap: true,
sourceMapRoot: "/",
sourceMapName: 'client/client.map',
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> and other contributors;\n' +
' * Released under the <%= pkg.license %> license */',
},
files: {
'client/client.js': ['client/client.max.js']
}
}
},
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: [
'test/util.js',
'test/random.js',
'test/page.js',
'test/lineup.js',
'test/drop.js',
'test/revision.js',
'test/resolve.js',
'test/wiki.js'
]
}
},
watch: {
all: {
files: ['test/*.js', 'lib/*.js', '*.js'],
tasks: ['build']
}
}
});
// build without sourcemaps
grunt.registerTask('build', ['clean', 'mochaTest', 'browserify:packageClient', 'browserify:testClient', 'uglify:packageClient']);
// check for out-of-date libraries and known vulnerabilities
grunt.registerTask('check', ['retire']);
// the default is to do the production build.
grunt.registerTask('default', ['build']);
};