Skip to content

Commit 7dc4309

Browse files
committed
Improve grunt build
1 parent a69c3a1 commit 7dc4309

File tree

2 files changed

+49
-21
lines changed

2 files changed

+49
-21
lines changed

Gruntfile.js

+32-17
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ module.exports = function(grunt) {
22

33
grunt.loadNpmTasks('grunt-contrib-concat');
44
grunt.loadNpmTasks('grunt-contrib-jshint');
5-
grunt.loadNpmTasks('grunt-contrib-watch');
5+
grunt.loadNpmTasks('grunt-contrib-uglify');
66
grunt.loadNpmTasks('grunt-contrib-yuidoc');
77
grunt.loadNpmTasks('grunt-benchmark');
8-
grunt.loadNpmTasks('grunt-mocha-test');
8+
grunt.loadNpmTasks('grunt-simple-mocha');
99

1010
var files = [
1111
'support/head.js',
@@ -27,18 +27,31 @@ module.exports = function(grunt) {
2727
'-W014': true,
2828
'-W030': true,
2929
},
30-
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js', 'examples/**/*.js', 'benchmark/*.js'],
31-
},
32-
watch: {
33-
files: ['<%= jshint.files %>'],
34-
tasks: ['jshint'],
30+
makr: {
31+
src: ['Gruntfile.js', 'src/**/*.js'],
32+
},
33+
benchmarks: {
34+
src: ['benchmark/*.js', 'benchmark/fixtures/*.js'],
35+
},
36+
examples: {
37+
src: ['examples/balls/**/*.js', 'examples/invaders/**/*.js'],
38+
},
39+
tests: {
40+
src: ['test/**/*.js'],
41+
},
3542
},
3643
concat: {
37-
dist: {
44+
makr: {
3845
src: files,
3946
dest: 'dist/makr.js',
4047
},
4148
},
49+
uglify: {
50+
makr: {
51+
src: 'dist/makr.js',
52+
dest: 'dist/makr.min.js',
53+
},
54+
},
4255
yuidoc: {
4356
compile: {
4457
name: '<%= pkg.name %>',
@@ -51,12 +64,13 @@ module.exports = function(grunt) {
5164
},
5265
},
5366
},
54-
mochaTest: {
55-
dist: {
56-
options: {
57-
reporter: 'spec',
58-
},
59-
src: 'test/**/*.js',
67+
simplemocha: {
68+
options: {
69+
reporter: 'spec',
70+
timeout: 5000,
71+
},
72+
all: {
73+
src: 'test/*.js',
6074
},
6175
},
6276
benchmark: {
@@ -71,8 +85,9 @@ module.exports = function(grunt) {
7185
},
7286
});
7387

74-
grunt.registerTask('default', ['jshint', 'concat', 'yuidoc']);
75-
grunt.registerTask('test', ['concat', 'mochaTest']);
76-
grunt.registerTask('perf', ['concat', 'benchmark']);
88+
grunt.registerTask('default', ['jshint:makr', 'concat:makr', 'uglify:makr', 'jshint:examples']);
89+
grunt.registerTask('docs', ['concat:makr', 'yuidoc']);
90+
grunt.registerTask('test', ['concat:makr', 'jshint:examples', 'simplemocha:all']);
91+
grunt.registerTask('perf', ['concat:makr', 'jshint:benchmark', 'benchmark']);
7792

7893
};

package.json

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
{
22
"name": "makrjs",
3-
"version": "0.1.0",
3+
"version": "0.1.0-snapshot",
4+
"repository": {
5+
"type": "git",
6+
"url": "https://github.com/ooflorent/makrjs.git"
7+
},
48
"devDependencies": {
59
"grunt": "~0.4",
610
"grunt-contrib-concat": "~0.3",
711
"grunt-contrib-jshint": "~0.6",
8-
"grunt-contrib-watch": "~0.5",
12+
"grunt-contrib-uglify": "~0.2",
913
"grunt-contrib-yuidoc": "~0.3",
1014
"grunt-benchmark": "~0.2",
11-
"grunt-mocha-test": "~0.6",
15+
"grunt-simple-mocha": "~0.4.0",
1216
"should": "*"
13-
}
17+
},
18+
"scripts": {
19+
"test": "grunt test"
20+
},
21+
"licenses": [
22+
{
23+
"type": "MIT",
24+
"url": "https://github.com/ooflorent/makrjs/blob/master/LICENSE"
25+
}
26+
]
1427
}

0 commit comments

Comments
 (0)