Skip to content

Commit

Permalink
Improve grunt build
Browse files Browse the repository at this point in the history
  • Loading branch information
ooflorent committed Sep 26, 2013
1 parent a69c3a1 commit 7dc4309
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 21 deletions.
49 changes: 32 additions & 17 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-yuidoc');
grunt.loadNpmTasks('grunt-benchmark');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-simple-mocha');

var files = [
'support/head.js',
Expand All @@ -27,18 +27,31 @@ module.exports = function(grunt) {
'-W014': true,
'-W030': true,
},
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js', 'examples/**/*.js', 'benchmark/*.js'],
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint'],
makr: {
src: ['Gruntfile.js', 'src/**/*.js'],
},
benchmarks: {
src: ['benchmark/*.js', 'benchmark/fixtures/*.js'],
},
examples: {
src: ['examples/balls/**/*.js', 'examples/invaders/**/*.js'],
},
tests: {
src: ['test/**/*.js'],
},
},
concat: {
dist: {
makr: {
src: files,
dest: 'dist/makr.js',
},
},
uglify: {
makr: {
src: 'dist/makr.js',
dest: 'dist/makr.min.js',
},
},
yuidoc: {
compile: {
name: '<%= pkg.name %>',
Expand All @@ -51,12 +64,13 @@ module.exports = function(grunt) {
},
},
},
mochaTest: {
dist: {
options: {
reporter: 'spec',
},
src: 'test/**/*.js',
simplemocha: {
options: {
reporter: 'spec',
timeout: 5000,
},
all: {
src: 'test/*.js',
},
},
benchmark: {
Expand All @@ -71,8 +85,9 @@ module.exports = function(grunt) {
},
});

grunt.registerTask('default', ['jshint', 'concat', 'yuidoc']);
grunt.registerTask('test', ['concat', 'mochaTest']);
grunt.registerTask('perf', ['concat', 'benchmark']);
grunt.registerTask('default', ['jshint:makr', 'concat:makr', 'uglify:makr', 'jshint:examples']);
grunt.registerTask('docs', ['concat:makr', 'yuidoc']);
grunt.registerTask('test', ['concat:makr', 'jshint:examples', 'simplemocha:all']);
grunt.registerTask('perf', ['concat:makr', 'jshint:benchmark', 'benchmark']);

};
21 changes: 17 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
{
"name": "makrjs",
"version": "0.1.0",
"version": "0.1.0-snapshot",
"repository": {
"type": "git",
"url": "https://github.com/ooflorent/makrjs.git"
},
"devDependencies": {
"grunt": "~0.4",
"grunt-contrib-concat": "~0.3",
"grunt-contrib-jshint": "~0.6",
"grunt-contrib-watch": "~0.5",
"grunt-contrib-uglify": "~0.2",
"grunt-contrib-yuidoc": "~0.3",
"grunt-benchmark": "~0.2",
"grunt-mocha-test": "~0.6",
"grunt-simple-mocha": "~0.4.0",
"should": "*"
}
},
"scripts": {
"test": "grunt test"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/ooflorent/makrjs/blob/master/LICENSE"
}
]
}

0 comments on commit 7dc4309

Please sign in to comment.