-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
88 lines (82 loc) · 2.09 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
/*eslint camelcase: [0] */
module.exports = grunt => {
const filesToJoin = {
'public/js/global.js': [
'build/app.js'
]
};
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: ['coverage', 'build'],
mocha_istanbul: {
test: {
src: 'test',
options: {
root: '.',
mask: '**/*.js',
reporter: 'dot',
check: {
lines: 80,
statements: 80,
functions: 80
},
mochaOptions: ['--exit']
}
}
},
uglify: {
development: {
options: {
mangle: false,
beautify: true
},
files: filesToJoin
},
production: {
files: filesToJoin
}
},
eslint: {
target: ['*.js', 'server/*.js', 'src/*.js*', 'test/*.js']
},
browserify: {
dist: {
options: {
banner: 'var retroflectionVersion = \'<%= pkg.version %>\';\n',
transform: [['babelify', {presets: [ 'env', 'react' ]}]]
},
files: {
'build/app.js': ['src/main.jsx']
}
}
},
replace: {
dist: {
options: {
patterns: [
{
match: 'version', // placeholder's name
replacement: '<%= pkg.version %>' // replace with this value
}
]
},
files: {
'public/retroflection.appcache': [
'server/retroflection.appcache'
]
}
}
}
});
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.loadNpmTasks('grunt-replace');
grunt.registerTask('prepare', ['replace', 'clean', 'eslint', 'browserify']);
grunt.registerTask('deployProduction', ['prepare', 'uglify:production']);
grunt.registerTask('deployDevelopment', ['prepare', 'uglify:development']);
grunt.registerTask('default', ['deployProduction', 'mocha_istanbul']);
grunt.registerTask('travis', ['default']);
};