Add a build step to create a build of only the converse.js modules

This is now used in non_amd.html and means that the individual converse.js
modules don't need to support the non-AMD case.
This commit is contained in:
JC Brand 2016-02-26 17:28:18 +00:00
parent d349bdc17c
commit ba05d4e779
12 changed files with 10938 additions and 43928 deletions

3
.gitignore vendored
View File

@ -43,6 +43,7 @@ develop-eggs
.DS_Store
# Builds
builds/converse-no-dependencies.min.js
builds/converse-no-locales-no-otr.js
builds/converse-no-locales-no-otr.min.js
builds/converse-no-otr.js
@ -52,3 +53,5 @@ builds/converse.nojquery.js
builds/converse.nojquery.min.js
css/converse.css.map
.sv?

View File

@ -60,6 +60,8 @@ module.exports = function(grunt) {
rjs + ' -o src/build.js optimize=none out=builds/converse.js && ' +
rjs + ' -o src/build-no-jquery.js &&' +
rjs + ' -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' +
rjs + ' -o src/build-no-dependencies.js &&' +
rjs + ' -o src/build-no-dependencies.js optimize=none out=builds/converse-no-dependencies.js && ' +
rjs + ' -o src/build-no-locales-no-otr.js && ' +
rjs + ' -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js', callback);
// XXX: It might be possible to not have separate build config files. For example:

View File

@ -7,6 +7,7 @@ HTTPSERVE ?= ./node_modules/.bin/http-server
JSHINT ?= ./node_modules/.bin/jshint
PAPER =
PHANTOMJS ?= ./node_modules/.bin/phantomjs
RJS ?= ./node_modules/.bin/r.js
PO2JSON ?= ./node_modules/.bin/po2json
SASS ?= ./.bundle/bin/sass
SPHINXBUILD ?= ./bin/sphinx-build
@ -119,7 +120,7 @@ clean::
rm -rf node_modules components .bundle
.PHONY: dev
dev: stamp-bower stamp-bundler
dev: stamp-bower stamp-bundler converse
########################################################################
## Builds
@ -142,6 +143,11 @@ jsmin:
cssmin: stamp-npm
$(GRUNT) cssmin
.PHONY: converse
converse:: stamp-npm
$(RJS) -o src/build-no-dependencies.js
$(RJS) -o src/build-no-dependencies.js optimize=none out=builds/converse-no-dependencies.js
.PHONY: build
build:: stamp-npm
$(GRUNT) jst
@ -168,7 +174,7 @@ html:
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: doc
.PHONY: html
doc: html
.PHONY: epub

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1061,6 +1061,17 @@ __p += '\n<li class="toggle-clear"><a class="icon-remove" title="' +
'"></a></li>\n';
} ;
__p += '\n';
}
return __p
};
this["templates"]["toolbar_otr"] = function(obj) {
obj || (obj = {});
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
with (obj) {
if (allow_otr) { ;
__p += '\n <li class="toggle-otr ' +
((__t = (otr_status_class)) == null ? '' : __t) +

View File

@ -46,10 +46,7 @@
<script type="text/javascript" src="components/jed/jed.js"></script>
<script type="text/javascript" src="builds/locales.js"></script>
<script type="text/javascript" src="builds/templates.js"></script>
<script type="text/javascript" src="src/utils.js"></script>
<script type="text/javascript" src="src/converse-core.js"></script>
<script type="text/javascript" src="src/converse-muc.js"></script>
<script type="text/javascript" src="src/converse-otr.js"></script>
<script type="text/javascript" src="builds/converse-no-dependencies.js"></script>
</head>
<body id="page-top" data-spy="scroll" data-target=".navbar-custom">
<section class="intro">
@ -69,13 +66,15 @@
</body>
<script>
converse.initialize({
bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported
prebind: false,
show_controlbox_by_default: true,
debug: true,
roster_groups: true
require(['converse'], function (converse) {
converse.initialize({
bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported
prebind: false,
show_controlbox_by_default: true,
debug: true,
roster_groups: true
});
});
</script>
</html>

View File

@ -0,0 +1,25 @@
({
baseUrl: "../",
name: "components/almond/almond.js",
out: "../builds/converse-no-dependencies.min.js",
include: ['converse'],
exclude: [
'jquery',
'jquery-private',
"backbone.browserStorage",
"backbone.overview",
"moment_with_locales",
"strophe",
"strophe.disco",
"strophe.rsm",
"strophe.vcard",
"typeahead",
"otr",
"underscore"
],
wrap: {
endFile: "wrapper-end.js"
},
insertRequire: ['converse'],
mainConfigFile: '../main.js'
})

View File

@ -3,9 +3,6 @@
name: "components/almond/almond.js",
out: "../builds/converse.nojquery.min.js",
include: ['main'],
mainConfigFile: '../main.js',
paths: {
"jquery": "src/jquery-external",
"jquery-private": "src/jquery-private-external",
}
exclude: ['jquery', 'jquery-private'],
mainConfigFile: '../main.js'
})

View File

@ -1,4 +0,0 @@
/*global jQuery */
define('jquery', [], function () {
return jQuery;
});

View File

@ -1,3 +0,0 @@
define(['jquery'], function (jq) {
return jq;
});

30
src/wrapper-end.js Normal file
View File

@ -0,0 +1,30 @@
/*global jQuery, _, moment */
define('jquery', [], function () { return jQuery; });
define('jquery.browser', [], function () { return jQuery; });
define('typeahead', [], function () { return jQuery; });
define('underscore', [], function () { return _; });
define('moment_with_locales', [], function () { return moment; });
define('strophe', [], function () {
return {
'Strophe': Strophe,
'$build': $build,
'$iq': $iq,
'$msg': $msg,
'$pres': $pres,
'SHA1': SHA1,
'Base64': Base64,
'MD5': MD5,
'b64_hmac_sha1': SHA1.b64_hmac_sha1,
'b64_sha1': SHA1.b64_sha1,
'str_hmac_sha1': SHA1.str_hmac_sha1,
'str_sha1': SHA1.str_sha1
};
});
define('strophe.disco', [], function () { return Strophe; });
define('strophe.rsm', [], function () { return Strophe; });
define('strophe.vcard', [], function () { return Strophe; });
define('otr', [], function () { return { 'DSA': DSA, 'OTR': OTR };});
define('backbone', [], function () { return; });
define('backbone.browserStorage', [], function () { return; });
define('backbone.overview', [], function () { return; });