Don't use the requirejs task, it doesn't support almond.

Instead we build manually. Fixed paths in build.js
This commit is contained in:
JC Brand 2013-10-05 08:46:53 +02:00
parent e4a6223b86
commit 3670ba57e8
3 changed files with 26 additions and 46 deletions

View File

@ -28,50 +28,6 @@ module.exports = function(grunt) {
dest: 'converse.min.css',
src: ['converse.css']
}
},
requirejs: {
compile: {
options: {
baseUrl: ".",
name: "main",
out: "converse.min.js",
paths: {
"require": "components/requirejs/require",
"jquery": "components/jquery/jquery",
"jed": "components/jed/jed",
"crypto.aes": "components/crypto-js/src/aes",
"locales": "locale/locales",
"af": "locale/af/LC_MESSAGES/af",
"de": "locale/de/LC_MESSAGES/de",
"en": "locale/en/LC_MESSAGES/en",
"es": "locale/es/LC_MESSAGES/es",
"hu": "locale/hu/LC_MESSAGES/hu",
"it": "locale/it/LC_MESSAGES/it",
"fr": "locale/fr/LC_MESSAGES/fr",
"otr": "components/otr/lib/otr",
"pt_BR": "locale/pt_BR/LC_MESSAGES/pt_BR",
"ru": "locale/ru/LC_MESSAGES/ru",
"jquery.tinysort": "components/tinysort/src/jquery.tinysort",
"underscore": "components/underscore/underscore",
"backbone": "components/backbone/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"
},
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();
}
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-cssmin');
@ -110,7 +66,22 @@ module.exports = function(grunt) {
});
});
grunt.registerTask('minify', 'Create a new release', ['cssmin', 'requirejs']);
grunt.registerTask('jsmin', 'Create a new release', function () {
var done = this.async();
var child_process = require('child_process');
var exec = child_process.exec;
exec('./node_modules/requirejs/bin/r.js -o build.js',
function (err, stdout, stderr) {
if (err) {
grunt.log.write('build failed with error code '+err.code);
grunt.log.write(stderr);
}
grunt.log.write(stdout);
done();
});
});
grunt.registerTask('minify', 'Create a new release', ['cssmin', 'jsmin']);
grunt.registerTask('check', 'Perform all checks (e.g. before releasing)', function () {
grunt.task.run('jshint', 'test');

View File

@ -24,6 +24,12 @@
"strophe.muc": "components/strophe.muc/index",
"strophe.roster": "components/strophe.roster/index",
"strophe.vcard": "components/strophe.vcard/index",
"strophe.disco": "components/strophe.disco/index"
"strophe.disco": "components/strophe.disco/index",
"bigint": "components/otr/build/dep/bigint",
"crypto": "components/otr/build/dep/crypto",
"crypto.aes": "components/crypto-js/build/rollups/aes",
"eventemitter": "components/otr/build/dep/eventemitter",
"otr": "components/otr/build/otr",
"salsa20": "components/otr/build/dep/salsa20"
}
})

View File

@ -35,5 +35,8 @@
"bower": "~1.0.0",
"grunt-contrib-requirejs": "~0.4.1",
"grunt-contrib-cssmin": "~0.6.1"
},
"dependencies": {
"requirejs": "~2.1.8"
}
}