cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [3/6] js commit: adding browserify packager
Date Tue, 04 Feb 2014 06:23:08 GMT
adding browserify packager


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/565c6bee
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/565c6bee
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/565c6bee

Branch: refs/heads/browserify
Commit: 565c6bee06441255492fd2030d70acccb5b9ec33
Parents: beeb953
Author: Anis Kadri <anis@apache.org>
Authored: Mon Feb 3 22:21:01 2014 -0800
Committer: Anis Kadri <anis@apache.org>
Committed: Mon Feb 3 22:21:01 2014 -0800

----------------------------------------------------------------------
 tasks/lib/packager-browserify.js | 59 +++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/565c6bee/tasks/lib/packager-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager-browserify.js b/tasks/lib/packager-browserify.js
new file mode 100644
index 0000000..299bf89
--- /dev/null
+++ b/tasks/lib/packager-browserify.js
@@ -0,0 +1,59 @@
+/*
+ * 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 bundle          = require('./bundle-browserify');
+var computeCommitId = require('./compute-commit-id');
+
+
+module.exports = function generate(platform, useWindowsLineEndings, callback) {
+    computeCommitId(function(commitId) {
+        var outFile, outFileStream;
+        var time = new Date().valueOf();
+
+        var libraryRelease = bundle(platform, false, commitId);
+        // if we are using windows line endings, we will also add the BOM
+        if(useWindowsLineEndings) {
+            libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
+        }
+        //var libraryDebug   = bundle(platform, true, commitId);
+
+        time = new Date().valueOf() - time;
+        if (!fs.existsSync('pkg')) {
+            fs.mkdirSync('pkg');
+        }
+       // if(!fs.existsSync('pkg/debug')) {
+       //     fs.mkdirSync('pkg/debug');
+       // }
+        //libraryRelease.bundle().pipe(process.stdout);
+
+        outFile = path.join('pkg', 'cordova.' + platform + '.js');
+        outFileStream = fs.createWriteStream(outFile);
+        libraryRelease.bundle().pipe(outFileStream);
+
+        libraryRelease.bundle().on('end', function() {
+          console.log('generated cordova.' + platform + '.js @ ' + commitId + ' in ' + time
+ 'ms');
+          callback();
+        });
+
+       // outFile = path.join('pkg', 'debug', 'cordova.' + platform + '-debug.js');
+       // outFileStream = fs.createWriteStream(outFile);
+       // libraryDebug.bundle().pipe(outFileStream);
+    });
+}


Mime
View raw message