-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgruntfile.js
110 lines (98 loc) · 2.16 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
'use strict';
module.exports = function(grunt) {
// Unified Watch Object
var watchFiles = {
serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js'],
mochaTests: ['app/tests/**/*.js']
};
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
serverJS: {
files: watchFiles.serverJS,
//tasks: ['jshint'],
options: {
livereload: true
}
}
},
jshint: {
all: {
src: watchFiles.serverJS,
options: {
"node": true
}
}
},
nodemon: {
dev: {
script: 'server.js',
options: {
nodeArgs: ['--debug'],
ext: 'js,html',
watch: watchFiles.serverJS
}
}
},
'node-inspector': {
custom: {
options: {
'web-port': 8080,
'web-host': '127.0.0.1',
'debug-port': 5858,
'save-live-edit': true,
'no-preload': true,
'stack-trace-limit': 50,
'hidden': []
}
}
},
concurrent: {
default: ['nodemon', 'watch'],
debug: ['nodemon', 'watch', 'node-inspector'],
options: {
logConcurrentOutput: true,
limit: 10
}
},
env: {
test: {
NODE_ENV: 'test',
PORT: 3000
},
secure: {
NODE_ENV: 'secure'
},
development: {
NODE_ENV: 'development'
}
},
mochaTest: {
src: watchFiles.mochaTests,
options: {
reporter: 'spec',
require: 'server.js'
}
}
});
// Load NPM tasks
require('load-grunt-tasks')(grunt);
// Making grunt default to force in order not to break the project.
grunt.option('force', true);
// A Task for loading the configuration object
grunt.task.registerTask('loadConfig', 'Task that loads the config into a grunt option.', function() {
var init = require('./config/init')();
var config = require('./config/config');
});
// Default task(s).
grunt.registerTask('default', ['env:development', 'concurrent:default']);
// Debug task.
grunt.registerTask('debug', ['env:development', 'concurrent:debug']);
// Secure task(s).
//grunt.registerTask('secure', ['env:secure', 'concurrent:default']);
// Build task(s).
//grunt.registerTask('build', ['loadConfig']);
// Test task.
//grunt.registerTask('test', ['env:test', 'mochaTest']);
};