From 95dd2dac4b4afe337740509e9fbe6540c2d5bc5f 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 Conflicts: Gruntfile.js --- Gruntfile.js | 58 +++++++++++++++------------------------------------- package.json | 3 +++ 2 files changed, 19 insertions(+), 42 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 76dc1da96..df877ff85 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -28,47 +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", - "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", - "pt_BR": "locale/pt_BR/LC_MESSAGES/pt_BR", - "ru": "locale/ru/LC_MESSAGES/ru", - "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" - }, - 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'); @@ -107,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/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" } }