From: Jörn Zaefferer Date: Fri, 2 Mar 2012 15:45:10 +0000 (+0100) Subject: First iteration on grunt-based build. lint, qunit, concat, min and zip all work,... X-Git-Tag: 1.9.0m8~218 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=69dcb76e6b4095f221dbe63e8658a18594a39d83;p=jquery-ui.git First iteration on grunt-based build. lint, qunit, concat, min and zip all work, but all have various limiations. --- diff --git a/.gitignore b/.gitignore index 70f7a9c79..dc1bdf6c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ build/dist build/size build/build/.sizecache.json +dist +node_modules docs .project *~ diff --git a/grunt.js b/grunt.js new file mode 100644 index 000000000..b935a0bc7 --- /dev/null +++ b/grunt.js @@ -0,0 +1,99 @@ +/*global config:true, task:true*/ +var coreFiles = 'jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js'.split(', '); +config.init({ + pkg: '', + meta: { + banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + + '<%= template.today("m/d/yyyy") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + + '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' + }, + concat: { + // 'dist/ui/jquery-ui.js': ['', ''] + 'dist/jquery-ui.js': coreFiles.map(function(file) { + return 'ui/' + file; + }).concat(file.expand('ui/*.js').filter(function(file) { + return coreFiles.indexOf(file.substring(3)) === -1; + })) + }, + min: { + 'dist/jquery-ui.min.js': ['', 'dist/jquery-ui.js'] + }, + zip: { + dist: { + src: [ + 'dist/**/*.js', + 'README.md', + 'grunt.js', + 'package.json', + 'ui/**/*', + 'demos/**/*', + 'themes/**/*', + 'external/**/*', + 'tests/**/*' + ], + dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip' + } + }, + qunit: { + files: file.expand('tests/unit/**/*.html').filter(function(file) { + // disabling everything that doesn't (quite) work with PhantomJS for now + // except for all|index|test, try to include more as we go + return !(/(all|index|test|draggable|droppable|selectable|resizable|sortable|dialog|slider|datepicker|tabs|tabs_deprecated)\.html/).test(file); + }) + }, + lint: { + // TODO extend this to tests + files: ['ui/*'] + }, + jshint: { + options: { + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + eqnull: true, + browser: true + }, + globals: { + jQuery: true + } + } +}); + +task.registerBasicTask('zip', 'Create a zip file for release', function(data) { + var files = file.expand(data.src); + log.writeln("Creating zip file " + data.dest); + + var done = this.async(); + + var zipstream = require('zipstream'); + var fs = require('fs'); + + var out = fs.createWriteStream(data.dest); + var zip = zipstream.createZip({ level: 1 }); + + zip.pipe(out); + + function addFile() { + if (!files.length) { + zip.finalize(function(written) { + log.writeln(written + ' total bytes written'); + done(); + }); + return; + } + var file = files.shift(); + log.verbose.writeln('Zipping ' + file); + zip.addFile(fs.createReadStream(file), { name: file }, addFile); + } + addFile(); +}); + +task.registerTask('default', 'lint qunit'); +task.registerTask('release', 'default concat min zip'); diff --git a/package.json b/package.json new file mode 100644 index 000000000..f1bbdf69d --- /dev/null +++ b/package.json @@ -0,0 +1,33 @@ +{ + "name": "jquery-ui", + "title": "jQuery UI", + "description": "Abstractions for low-level interaction and animation, advanced effects and high-level, themeable widgets, built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications.", + "version": "1.9.0pre", + "homepage": "https://github.com/jquery/jquery-ui", + "author": { + "name": "AUTHORS.txt" + }, + "repository": { + "type": "git", + "url": "git://github.com/jquery/jquery-ui.git" + }, + "bugs": { + "url": "http://bugs.jqueryui.com/" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + }, + { + "type": "GPL", + "url": "http://www.opensource.org/licenses/GPL-2.0" + } + ], + "dependencies": {}, + "devDependencies": { + "grunt": "0.2.x", + "zipstream": "0.2.x" + }, + "keywords": [] +} \ No newline at end of file