Add Grunt tasks to help with creating releases.
This commit is contained in:
parent
242ce06745
commit
1ec3fef131
71
Gruntfile.js
71
Gruntfile.js
@ -13,9 +13,56 @@ module.exports = function(grunt) {
|
|||||||
'spec/*.js'
|
'spec/*.js'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
cssmin: {
|
||||||
|
options: {
|
||||||
|
banner: "/*"+
|
||||||
|
"* Converse.js (Web-based XMPP instant messaging client) \n"+
|
||||||
|
"* http://conversejs.org \n"+
|
||||||
|
"* Copyright (c) 2012, Jan-Carel Brand <jc@opkode.com> \n"+
|
||||||
|
"* Dual licensed under the MIT and GPL Licenses \n"+
|
||||||
|
"*/"
|
||||||
|
},
|
||||||
|
minify: {
|
||||||
|
dest: 'converse.min.css',
|
||||||
|
src: ['converse.css']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
requirejs: {
|
||||||
|
compile: {
|
||||||
|
options: {
|
||||||
|
baseUrl: ".",
|
||||||
|
name: "main",
|
||||||
|
out: "converse.min.js",
|
||||||
|
paths: {
|
||||||
|
"jquery": "components/jquery/jquery",
|
||||||
|
"jed": "components/jed/jed",
|
||||||
|
"locales": "locale/locales",
|
||||||
|
"af": "locale/af/LC_MESSAGES/af",
|
||||||
|
"en": "locale/en/LC_MESSAGES/en",
|
||||||
|
"de": "locale/de/LC_MESSAGES/de",
|
||||||
|
"es": "locale/es/LC_MESSAGES/es",
|
||||||
|
"it": "locale/it/LC_MESSAGES/it",
|
||||||
|
"pt_BR": "locale/pt_BR/LC_MESSAGES/pt_BR",
|
||||||
|
"sjcl": "components/sjcl/sjcl",
|
||||||
|
"tinysort": "components/tinysort/src/jquery.tinysort",
|
||||||
|
"underscore": "components/underscore/underscore",
|
||||||
|
"backbone": "components/backbone/backbone",
|
||||||
|
"localstorage": "components/backbone.localStorage/backbone.localStorage",
|
||||||
|
"strophe": "components/strophe/strophe",
|
||||||
|
"strophe.muc": "components/strophe.muc/index",
|
||||||
|
"strophe.roster": "components/strophe.roster/index",
|
||||||
|
"strophe.vcard": "components/strophe.vcard/index",
|
||||||
|
"strophe.disco": "components/strophe.disco/index"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
||||||
|
|
||||||
grunt.registerTask('test', 'Run Tests', function () {
|
grunt.registerTask('test', 'Run Tests', function () {
|
||||||
var done = this.async();
|
var done = this.async();
|
||||||
var child_process = require('child_process');
|
var child_process = require('child_process');
|
||||||
@ -33,7 +80,7 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
grunt.registerTask('build', 'Set up the development environment', function () {
|
grunt.registerTask('fetch', 'Set up the development environment', function () {
|
||||||
var done = this.async();
|
var done = this.async();
|
||||||
var child_process = require('child_process');
|
var child_process = require('child_process');
|
||||||
var exec = child_process.exec;
|
var exec = child_process.exec;
|
||||||
@ -48,6 +95,28 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
grunt.registerTask('minify', 'Minify JC and CSS files', ['requirejs', 'cssmin']);
|
||||||
|
|
||||||
|
grunt.registerTask('rename', 'Rename minified files to include version number', function () {
|
||||||
|
var cfg = require('./package.json');
|
||||||
|
grunt.log.write('The release version is '+cfg.version);
|
||||||
|
var done = this.async();
|
||||||
|
var child_process = require('child_process');
|
||||||
|
var exec = child_process.exec;
|
||||||
|
exec('mv converse.min.js converse-'+cfg.version+'.min.js &&'+
|
||||||
|
'mv converse.min.css converse-'+cfg.version+'.min.css',
|
||||||
|
function (err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
grunt.log.write('rename failed with error code '+err.code);
|
||||||
|
grunt.log.write(stderr);
|
||||||
|
}
|
||||||
|
grunt.log.write(stdout);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.registerTask('release', 'Create a new release', ['minify', 'rename']);
|
||||||
|
|
||||||
grunt.registerTask('check', 'Perform all checks (e.g. before releasing)', function () {
|
grunt.registerTask('check', 'Perform all checks (e.g. before releasing)', function () {
|
||||||
grunt.task.run('jshint', 'test');
|
grunt.task.run('jshint', 'test');
|
||||||
});
|
});
|
||||||
|
26
build.js
26
build.js
@ -1,26 +0,0 @@
|
|||||||
({
|
|
||||||
baseUrl: ".",
|
|
||||||
paths: {
|
|
||||||
"jquery": "Libraries/require-jquery",
|
|
||||||
"jed": "Libraries/jed",
|
|
||||||
"locales": "locale/locales",
|
|
||||||
"af": "locale/af/LC_MESSAGES/af",
|
|
||||||
"en": "locale/en/LC_MESSAGES/en",
|
|
||||||
"de": "locale/de/LC_MESSAGES/de",
|
|
||||||
"es": "locale/es/LC_MESSAGES/es",
|
|
||||||
"it": "locale/it/LC_MESSAGES/it",
|
|
||||||
"pt_BR": "locale/pt_BR/LC_MESSAGES/pt_BR",
|
|
||||||
"sjcl": "Libraries/sjcl",
|
|
||||||
"tinysort": "Libraries/jquery.tinysort",
|
|
||||||
"underscore": "Libraries/underscore",
|
|
||||||
"backbone": "Libraries/backbone",
|
|
||||||
"localstorage": "Libraries/backbone.localStorage",
|
|
||||||
"strophe": "Libraries/strophe",
|
|
||||||
"strophe.muc": "Libraries/strophe.muc",
|
|
||||||
"strophe.roster": "Libraries/strophe.roster",
|
|
||||||
"strophe.vcard": "Libraries/strophe.vcard",
|
|
||||||
"strophe.disco": "Libraries/strophe.disco"
|
|
||||||
},
|
|
||||||
name: "main",
|
|
||||||
out: "converse.min.js"
|
|
||||||
})
|
|
@ -32,6 +32,8 @@
|
|||||||
"grunt-contrib-jshint": "~0.6.0",
|
"grunt-contrib-jshint": "~0.6.0",
|
||||||
"phantomjs": "~1.9.1-0",
|
"phantomjs": "~1.9.1-0",
|
||||||
"jasmine-reporters": "~0.2.1",
|
"jasmine-reporters": "~0.2.1",
|
||||||
"bower": "~1.0.0"
|
"bower": "~1.0.0",
|
||||||
|
"grunt-contrib-requirejs": "~0.4.1",
|
||||||
|
"grunt-contrib-cssmin": "~0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user