Simplified the grunt release task
This commit is contained in:
parent
ab02828fee
commit
04e39fafb1
37
Gruntfile.js
37
Gruntfile.js
@ -1,4 +1,5 @@
|
|||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
var cfg = require('./package.json');
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
jshint: {
|
jshint: {
|
||||||
options: {
|
options: {
|
||||||
@ -24,7 +25,7 @@ module.exports = function(grunt) {
|
|||||||
"*/"
|
"*/"
|
||||||
},
|
},
|
||||||
minify: {
|
minify: {
|
||||||
dest: 'converse.min.css',
|
dest: 'converse-'+cfg.version+'.min.css',
|
||||||
src: ['converse.css']
|
src: ['converse.css']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -33,8 +34,9 @@ module.exports = function(grunt) {
|
|||||||
options: {
|
options: {
|
||||||
baseUrl: ".",
|
baseUrl: ".",
|
||||||
name: "main",
|
name: "main",
|
||||||
out: "converse.min.js",
|
out: "converse-"+cfg.version+".min.js",
|
||||||
paths: {
|
paths: {
|
||||||
|
"require": "components/requirejs/require",
|
||||||
"jquery": "components/jquery/jquery",
|
"jquery": "components/jquery/jquery",
|
||||||
"jed": "components/jed/jed",
|
"jed": "components/jed/jed",
|
||||||
"locales": "locale/locales",
|
"locales": "locale/locales",
|
||||||
@ -54,6 +56,15 @@ module.exports = function(grunt) {
|
|||||||
"strophe.roster": "components/strophe.roster/index",
|
"strophe.roster": "components/strophe.roster/index",
|
||||||
"strophe.vcard": "components/strophe.vcard/index",
|
"strophe.vcard": "components/strophe.vcard/index",
|
||||||
"strophe.disco": "components/strophe.disco/index"
|
"strophe.disco": "components/strophe.disco/index"
|
||||||
|
},
|
||||||
|
done: function(done, output) {
|
||||||
|
var duplicates = require('rjs-build-analysis').duplicates(output);
|
||||||
|
if (duplicates.length > 0) {
|
||||||
|
grunt.log.subhead('Duplicates found in requirejs build:');
|
||||||
|
grunt.log.warn(duplicates);
|
||||||
|
done(new Error('r.js built duplicate modules, please check the excludes option.'));
|
||||||
|
}
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,27 +106,7 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
grunt.registerTask('minify', 'Minify JC and CSS files', ['requirejs', 'cssmin']);
|
grunt.registerTask('release', 'Create a new release', ['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');
|
||||||
|
Loading…
Reference in New Issue
Block a user