Skip to content

Commit 9e7272a

Browse files
committed
Merge pull request #10 from AnyPresence/develop
Develop
2 parents a7bd9df + d406a65 commit 9e7272a

32 files changed

+3405
-1192
lines changed

Gruntfile.js

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ module.exports = function(grunt) {
22

33
// Project configuration.
44
grunt.initConfig({
5+
pkg: grunt.file.readJSON('package.json'),
6+
57
browserify: {
68
dist: {
79
files: {
8-
'dist/ap_gateway.js': ['index.js']
10+
'dist/<%=pkg.name%>-v<%=pkg.version%>.js': ['index.js']
911
},
1012
options: {
1113
watch: true
1214
}
1315
}
1416
},
15-
17+
1618
jshint: {
1719
lib: ['lib/**/*.js'],
1820
options: {
@@ -21,22 +23,62 @@ module.exports = function(grunt) {
2123
browserify: true
2224
}
2325
},
24-
26+
27+
clean: {
28+
dist: ['dist/*']
29+
},
30+
31+
uglify: {
32+
dist: {
33+
options: {
34+
sourceMap: true
35+
},
36+
files: {
37+
'dist/<%=pkg.name%>-v<%=pkg.version%>.min.js': ['dist/<%=pkg.name%>-v<%=pkg.version%>.js']
38+
}
39+
}
40+
},
41+
2542
watch: {
2643
lint: {
2744
files: ['lib/**/*.js'],
2845
tasks: ['jshint']
2946
}
47+
},
48+
49+
mochify: {
50+
tests: {
51+
src: ['test/browser/*.js']
52+
}
53+
},
54+
55+
mochaTest: {
56+
tests: {
57+
src: ['test/node/*.js']
58+
}
3059
}
3160
});
3261

3362
grunt.loadNpmTasks('grunt-contrib-jshint');
3463
grunt.loadNpmTasks('grunt-contrib-watch');
3564
grunt.loadNpmTasks('grunt-browserify');
65+
grunt.loadNpmTasks('grunt-mochify');
66+
grunt.loadNpmTasks('grunt-mocha-test');
67+
grunt.loadNpmTasks('grunt-contrib-uglify');
68+
grunt.loadNpmTasks('grunt-contrib-clean');
69+
70+
71+
// Testing tasks
72+
grunt.registerTask('test-node', ['jshint', 'mochaTest']);
73+
grunt.registerTask('test-browser', ['browserify', 'jshint', 'mochify']);
74+
grunt.registerTask('test', ['test-node', 'test-browser']);
3675

37-
grunt.registerTask('compile', ['browserify', 'jshint', 'watch']);
76+
// Build distributable
77+
grunt.registerTask('build', ['clean:dist', 'browserify', 'jshint', 'uglify']);
78+
// Build and watch
79+
grunt.registerTask('development', ['build', 'watch']);
3880

3981
// Default task(s).
40-
grunt.registerTask('default', ['compile']);
82+
grunt.registerTask('default', ['build']);
4183

42-
};
84+
};

0 commit comments

Comments
 (0)