-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gruntfile.js
116 lines (110 loc) · 3.02 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
112
113
114
115
116
'use strict';
module.exports = function(grunt) {
require('time-grunt')(grunt);
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
js: {
files: ['gruntfile.js', 'application.js', 'public/**/*.js'],
options: {
livereload: true
}
},
html: {
files: ['public/*.html'],
options: {
livereload: true
}
}
},
nodemon: {
dev: {
script: 'application.js',
options: {
args: [],
ignore: ['public/**'],
ext: 'js,html',
nodeArgs: [],
delayTime: 1,
env: {
PORT: 3000
},
cwd: __dirname
}
}
},
concurrent: {
serve: ['nodemon', 'watch', 'open:liveCloud'],
serveLocal: ['nodemon', 'watch', 'open:localCloud'],
debug: ['node-inspector', 'shell:debug', 'open:debug'],
options: {
logConcurrentOutput: true
}
},
env : {
options : {},
// environment variables - see https://github.com/jsoverson/grunt-env for more information
local: {
FH_USE_LOCAL_DB: true,
FH_SERVICE_MAP: function() {
/*
* Define the mappings for your services here - for local development.
* You must provide a mapping for each service you wish to access
* This can be a mapping to a locally running instance of the service (for local development)
* or a remote instance.
*/
var serviceMap = {
'SERVICE_GUID_1': 'http://127.0.0.1:8010',
'SERVICE_GUID_2': 'https://host-and-path-to-service'
};
return JSON.stringify(serviceMap);
}
}
},
'node-inspector': {
dev: {}
},
shell: {
debug: {
options: {
stdout: true
},
command: 'env NODE_PATH=. node --debug-brk application.js'
}
},
open: {
debug: {
path: 'http://127.0.0.1:8001/debug?port=5858',
app: 'Google Chrome'
},
localCloud: {
path: 'http://127.0.0.1:8001?url=http://127.0.0.1:8080',
app: 'Google Chrome'
},
liveCloud: {
path: 'http://127.0.0.1:8001',
app: 'Google Chrome'
}
},
browserify: {
'public/main.js': ['public/init.js']
}
});
// Load NPM tasks
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});
// Making grunt default to force in order not to break the project.
grunt.option('force', true);
grunt.registerTask('serve', function (target) {
if (target === 'local') {
grunt.task.run(['env:local','concurrent:serveLocal']);
} else {
// open with no url passed to fh-js-sdk
grunt.task.run(['env:local', 'concurrent:serve']);
}
});
// grunt.registerTask('serve', ['env:local', 'concurrent:serve']);
grunt.registerTask('debug', ['env:local', 'concurrent:debug']);
grunt.registerTask('default', ['serve']);
grunt.loadNpmTasks('grunt-browserify');
};