-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
113 lines (99 loc) · 3.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
111
112
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
// define the files to lint
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
// configure JSHint (documented at http://www.jshint.com/docs/)
options: {
// more options here if you want to override JSHint defaults
globals: {
console: true,
module: true
}
}
},
clean: {
build: {
src: ["./browser-dist"]
}
},
/* // currently there is no need for that
copy: {
main: {
expand : true,
cwd: 'src/',
src: ['model.js', 'modelizer.js', 'microlibs.js', 'modelizer-client.js', 'angular-client.js'],
dest: 'lib/',
options: {
mode: '0444' // remove write permission (so you can't change generated code)
}
}
},
*/
watch: {
files: ['<%= jshint.files %>'],
tasks: ['build']
},
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: ['test/*.js']
}
},
karma: {
client: {
configFile: './test/integration/karma-client-connector.conf.js',
singleRun: true
},
angular: {
configFile: './test/integration/karma-angular-connector.conf.js',
singleRun: true
}//,
// phantom : {
// configFile: './test/integration/karma-client-connector.conf.js',
// singleRun: true,
// browsers: ['PhantomJS']
// }
},
// browserify ./lib/modelizer-client.js -r ./lib/modelizer-client:modelizer -r q -o ./browser-dist/modelizer.js
// browserify ./lib/angular-client.js -r ./lib/angular-client:modelizer -r q -o ./browser-dist/modelizer-angular.js
browserify: {
client : {
src : './lib/modelizer-client.js',
dest : './browser-dist/modelizer.js',
options: {
require : ['q'],
alias: ['./lib/modelizer-client:modelizer', 'objectid-browser:./objectid']
}
},
angular : {
src : './lib/angular-client.js',
dest : './browser-dist/modelizer-angular.js',
options: {
require : ['q'],
alias: ['./lib/angular-client:modelizer', 'objectid-browser:./objectid']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-npm-install');
grunt.registerTask('build', ['clean', 'browserify']);
grunt.registerTask('dist', ['npm-install', "build"]);
// this would be run by typing "grunt test" on the command line
grunt.registerTask('test', ['build', 'mochaTest', 'karma']);
//grunt.registerTask('test', ['jshint', 'mochaTest']);
// the default task can be run just by typing "grunt" on the command line
//grunt.registerTask('default', ['jshint', 'mochaTest', 'copy']);
grunt.registerTask('default', ['dist', 'mochaTest']);
}