-
Notifications
You must be signed in to change notification settings - Fork 5
/
gruntfile.js
110 lines (99 loc) · 3.13 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
/* global module, require */
module.exports = function (grunt) {
'use strict';
var SRC_DIR = 'src/',
SRC_FILES = [
SRC_DIR + 'chip8.js',
SRC_DIR + 'chip8-cpu.js',
SRC_DIR + 'chip8-is.js',
SRC_DIR + 'chip8-keyboard.js',
SRC_DIR + 'chip8-screen.js',
SRC_DIR + 'chip8-audio.js'
],
TEST_DIR = 'test/',
SPEC_FILES = [
TEST_DIR + 'spec/audio.spec.js',
TEST_DIR + 'spec/screen.spec.js',
TEST_DIR + 'spec/keyboard.spec.js',
TEST_DIR + 'is.helpers.js',
TEST_DIR + 'spec/is.spec.js'
],
BUILD_DIR = 'build/',
DOC_DIR = 'doc',
BUILD_TARGET = 'chip8.min.js';
grunt.initConfig({
_TARGET: BUILD_DIR + BUILD_TARGET,
concat: {
dist: {
src: SRC_FILES,
dest: '<%= _TARGET %>'
}
},
closurecompiler: {
minify: {
files: {
"<%= _TARGET %>": '<%= _TARGET %>'
},
options: {
"compilation_level": "SIMPLE_OPTIMIZATIONS",
"banner": '/*\n' + require('fs').readFileSync('LICENSE', { encoding: 'utf8' }) + '*/'
}
}
},
umd: {
build: {
options: {
src: '<%= _TARGET %>',
dest: '<%= _TARGET %>',
objectToExport: 'chip8',
template: 'umd.hbs'
}
}
},
jasmine: {
dev: {
src: SRC_FILES,
options: {
specs: SPEC_FILES
}
},
prod: {
src: '<%= _TARGET %>',
options: {
specs: SPEC_FILES
}
}
},
jshint: {
src: [ 'gruntfile.js', SRC_FILES, SPEC_FILES ],
options: {
jshintrc: true
}
},
jsdoc : {
dist : {
src: SRC_FILES.concat('README.md'),
options: {
configure: 'jsdoc.conf.json',
destination: DOC_DIR,
private: false,
template : "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template"
}
}
},
clean: [ BUILD_DIR, DOC_DIR ]
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-closurecompiler');
grunt.loadNpmTasks('grunt-umd');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('dist', ['build', 'jsdoc']);
grunt.registerTask('build', ['concat', 'umd:build', 'closurecompiler:minify']);
grunt.registerTask('test:prod', ['jasmine:prod']);
grunt.registerTask('test:dev', ['jasmine:dev']);
grunt.registerTask('test', ['test:dev']);
grunt.registerTask('default', ['build']);
};