You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by vladimir-kotikov <gi...@git.apache.org> on 2015/07/31 16:22:00 UTC

[GitHub] cordova-js pull request: CB-9436 Refactor browserify to get rid of...

GitHub user vladimir-kotikov opened a pull request:

    https://github.com/apache/cordova-js/pull/124

    CB-9436 Refactor browserify to get rid of `require-tr` transform

    This PR removes excess `require-tr` browserify transform and makes resultant bundle compatible with mobilespec and probably most of plugins.
    
    NOTE: This PR depends on https://github.com/apache/cordova-lib/pull/275

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-js CB-9436

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-js/pull/124.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #124
    
----
commit 67e6b451f5239cadfdcec052be48ce8dc2859f92
Author: Vladimir Kotikov <v-...@microsoft.com>
Date:   2015-07-31T13:21:44Z

    CB-9436 Removes `require-tr` bundle transformation

commit 6c0021882470f7336a9cc01145f08f150821f4ca
Author: Vladimir Kotikov <v-...@microsoft.com>
Date:   2015-07-31T13:32:00Z

    CB-9429 Removes tests from resultant bundle

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9436 Refactor browserify to get rid of...

Posted by stevengill <gi...@git.apache.org>.
Github user stevengill commented on the pull request:

    https://github.com/apache/cordova-js/pull/124#issuecomment-127799631
  
    Merge away! Thanks again. Love the refactor. Way simpler to read and follow.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9436 Refactor browserify to get rid of...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-js/pull/124#discussion_r36251972
  
    --- Diff: tasks/lib/packager-browserify.js ---
    @@ -46,25 +37,13 @@ module.exports = function generate(platform, useWindowsLineEndings, platformVers
             outReleaseFile = path.join('pkg', 'cordova.' + platform + '.js');
             outReleaseFileStream = fs.createWriteStream(outReleaseFile);
     
    -        var symbolList = null;
    -        var addSymbolList = through.obj(function(row, enc, next) {
    -            if(symbolList === null) {
    -                symbolList = requireTr.getModules(platform);
    -                this.push(util.format('var symbolList = %s;\n%s\n', JSON.stringify(symbolList, null, 4), row));
    -            } else {
    -                this.push(row);
    -            }
    -            next();
    -        });
    -
    -        libraryRelease.pipeline.get('wrap').push(addSymbolList);
    -
             // write license header
             writeLicenseHeader(outReleaseFileStream, platform, commitId, platformVersion);
     
    -        releaseBundle = libraryRelease.bundle();
    -
    -        releaseBundle.pipe(outReleaseFileStream);
    +        bundle(platform, false, commitId, platformVersion, platformPath)
    +          .add(path.resolve(__dirname, '..', '..', 'src/scripts/bootstrap.js'))
    --- End diff --
    
    Yes, they both needed. This was moved from `bundle-browserify.js` direcly to `cordova-lib/prepare-browserify` due to some reasons (see https://github.com/apache/cordova-lib/pull/275#issuecomment-127782310) but we still need to add this file when building clean cordova-js bundle (without plugins) from grunt task. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9436 Refactor browserify to get rid of...

Posted by stevengill <gi...@git.apache.org>.
Github user stevengill commented on a diff in the pull request:

    https://github.com/apache/cordova-js/pull/124#discussion_r36151389
  
    --- Diff: tasks/lib/bundle-browserify.js ---
    @@ -19,53 +19,63 @@
     var fs           = require('fs');
     var path         = require('path');
     var browserify   = require('browserify');
    -var require_tr   = require('./require-tr');
     var root         = path.join(__dirname, '..', '..');
     var pkgJson      = require('../../package.json');
     var collectFiles = require('./collect-files');
     var copyProps    = require('./copy-props');
     
    -module.exports = function bundle(platform, debug, commitId, platformVersion) {
    -    require_tr.platform = platform;
    -    // FIXME: need to find a way to void ignore missing
    -    var b = browserify({debug: debug});
    -    // XXX plugin_list is not present at this stage 
    -    b.ignore(path.join(root, 'src', 'common', 'plugin_list'));
    +module.exports = function bundle(platform, debug, commitId, platformVersion, platformPath) {
    +    platformPath = fs.existsSync(platformPath) && fs.existsSync(path.join(platformPath, 'cordova-js-src')) ?
    +        path.join(platformPath, 'cordova-js-src') :
    +        path.resolve(root, 'src', 'legacy-exec', platform);
     
    -    b.transform(require_tr.transform, {'platform': platform});
    +    var platformDirname = platform === 'amazon-fireos' ? 'android' : platform;
    --- End diff --
    
    hahaha smart


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9436 Refactor browserify to get rid of...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-js/pull/124


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-js pull request: CB-9436 Refactor browserify to get rid of...

Posted by stevengill <gi...@git.apache.org>.
Github user stevengill commented on a diff in the pull request:

    https://github.com/apache/cordova-js/pull/124#discussion_r36151308
  
    --- Diff: tasks/lib/packager-browserify.js ---
    @@ -46,25 +37,13 @@ module.exports = function generate(platform, useWindowsLineEndings, platformVers
             outReleaseFile = path.join('pkg', 'cordova.' + platform + '.js');
             outReleaseFileStream = fs.createWriteStream(outReleaseFile);
     
    -        var symbolList = null;
    -        var addSymbolList = through.obj(function(row, enc, next) {
    -            if(symbolList === null) {
    -                symbolList = requireTr.getModules(platform);
    -                this.push(util.format('var symbolList = %s;\n%s\n', JSON.stringify(symbolList, null, 4), row));
    -            } else {
    -                this.push(row);
    -            }
    -            next();
    -        });
    -
    -        libraryRelease.pipeline.get('wrap').push(addSymbolList);
    -
             // write license header
             writeLicenseHeader(outReleaseFileStream, platform, commitId, platformVersion);
     
    -        releaseBundle = libraryRelease.bundle();
    -
    -        releaseBundle.pipe(outReleaseFileStream);
    +        bundle(platform, false, commitId, platformVersion, platformPath)
    +          .add(path.resolve(__dirname, '..', '..', 'src/scripts/bootstrap.js'))
    --- End diff --
    
    You add bootstrap.js here which has require('cordova/init') in it. But you also manually add require('cordova/init') in the form of init.js when adding plugins using cordova prepare --browserify. https://github.com/MSOpenTech/cordova-lib/commit/510516135ef41b735b2e610c1b8d95fc77bd571e#diff-28a16640f3807e6ee2300ea7ce8c2f1dR196
    
    Are they both needed?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org