From 3670ba57e8639f73853b5cafa95311352cac144e Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sat, 5 Oct 2013 08:46:53 +0200 Subject: [PATCH] Don't use the requirejs task, it doesn't support almond. Instead we build manually. Fixed paths in build.js --- Gruntfile.js | 61 ++++++++++++++-------------------------------------- build.js | 8 ++++++- package.json | 3 +++ 3 files changed, 26 insertions(+), 46 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ed1ab7572..fa3785480 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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'); diff --git a/build.js b/build.js index 0a0f44ef6..49c57192e 100644 --- a/build.js +++ b/build.js @@ -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" } }) diff --git a/package.json b/package.json index c1046fa72..4afa47471 100755 --- a/package.json +++ b/package.json @@ -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" } }