Selaa lähdekoodia

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.
JC Brand 9 vuotta sitten
vanhempi
commit
ba05d4e779

+ 3 - 0
.gitignore

@@ -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?

+ 2 - 0
Gruntfile.js

@@ -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:

+ 8 - 2
Makefile

@@ -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

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1065 - 0
builds/converse-no-dependencies.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 14640
builds/converse.js


+ 11 - 0
builds/templates.js

@@ -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) +

+ 10 - 11
non_amd.html

@@ -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>

+ 25 - 0
src/build-no-dependencies.js

@@ -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'
+})

+ 2 - 5
src/build-no-jquery.js

@@ -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'
 })

+ 0 - 4
src/jquery-external.js

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

+ 0 - 3
src/jquery-private-external.js

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

+ 30 - 0
src/wrapper-end.js

@@ -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; });

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä