You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2014/03/27 15:22:29 UTC
[20/34] js commit: adding browserify bundle
adding browserify bundle
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/eed80cbc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/eed80cbc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/eed80cbc
Branch: refs/heads/browserify
Commit: eed80cbc74095ea19664071e15cf3313d721a8a5
Parents: dec9627
Author: Anis Kadri <an...@apache.org>
Authored: Mon Feb 3 22:21:28 2014 -0800
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Mar 27 15:20:21 2014 +0100
----------------------------------------------------------------------
tasks/lib/bundle-browserify.js | 62 +++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/eed80cbc/tasks/lib/bundle-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle-browserify.js b/tasks/lib/bundle-browserify.js
new file mode 100644
index 0000000..3d91e42
--- /dev/null
+++ b/tasks/lib/bundle-browserify.js
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF
+ * or more contributor license agreements. See th
+ * distributed with this work for additional infor
+ * regarding copyright ownership. The ASF license
+ * to you under the Apache License, Version 2.0 (t
+ * "License"); you may not use this file except in
+ * with the License. You may obtain a copy of the
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to
+ * software distributed under the License is distr
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * KIND, either express or implied. See the Licen
+ * specific language governing permissions and lim
+ * under the License.
+ */
+var fs = require('fs');
+var path = require('path');
+var browserify = require('browserify');
+var require_tr = require('./require-tr');
+var licensePath = path.join(__dirname, '..', 'templates', 'LICENSE-for-js-file.txt');
+var root = path.join(__dirname, '..', '..')
+
+
+module.exports = function bundle(platform, debug, commitId) {
+ // FIXME: need to find a way to void ignore missing
+ var b = browserify();
+ // XXX plugin_list is not present at this stage
+ b.ignore(path.join(root, 'src', 'common', 'plugin_list'));
+
+ // if (platform === 'test') {
+ // // FIXME why does 'test' resolve a bunch of android stuff?!
+ // var testFilesPath = path.join('src', 'android', 'android');
+ // copyProps(modules, collectFiles(testFilesPath, 'android/'));
+ // }
+
+ // var output = [];
+
+ // output.push("// Platform: " + platform);
+ // output.push("// " + commitId);
+
+ // // write header
+ // output.push('/*', fs.readFileSync(licensePath, 'utf8'), '*/');
+ // output.push(';(function() {');
+ // output.push("var CORDOVA_JS_BUILD_LABEL = '" + commitId + "';");
+
+ // // write initial scripts
+ // if (!scripts['require']) {
+ // throw new Error("didn't find a script for 'require'")
+ // }
+
+ // writeScript(output, scripts['require'], debug)
+ b.transform(require_tr);
+
+ b.add(path.join(root, 'src', platform, 'exec.js'));
+
+ b.add(path.join(root, 'src', 'scripts', 'bootstrap.js'));
+
+ return b;
+}