forked from selaux/miner-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
111 lines (101 loc) · 3.47 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
'use strict';
var scope = process.env.NODE_ENV === 'production' ? [ 'dependencies' ] : ['devDependencies', 'dependencies'];
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt, { scope: scope });
grunt.initConfig({
jshint: {
backend: {
files: {
src: [
'**/*.js',
'!build/**/*.js',
'!_site/**/*.js',
'!node_modules/**/*.js',
'!frontend/javascripts/**/*.js'
]
},
options: {
jshintrc: 'jshint.server.json'
}
},
frontend: {
files: {
src: [
'frontend/javascripts/**/*.js',
'!frontend/javascripts/vendor/**/*.js'
]
},
options: {
jshintrc: 'jshint.client.json'
}
}
},
mochaTest: {
unit: {
options: {
reporter: 'spec',
ui: 'bdd'
},
src: [
'./test/mocha/setup.js',
'test/specs/**/*.js'
]
}
},
handlebars: {
compile: {
options: {
commonjs: true,
namespace: false,
processName: function (path) {
var filename = path.split('/')[1];
return filename.substr(0, filename.length-4);
}
},
files: {
'build/compiledTemplates.js': 'templates/*.hbs'
}
}
},
copy: {
images: {
expand: true,
cwd: 'frontend/images/',
src: '**',
dest: 'build/public/images/'
}
},
browserify: {
main: {
files: {
'build/public/javascripts/main.js': [
'lib/views/**/*.js',
'frontend/javascripts/main.js'
]
},
options: {
alias: [
'node_modules/jquery/dist/jquery.js:jquery',
'node_modules/lodash/dist/lodash.js:lodash',
'node_modules/backbone/backbone.js:backbone',
'node_modules/socket.io/node_modules/socket.io-client/lib/index.js:socket.io-client',
'frontend/javascripts/vendor/d3.js:d3',
'frontend/javascripts/vendor/rickshaw.js:rickshaw'
].concat((function () {
var files = grunt.file.expand({ cwd: __dirname }, 'lib/views/**/*.js');
return files.map(function (file) {
return file + ':' + file.substr(0, file.lastIndexOf('.'));
});
}())),
noParse: [
'jquery',
'lodash',
'backbone'
]
}
}
}
});
grunt.registerTask('compile', ['handlebars', 'copy', 'browserify']);
grunt.registerTask('test', ['jshint', 'mochaTest']);
};