-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
92 lines (84 loc) · 2.67 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
module.exports = function(grunt) {
var standaloneNamespace = 'FPSDisplay';
var latest = '<%= pkg.name %>';
var releaseDir = 'release/';
var devRelease = releaseDir + latest + '.js';
var bannerContentMin = '/*! <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd hh:mm:ss") %> \n' +
'<%= pkg.author.name %> |' +
'<%= pkg.author.address %> | ' +
'<%= pkg.author.email %> | ' +
'<%= pkg.author.twitter %> | ' +
'License: <%= pkg.license %> */\n';
footerContent = '\n}(exports));';
devRelease = releaseDir + latest + '.js';
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
clean: [releaseDir],
jshint: {
options: {
jshintrc: '.jshintrc'
},
target: {
src: ['src/**/*.js']
}
},
uglify: {
options: {
banner: bannerContentMin,
report: 'min',
sourceMap: true
},
target: {
src: releaseDir + latest + '.js',
dest: releaseDir + latest + '.min.js'
}
},
copy: {
publicJS: {
expand: true,
cwd: releaseDir,
src: ['*.js', '*.js.map'],
dest: 'public/scripts/',
flatten: true,
filter: 'isFile'
}
},
exec: {
test: 'npm test',
coverage: 'browserify -t coverify test/*.js | testling | coverify',
browserify: 'mkdir ' + releaseDir + ' && browserify ./src/' + latest + '.js --standalone ' + standaloneNamespace + ' -o ' + devRelease,
ghPagesIndex: './gh-pages-index.sh ' + latest
},
plato: {
options: {},
your_target: {
files: {
'reports': ['src/**/*.js'],
}
}
},
jsdoc : {
dist : {
src: ['src/*.js', 'README.md'],
options: {
destination: 'doc'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-plato');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.registerTask('default', ['clean', 'exec:browserify', 'copy:publicJS']);
grunt.registerTask('release', ['clean', 'jshint', 'exec:browserify', 'uglify', 'copy:publicJS', 'exec:ghPagesIndex', 'jsdoc', 'plato']);
grunt.registerTask('test', ['exec:test']);
grunt.registerTask('coverage', ['exec:coverage']);
grunt.registerTask('report', ['plato']);
grunt.registerTask('doc', ['jsdoc']);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('ghPages', ['exec:ghPagesIndex'])
};