Updated gruntfile and package.json for grunt 0.4.0

This commit is contained in:
Ian Gilman 2013-02-21 10:45:14 -08:00
parent 347fbfd596
commit d6dfc15351
2 changed files with 44 additions and 41 deletions

View File

@ -1,6 +1,12 @@
module.exports = function(grunt) { module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-compress"); grunt.loadNpmTasks("grunt-contrib-compress");
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
var distribution = "build/openseadragon.js", var distribution = "build/openseadragon.js",
minified = "build/openseadragon.min.js", minified = "build/openseadragon.min.js",
@ -37,16 +43,16 @@ module.exports = function(grunt) {
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
pkg: "<json:package.json>", pkg: "<json:package.json>",
meta: { concat: {
options: {
banner: "/**\n * @version <%= pkg.name %> <%= pkg.version %>\n */" banner: "/**\n * @version <%= pkg.name %> <%= pkg.version %>\n */"
}, },
concat: {
dist: { dist: {
src: [ "<banner>" ].concat(sources), src: [ "<banner>" ].concat(sources),
dest: distribution dest: distribution
} }
}, },
min: { uglify: {
openseadragon: { openseadragon: {
src: [ distribution ], src: [ distribution ],
dest: minified dest: minified
@ -67,36 +73,27 @@ module.exports = function(grunt) {
qunit: { qunit: {
all: [ "http://localhost:8000/test/test.html" ] all: [ "http://localhost:8000/test/test.html" ]
}, },
server: { connect: {
options: {
port: 8000, port: 8000,
base: "." base: "."
}
}, },
watch: { watch: {
files: [ "grunt.js", "src/*.js" ], files: [ "grunt.js", "src/*.js" ],
tasks: "default" tasks: "default"
}, },
lint: {
beforeconcat: sources,
afterconcat: [ distribution ]
},
jshint: { jshint: {
options: { options: {
browser: true, browser: true,
eqeqeq: false, eqeqeq: false,
loopfunc: false loopfunc: false,
/*curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
eqnull: true,*/
},
globals: { globals: {
OpenSeadragon: true OpenSeadragon: true
} }
},
beforeconcat: sources,
afterconcat: [ distribution ]
} }
}); });
@ -108,12 +105,12 @@ module.exports = function(grunt) {
}); });
// Default task. // Default task.
grunt.registerTask("default", "lint:beforeconcat concat lint:afterconcat min copy"); grunt.registerTask("default", ["jshint:beforeconcat", "concat", "jshint:afterconcat", "uglify", "copy"]);
// Test task. // Test task.
grunt.registerTask("test", "default server qunit"); grunt.registerTask("test", ["default", "connect", "qunit"]);
// Package task. // Package task.
grunt.registerTask("package", "default compress"); grunt.registerTask("package", ["default", "compress"]);
}; };

View File

@ -3,10 +3,16 @@
"version": "0.9.120", "version": "0.9.120",
"description": "Provides a smooth, zoomable user interface for HTML/Javascript.", "description": "Provides a smooth, zoomable user interface for HTML/Javascript.",
"dependencies": { "dependencies": {
"grunt": "0.3.17", "grunt": "~0.4.0",
"qunitjs": "1.11.0", "qunitjs": "1.11.0",
"phantomjs": "1.8.1-3", "phantomjs": "1.8.1-3",
"grunt-contrib-compress": "0.3.3" "grunt-contrib-compress": "~0.4.0",
"grunt-contrib-concat": "~0.1.2",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-uglify": "~0.1.1",
"grunt-contrib-qunit": "~0.1.1",
"grunt-contrib-connect": "~0.1.2",
"grunt-contrib-watch": "~0.2.0"
}, },
"scripts": { "scripts": {
"test": "grunt test" "test": "grunt test"