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 (Akvelon)" <v-...@microsoft.com> on 2015/06/11 18:52:09 UTC

RE: Latest --browserify status?

Hey, guys.

I've tried to run mobilespec today with '--browserify' option, and it seems that it still doesn't work.

The application builds and runs, but after running none of tests are working (I'm aware of issues with test-framework, so I've tried to run non-plugin tests), and there is a lot of messages in console: "Cannot find module .../platforms/ios/platform_www/cordova-js-src/exec".

Also I've found some potential problems with browserify workflow in Windows environment: 
    1. In lines 59, 62 and 71 of require-tr.js [1] - the regex pattern uses '\n' symbol to match line ending, but in my experiments this is not enough, and it is necessary to use '[\r\n]' to match line end properly (at least on Windows).
    2. The line 174 in require-tr.js [1] introduces condition which is ambiguous. On POSIX systems, absolute paths are not passing this condition, since they starts with '/' but on Windows 'indexOf('/') !== 0' is true for absolute paths, so the code under if will be executed for such modules.

[1] https://github.com/apache/cordova-js/blob/master/tasks/lib/require-tr.js

---------------
Best regards, Vladimir

-----Original Message-----
From: Jesse [mailto:purplecabbage@gmail.com] 
Sent: Tuesday, April 7, 2015 4:30 AM
To: dev@cordova.apache.org
Cc: dan@cellartracker.com
Subject: Re: Latest --browserify status?

Dan didn't get this, because he's not on the list. 
Dan, join the list or use markmail[1] as this WILL happen again. 

Cheers,
  Jesse



[1] http://apache.markmail.org/thread/thamwmxr7ykoeqn6



> On Apr 6, 2015, at 11:55 AM, Steven Gill <st...@gmail.com> wrote:
> 
> Hey Dan,
> 
> I just created a master issue to track remaining browserify work.
> https://issues.apache.org/jira/browse/CB-8801
> 
> Unfortunately, I haven't had time to really work on this the last 
> little while.
> 
> 1) I don't think it should be duplicating adding the JS. That sounds 
> like a bug
> 
> 2) It is legacy. Might need to include a transform for it.
> 
> 3) Is it an empty directory at this point? We should add code to not 
> generate it or remove it.
> 
> Any contributions would be greatly appreciated.
> 
>> On Fri, Apr 3, 2015 at 1:44 PM, Dan Polivy <da...@cellartracker.com> wrote:
>> 
>> Hi folks,
>> 
>> Is there a single issue or location for tracking the latest status on 
>> the -browserify functionality in cordova? I've got cordova 4.3.0 
>> installed and have been playing with this a bit, as it's a feature 
>> I'd very much like to use for our app! But, I have a few questions on 
>> how it's working, and couldn't find any official documentation on the 
>> current status and what should work/what doesn't. I'm not intimately 
>> familiar with the cordova code, but I'm happy to contribute back 
>> anything I can do to help make this work better.
>> 
>> Here's what I'm currently running into:
>> 
>> 
>> 1)      When I run 'cordova prepare -browserify', all I see is the
>> original plugin JS files (in /plugins/<name>/www/) end up with the 
>> following appended to them (note, each time you prepare, it continues 
>> to append another iteration):
>> 
>> window.navigator = window.navigator || {}; window.navigator.camera = 
>> window.navigator.camera || {};
>> 
>> require('cordova/builder').assignOrWrapInDeprecateGetter(window.navig
>> ator,
>> 'camera', module.exports);
>> 
>> It's usually duplicated in there 2-3 additional times after each run 
>> of prepare. Is that expected?
>> 
>> 
>> 2)      cordova.define() doesn't seem to be defined in the browserify
>> model. Is this a legacy plugin definition approach? I couldn't find 
>> any documentation about it, but I don't see it being used in any of 
>> the current Apache plugins. I'm running into it with the 
>> barcodescanner plugin ( 
>> https://github.com/wildabeast/BarcodeScanner/blob/master/www/barcodes
>> canner.js#L132); commenting it out seems to work fine. Does this need 
>> to be translated in the browserify code?
>> 
>> 
>> 3)      Minor: the plugin www directories still exist in the output www
>> folder, even though the JS isn't in there (since it is bundled into 
>> cordova.js).
>> 
>> I'm not on the mailing list, so please include me directly in any replies.
>> 
>> Thanks,
>> Dan
>> 
>> 
>> 

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


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


Re: Latest --browserify status?

Posted by Steven Gill <st...@gmail.com>.
Thanks Vladimir for giving this a go.

mobilespec with --browserify was working for me last time I tried but I
will have to try it again. I'm assuming you are using the latest versions
of things.

Appreciate the tips for the windows environment. I need to test this on
Windows and make some of the changes you suggested.

