You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/10/29 15:37:32 UTC

[50/50] [abbrv] allura git commit: [#7919] dedicated broccoli build for navbar.js

[#7919] dedicated broccoli build for navbar.js


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/00ee9fc3
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/00ee9fc3
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/00ee9fc3

Branch: refs/heads/db/7919
Commit: 00ee9fc39a614e25c3a70418edc09110d27da3c1
Parents: 2c4142e
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Oct 26 17:28:55 2015 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Thu Oct 29 10:36:08 2015 -0400

----------------------------------------------------------------------
 Brocfile.js  | 37 +++++++++++++++++++++++++++++++------
 package.json |  1 +
 2 files changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/00ee9fc3/Brocfile.js
----------------------------------------------------------------------
diff --git a/Brocfile.js b/Brocfile.js
index 71a8f90..b78dd67 100644
--- a/Brocfile.js
+++ b/Brocfile.js
@@ -20,9 +20,13 @@ var babelTranspiler = require("broccoli-babel-transpiler");
 var sourceMapConcat = require('broccoli-sourcemap-concat');
 var funnel = require('broccoli-funnel');
 var uglifyJavaScript = require('broccoli-uglify-js');
+var mergeTrees = require('broccoli-merge-trees');
 
+var production = (process.env.BROCCOLI_ENV === 'production');
+
+/* main output tree */
 var tree = funnel('Allura/allura/public/nf/js', {
-  include: ['*.es6.js'],
+    include: ['*.es6.js'],
 });
 tree = babelTranspiler(tree, {
     browserPolyfill: true,
@@ -30,22 +34,43 @@ tree = babelTranspiler(tree, {
     sourceMaps: 'inline',  // external doesn't work, have to use extract below
     comments: false,
 });
+
+/* exactly what's needed for the navbar, so separate apps may use it too */
+var react_file = 'react-with-addons' + (production ? '.min' : '') + '.js';
+var navbar_deps = funnel('Allura/allura/public/nf/js', {
+    include: ['underscore-min.js',
+              react_file,
+              'react-drag.js',
+              'react-reorderable.js',
+    ],
+});
+navbar = mergeTrees([navbar_deps, tree]);
+navbar = sourceMapConcat(navbar, {
+    // headerFiles & footerFiles used to specify some that must come before or after others
+    headerFiles: [react_file],
+    inputFiles: ['*.js'],
+    footerFiles: ['add-new-tool.es6.js','navbar.es6.js',],
+    outputFile: '/navbar.js',
+});
+
 tree = sourceMapConcat(tree, {
-  inputFiles: ['**/*'],
-  outputFile: '/transpiled.js'
+    inputFiles: ['**/*'],
+    outputFile: '/transpiled.js'
 });
 
-if (process.env.BROCCOLI_ENV === 'production') {
+var output = mergeTrees([tree, navbar]);
+
+if (production) {
     /* can't use this for dev mode, since it drops the sourcemap comment even if we set  output: {comments: true}
      https://github.com/mishoo/UglifyJS2/issues/653
      https://github.com/mishoo/UglifyJS2/issues/754
      https://github.com/mishoo/UglifyJS2/issues/780
      https://github.com/mishoo/UglifyJS2/issues/520
      */
-    tree = uglifyJavaScript(tree, {
+    output = uglifyJavaScript(output, {
         mangle: false,
         compress: false
     });
 }
 
-module.exports = tree;
+module.exports = output;

http://git-wip-us.apache.org/repos/asf/allura/blob/00ee9fc3/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index f850f00..47d384e 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
     "broccoli": "^0.16.8",
     "broccoli-babel-transpiler": "^5.4.5",
     "broccoli-funnel": "^0.2.8",
+    "broccoli-merge-trees": "^0.2.3",
     "broccoli-sourcemap-concat": "^2.0.1",
     "broccoli-uglify-js": "^0.1.3"
   }