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/04/24 23:10:54 UTC

[09/45] js commit: adding debug flag to support sourcemaps

adding debug flag to support sourcemaps


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

Branch: refs/heads/master
Commit: 4e674c34422fb529fd2f553af8fb1c38deb9de74
Parents: 15b0952
Author: Anis Kadri <an...@apache.org>
Authored: Wed Feb 5 19:16:23 2014 -0800
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Feb 5 19:16:23 2014 -0800

----------------------------------------------------------------------
 tasks/lib/bundle-browserify.js   |  2 +-
 tasks/lib/packager-browserify.js | 32 ++++++++++++++++++--------------
 2 files changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/4e674c34/tasks/lib/bundle-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle-browserify.js b/tasks/lib/bundle-browserify.js
index e678bcf..0dda5d3 100644
--- a/tasks/lib/bundle-browserify.js
+++ b/tasks/lib/bundle-browserify.js
@@ -26,7 +26,7 @@ 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();
+    var b = browserify({debug: debug});
     // XXX plugin_list is not present at this stage 
     b.ignore(path.join(root, 'src', 'common', 'plugin_list'));
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/4e674c34/tasks/lib/packager-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager-browserify.js b/tasks/lib/packager-browserify.js
index e3407cf..04b982d 100644
--- a/tasks/lib/packager-browserify.js
+++ b/tasks/lib/packager-browserify.js
@@ -24,7 +24,8 @@ var computeCommitId = require('./compute-commit-id');
 
 module.exports = function generate(platform, useWindowsLineEndings, callback) {
     computeCommitId(function(commitId) {
-        var outFile, outFileStream;
+        var outReleaseFile, outReleaseFileStream,
+            outDebugFile, outDebugFileStream;
         var time = new Date().valueOf();
 
         var libraryRelease = bundle(platform, false, commitId);
@@ -32,28 +33,31 @@ module.exports = function generate(platform, useWindowsLineEndings, callback) {
        // if(useWindowsLineEndings) {
        //     libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
        // }
-        //var libraryDebug   = bundle(platform, true, commitId);
+        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);
+        if(!fs.existsSync('pkg/debug')) {
+            fs.mkdirSync('pkg/debug');
+        }
 
-        outFile = path.join('pkg', 'cordova.' + platform + '.js');
-        outFileStream = fs.createWriteStream(outFile);
-        libraryRelease.bundle().pipe(outFileStream);
+        outReleaseFile = path.join('pkg', 'cordova.' + platform + '.js');
+        outReleaseFileStream = fs.createWriteStream(outReleaseFile);
+        libraryRelease.bundle().pipe(outReleaseFileStream);
 
         libraryRelease.bundle().on('end', function() {
-          console.log('generated cordova.' + platform + '.js @ ' + commitId + ' in ' + time + 'ms');
+          var newtime = new Date().valueOf() - time;
+          console.log('generated cordova.' + platform + '.js @ ' + commitId + ' in ' + newtime + 'ms');
           callback();
         });
 
-       // outFile = path.join('pkg', 'debug', 'cordova.' + platform + '-debug.js');
-       // outFileStream = fs.createWriteStream(outFile);
-       // libraryDebug.bundle().pipe(outFileStream);
+        outDebugFile = path.join('pkg', 'debug', 'cordova.' + platform + '-debug.js');
+        outDebugFileStream = fs.createWriteStream(outDebugFile);
+        libraryDebug.bundle().on('end', function() {
+          var newtime = new Date().valueOf() - time;
+          console.log('generated cordova.' + platform + '-debug.js @ ' + commitId + ' in ' + newtime + 'ms');
+          callback();
+        });
     });
 }