On Thu, Jun 11, 2015 at 9:52 AM, Vladimir Kotikov (Akvelon) <
v-vlkoti@microsoft.com> wrote:

> Hey, guys.
>
> I've tried to run mobilespec today with '--browserify' option, and it
> seems that it still doesn't work.
>
> The application builds and runs, but after running none of tests are
> working (I'm aware of issues with test-framework, so I've tried to run
> non-plugin tests), and there is a lot of messages in console: "Cannot find
> module .../platforms/ios/platform_www/cordova-js-src/exec".
>
> Also I've found some potential problems with browserify workflow in
> Windows environment:
>     1. In lines 59, 62 and 71 of require-tr.js [1] - the regex pattern
> uses '\n' symbol to match line ending, but in my experiments this is not
> enough, and it is necessary to use '[\r\n]' to match line end properly (at
> least on Windows).
>     2. The line 174 in require-tr.js [1] introduces condition which is
> ambiguous. On POSIX systems, absolute paths are not passing this condition,
> since they starts with '/' but on Windows 'indexOf('/') !== 0' is true for
> absolute paths, so the code under if will be executed for such modules.
>
> [1]
> https://github.com/apache/cordova-js/blob/master/tasks/lib/require-tr.js
>
> ---------------
> Best regards, Vladimir
>
> -----Original Message-----
> From: Jesse [mailto:purplecabbage@gmail.com]
> Sent: Tuesday, April 7, 2015 4:30 AM
> To: dev@cordova.apache.org
> Cc: dan@cellartracker.com
> Subject: Re: Latest --browserify status?
>
> Dan didn't get this, because he's not on the list.
> Dan, join the list or use markmail[1] as this WILL happen again.
>
> Cheers,
>   Jesse
>
>
>
> [1] http://apache.markmail.org/thread/thamwmxr7ykoeqn6
>
>
>
> > On Apr 6, 2015, at 11:55 AM, Steven Gill <st...@gmail.com> wrote:
> >
> > Hey Dan,
> >
> > I just created a master issue to track remaining browserify work.
> > https://issues.apache.org/jira/browse/CB-8801
> >
> > Unfortunately, I haven't had time to really work on this the last
> > little while.
> >
> > 1) I don't think it should be duplicating adding the JS. That sounds
> > like a bug
> >
> > 2) It is legacy. Might need to include a transform for it.
> >
> > 3) Is it an empty directory at this point? We should add code to not
> > generate it or remove it.
> >
> > Any contributions would be greatly appreciated.
> >
> >> On Fri, Apr 3, 2015 at 1:44 PM, Dan Polivy <da...@cellartracker.com>
> wrote:
> >>
> >> Hi folks,
> >>
> >> Is there a single issue or location for tracking the latest status on
> >> the -browserify functionality in cordova? I've got cordova 4.3.0
> >> installed and have been playing with this a bit, as it's a feature
> >> I'd very much like to use for our app! But, I have a few questions on
> >> how it's working, and couldn't find any official documentation on the
> >> current status and what should work/what doesn't. I'm not intimately
> >> familiar with the cordova code, but I'm happy to contribute back
> >> anything I can do to help make this work better.
> >>
> >> Here's what I'm currently running into:
> >>
> >>
> >> 1)      When I run 'cordova prepare -browserify', all I see is the
> >> original plugin JS files (in /plugins/<name>/www/) end up with the
> >> following appended to them (note, each time you prepare, it continues
> >> to append another iteration):
> >>
> >> window.navigator = window.navigator || {}; window.navigator.camera =
> >> window.navigator.camera || {};
> >>
> >> require('cordova/builder').assignOrWrapInDeprecateGetter(window.navig
> >> ator,
> >> 'camera', module.exports);
> >>
> >> It's usually duplicated in there 2-3 additional times after each run
> >> of prepare. Is that expected?
> >>
> >>
> >> 2)      cordova.define() doesn't seem to be defined in the browserify
> >> model. Is this a legacy plugin definition approach? I couldn't find
> >> any documentation about it, but I don't see it being used in any of
> >> the current Apache plugins. I'm running into it with the
> >> barcodescanner plugin (
> >> https://github.com/wildabeast/BarcodeScanner/blob/master/www/barcodes
> >> canner.js#L132); commenting it out seems to work fine. Does this need
> >> to be translated in the browserify code?
> >>
> >>
> >> 3)      Minor: the plugin www directories still exist in the output www
> >> folder, even though the JS isn't in there (since it is bundled into
> >> cordova.js).
> >>
> >> I'm not on the mailing list, so please include me directly in any
> replies.
> >>
> >> Thanks,
> >> Dan
> >>
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>
>