diff --git a/.travis.yml b/.travis.yml index c94c268..d00185a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,5 @@ language: node_js node_js: - 0.8 before_script: - - "npm install -g grunt" + - "npm install -g grunt-cli" - "npm install" diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..d3274cf --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,64 @@ +module.exports = function (grunt) { + require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); + + grunt.initConfig({ + coffee: { + lib: { + options: { bare: false }, + files: { + 'morris.js': ['build/morris.coffee'] + } + }, + spec: { + options: { bare: true }, + files: { + 'build/spec.js': ['build/spec.coffee'] + } + }, + }, + concat: { + 'build/morris.coffee': [ + 'lib/morris.coffee', + 'lib/morris.grid.coffee', + 'lib/morris.hover.coffee', + 'lib/morris.line.coffee', + 'lib/morris.area.coffee', + 'lib/morris.bar.coffee', + 'lib/morris.donut.coffee' + ], + 'build/spec.coffee': ['spec/support/**/*.coffee', 'spec/lib/**/*.coffee'] + }, + less: { + all: { + src: 'less/*.less', + dest: 'morris.css', + options: { + compress: true + } + } + }, + uglify: { + build: { + files: { + 'morris.min.js': 'morris.js' + } + } + }, + mocha: { + index: ['spec/specs.html'], + options: {run: true} + }, + watch: { + all: { + files: ['lib/**/*.coffee', 'spec/lib/**/*.coffee', 'spec/support/**/*.coffee', 'less/**/*.less'], + tasks: 'default' + }, + dev: { + files: 'lib/*.coffee' , + tasks: ['concat:build/morris.coffee', 'coffee:lib'] + } + }, + }); + + grunt.registerTask('default', ['concat', 'coffee', 'less', 'uglify', 'mocha']); +}; \ No newline at end of file diff --git a/grunt.js b/grunt.js deleted file mode 100644 index f2a73b6..0000000 --- a/grunt.js +++ /dev/null @@ -1,56 +0,0 @@ -module.exports = function (grunt) { - grunt.initConfig({ - coffee: { - lib: { - src: ['build/morris.coffee'], - dest: '.', - options: { bare: false } - }, - spec: { - src: ['build/spec.coffee'], - dest: 'build', - options: { bare: true } - } - }, - concat: { - 'build/morris.coffee': [ - 'lib/morris.coffee', - 'lib/morris.grid.coffee', - 'lib/morris.hover.coffee', - 'lib/morris.line.coffee', - 'lib/morris.area.coffee', - 'lib/morris.bar.coffee', - 'lib/morris.donut.coffee' - ], - 'build/spec.coffee': ['spec/support/**/*.coffee', 'spec/lib/**/*.coffee'] - }, - less: { - all: { - src: 'less/*.less', - dest: 'morris.css', - options: { - compress: true - } - } - }, - min: { - 'morris.min.js': 'morris.js' - }, - mocha: { - spec: { - src: 'spec/specs.html', - run: true - } - }, - watch: { - files: ['lib/**/*.coffee', 'spec/lib/**/*.coffee', 'spec/support/**/*.coffee', 'less/**/*.less'], - tasks: 'default' - } - }); - - grunt.loadNpmTasks('grunt-coffee'); - grunt.loadNpmTasks('grunt-mocha'); - grunt.loadNpmTasks('grunt-contrib-less'); - - grunt.registerTask('default', 'concat coffee less min mocha'); -}; diff --git a/package.json b/package.json index 7948066..cfad052 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,19 @@ "url": "https://github.com/oesmith/morris.js/issues" }, "devDependencies": { - "grunt-coffee": "~> 0.0.6", - "grunt-mocha": "~> 0.1.7", - "grunt-contrib-less": "~> 0.3.2", - "grunt": "~> 0.3.17" + "matchdep": "~0.1.2", + "grunt": "~0.4.1", + "grunt-mocha": "~0.4.1", + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-coffee": "~0.7.0", + "grunt-contrib-uglify": "~0.2.4", + "grunt-contrib-less": "~0.7.0", + "grunt-contrib-watch": "~0.5.3" }, "scripts": { - "test": "./node_modules/.bin/grunt coffee mocha" + "test": "grunt coffee mocha" + }, + "engines": { + "node": ">=0.8 <0.11" } }