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 <vl...@akvelon.com> on 2014/08/04 13:54:53 UTC

RE: Browserify support for cordova-lib/cordova-cli

Tested this with windows and android platforms and found two issues:

    1.  'browserify' option is not passed down to `cordova platform/plugin` commands. It seems that additional property `browserify: args.browserify` need to be added to download_opts in cli.js near line 273.
    
2.  When I add some plugins using `cordova plugin add --browserify` and after that run `cordova prepare --browserify` the project is seems to be broken (no plugins added to cordova.js).
Seems that problem is at line 110 in plugman/prepare-browserify.js (`is_top_level` is undefined, when this method called from cordova/prepare.js and this will always return without adding any plugin to cordova.js).

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

-----Original Message-----
From: Steven Gill [mailto:stevengill97@gmail.com] 
Sent: Friday, 1 August, 2014 0:29
To: dev@cordova.apache.org; Suraj Pindoria
Subject: Re: Browserify support for cordova-lib/cordova-cli

This looks good to me. Anyone else want to test it before I merge it in?


On Wed, Jul 30, 2014 at 3:38 PM, Suraj Pindoria < suraj.pindoria@yahoo.com.invalid> wrote:

> So I updated this to include some of the additional use cases 
> discussed earlier.  Now, running "cordova prepare --browserify" in an 
> existing project will update it use prepare-browserify.  It also works 
> with "cordova run --browserify".  Adding and removing plugins should 
> still use the "--browserify" flag.
>
> Please try it out and let me know if there are any other use cases 
> that are still missing.
>
> Thanks,
> Suraj.
>
>
> On Tuesday, July 29, 2014 7:35 PM, Michal Mocny <mm...@chromium.org>
> wrote:
>
>
>
> Sounds like a setting that would go well in .cordova/config.json, I think.
>
> -Michal
>
>
>
> On Tue, Jul 29, 2014 at 6:10 PM, Steven Gill <st...@gmail.com>
> wrote:
>
> > Decided to add a few more issues and organize around a master issue.
> >
> > https://issues.apache.org/jira/browse/CB-7190
> >
> > If you guys think of other use cases, let us know!
> >
> >
> > On Tue, Jul 29, 2014 at 2:47 PM, Suraj Pindoria < 
> > suraj.pindoria@yahoo.com.invalid> wrote:
> >
> > > Right now it only works when you add the plugins with the flag.
> > >
> > > Current working use case:
> > > -Create a project
> > > -Add platform
> > > -Add plugins with browserify flag
> > >
> > > Adding a platform after does not use the proper browserify-prepare.
> > >  Obviously an issue.
> > >
> > > We just realized an issue we need to solve first.
> > > https://issues.apache.org/jira/browse/CB-7227
> > >
> > > Also, the case for "cordova prepare --browserify" on an existing
> project
> > > needs to be handled.
> > >
> > > We are also thinking about saving the browserify flag, so that way 
> > > we
> do
> > > not need to keep adding the flag after it has been used once.  
> > > Where
> > would
> > > be the best place to save this?
> > > "cordova create --browserify test com.example.test browserifyTest"
> > > Saves browserify flag for use throughout the project.
> > >
> > > Suraj.
> > >
> > >
> > > On Tuesday, July 29, 2014 2:21 PM, Michal Mocny 
> > > <mm...@chromium.org>
> > > wrote:
> > >
> > >
> > >
> > > Just to confirm: Can I run "cordova prepare --browserify" is any
> existing
> > > workspace, or would I have needed to add all plugins / platforms 
> > > with
> > that
> > > flag as well?
> > >
> > > -Michal
> > >
> > >
> > >
> > > On Tue, Jul 29, 2014 at 3:27 PM, Steven Gill 
> > > <st...@gmail.com>
> > > wrote:
> > >
> > > > cordova prepare --browserify works too
> > > >
> > > > https://issues.apache.org/jira/browse/CB-7001
> > > > https://issues.apache.org/jira/browse/CB-7190
> > > >
> > > >
> > > > On Tue, Jul 29, 2014 at 12:02 PM, Suraj Pindoria < 
> > > > suraj.pindoria@yahoo.com.invalid> wrote:
> > > >
> > > > > Hi everyone,
> > > > >
> > > > > I have been working with Anis and Steve to add browserify 
> > > > > support
> in
> > > > > cordova-lib and cordova-cli.  They way this is being done is
> through
> > a
> > > > flag
> > > > > in the CLI which then calls prepare-browserify versus the 
> > > > > standard
> > > > prepare,
> > > > > an example:
> > > > > "cordova plugin --browserify add org.apache.cordova.*"
> > > > > "cordova plugin --browserify rm org.apache.cordova.*"
> > > > >
> > > > >
> > > > > So far it has only been tested using iOS and Android and 
> > > > > requires
> > that
> > > > the
> > > > > browserify flag is present whenever you add or remove a plugin.
> Let
> > me
> > > > > know if you have any questions or concerns.
> > > > >
> > > > > https://github.com/apache/cordova-lib/pull/66
> > > > >
> > > > > https://github.com/apache/cordova-cli/pull/185
> > > > >
> > > > >
> > > > > Thanks,
> > > > > Suraj.
> > > >
> > >
> >
>

RE: Browserify support for cordova-lib/cordova-cli

Posted by "Vladimir Kotikov (Akvelon)" <v-...@microsoft.com>.
Hi Steve.

Seems that adding platforms and plugins and also `cordova run` with --browserify option works fine, but generated cordova.js is broken.
I've tried to run Helloworld app with camera plugin installed on Windows and Android and got following errors:

Windows:
Unhandled exception at line 23, column 142 in ms-appx://io.cordova.hellocordova/www/cordova.js
0x800a139e - JavaScript runtime error: Cannot find module 'cordova/channel'

Android:
file:///android_asset/www/cordova.js: Line 1706 : Uncaught Error: Module cordova/plugin/android/app does not exist.
file:///android_asset/www/cordova.js: Line 1633 : deviceready has not fired after 5 seconds.
file:///android_asset/www/cordova.js: Line 1626 : Channel not fired: onCordovaReady

You can take generated cordova.js here: https://dl.dropboxusercontent.com/u/4625315/cordova.js (for windows), https://dl.dropboxusercontent.com/u/4625315/cordova_android.js (Android)

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

-----Original Message-----
From: Steven Gill [mailto:stevengill97@gmail.com] 
Sent: Wednesday, 6 August, 2014 22:07
To: dev@cordova.apache.org; Suraj Pindoria
Subject: Re: Browserify support for cordova-lib/cordova-cli

Hey Vladimir,

Can you try again with the newest changes? Everything has been pushed to master now. (CLI & cordova-lib)

-Steve


On Mon, Aug 4, 2014 at 4:52 PM, Suraj Pindoria < suraj.pindoria@yahoo.com.invalid> wrote:

> Hi Vladimir,
>
> Thank you for pointing out these issues to me.  The first one has 
> actually been handled already, there is a PR waiting that adds the 
> browserify option in the CLI.
> https://github.com/apache/cordova-cli/pull/185
>
> And for the second I just pushed a change that takes care of this by 
> passing in the value of 'is_top_level'.
>
> Regards,
> Suraj.
>
>
>
> On Monday, August 4, 2014 4:55 AM, Vladimir Kotikov < 
> vladimir.kotikov@akvelon.com> wrote:
>
>
>
> Tested this with windows and android platforms and found two issues:
>
>     1.  'browserify' option is not passed down to `cordova 
> platform/plugin` commands. It seems that additional property `browserify:
> args.browserify` need to be added to download_opts in cli.js near line 273.
>
> 2.  When I add some plugins using `cordova plugin add --browserify` 
> and after that run `cordova prepare --browserify` the project is seems 
> to be broken (no plugins added to cordova.js).
> Seems that problem is at line 110 in plugman/prepare-browserify.js 
> (`is_top_level` is undefined, when this method called from 
> cordova/prepare.js and this will always return without adding any 
> plugin to cordova.js).
>
> ---------------
> Best regards, Vladimir
>
>
> -----Original Message-----
> From: Steven Gill [mailto:stevengill97@gmail.com]
> Sent: Friday, 1 August, 2014 0:29
> To: dev@cordova.apache.org; Suraj Pindoria
> Subject: Re: Browserify support for cordova-lib/cordova-cli
>
> This looks good to me. Anyone else want to test it before I merge it in?
>
>
> On Wed, Jul 30, 2014 at 3:38 PM, Suraj Pindoria < 
> suraj.pindoria@yahoo.com.invalid> wrote:
>
> > So I updated this to include some of the additional use cases 
> > discussed earlier.  Now, running "cordova prepare --browserify" in 
> > an existing project will update it use prepare-browserify.  It also 
> > works with "cordova run --browserify".  Adding and removing plugins 
> > should still use the "--browserify" flag.
> >
> > Please try it out and let me know if there are any other use cases 
> > that are still missing.
> >
> > Thanks,
> > Suraj.
> >
> >
> > On Tuesday, July 29, 2014 7:35 PM, Michal Mocny 
> > <mm...@chromium.org>
> > wrote:
> >
> >
> >
> > Sounds like a setting that would go well in .cordova/config.json, I
> think.
> >
> > -Michal
> >
> >
> >
> > On Tue, Jul 29, 2014 at 6:10 PM, Steven Gill 
> > <st...@gmail.com>
> > wrote:
> >
> > > Decided to add a few more issues and organize around a master issue.
> > >
> > > https://issues.apache.org/jira/browse/CB-7190
> > >
> > > If you guys think of other use cases, let us know!
> > >
> > >
> > > On Tue, Jul 29, 2014 at 2:47 PM, Suraj Pindoria < 
> > > suraj.pindoria@yahoo.com.invalid> wrote:
> > >
> > > > Right now it only works when you add the plugins with the flag.
> > > >
> > > > Current working use case:
> > > > -Create a project
> > > > -Add platform
> > > > -Add plugins with browserify flag
> > > >
> > > > Adding a platform after does not use the proper browserify-prepare.
> > > >  Obviously an issue.
> > > >
> > > > We just realized an issue we need to solve first.
> > > > https://issues.apache.org/jira/browse/CB-7227
> > > >
> > > > Also, the case for "cordova prepare --browserify" on an existing
> > project
> > > > needs to be handled.
> > > >
> > > > We are also thinking about saving the browserify flag, so that 
> > > > way we
> > do
> > > > not need to keep adding the flag after it has been used once.
> > > > Where
> > > would
> > > > be the best place to save this?
> > > > "cordova create --browserify test com.example.test browserifyTest"
> > > > Saves browserify flag for use throughout the project.
> > > >
> > > > Suraj.
> > > >
> > > >
> > > > On Tuesday, July 29, 2014 2:21 PM, Michal Mocny 
> > > > <mm...@chromium.org>
> > > > wrote:
> > > >
> > > >
> > > >
> > > > Just to confirm: Can I run "cordova prepare --browserify" is any
> > existing
> > > > workspace, or would I have needed to add all plugins / platforms 
> > > > with
> > > that
> > > > flag as well?
> > > >
> > > > -Michal
> > > >
> > > >
> > > >
> > > > On Tue, Jul 29, 2014 at 3:27 PM, Steven Gill 
> > > > <st...@gmail.com>
> > > > wrote:
> > > >
> > > > > cordova prepare --browserify works too
> > > > >
> > > > > https://issues.apache.org/jira/browse/CB-7001
> > > > > https://issues.apache.org/jira/browse/CB-7190
> > > > >
> > > > >
> > > > > On Tue, Jul 29, 2014 at 12:02 PM, Suraj Pindoria < 
> > > > > suraj.pindoria@yahoo.com.invalid> wrote:
> > > > >
> > > > > > Hi everyone,
> > > > > >
> > > > > > I have been working with Anis and Steve to add browserify 
> > > > > > support
> > in
> > > > > > cordova-lib and cordova-cli.  They way this is being done is
> > through
> > > a
> > > > > flag
> > > > > > in the CLI which then calls prepare-browserify versus the 
> > > > > > standard
> > > > > prepare,
> > > > > > an example:
> > > > > > "cordova plugin --browserify add org.apache.cordova.*"
> > > > > > "cordova plugin --browserify rm org.apache.cordova.*"
> > > > > >
> > > > > >
> > > > > > So far it has only been tested using iOS and Android and 
> > > > > > requires
> > > that
> > > > > the
> > > > > > browserify flag is present whenever you add or remove a plugin.
> > Let
> > > me
> > > > > > know if you have any questions or concerns.
> > > > > >
> > > > > > https://github.com/apache/cordova-lib/pull/66
> > > > > >
> > > > > > https://github.com/apache/cordova-cli/pull/185
> > > > > >
> > > > > >
> > > > > > Thanks,
> > > > > > Suraj.
> > > > >
> > > >
> > >
> >
>

Re: Browserify support for cordova-lib/cordova-cli

Posted by Steven Gill <st...@gmail.com>.
Hey Vladimir,

Can you try again with the newest changes? Everything has been pushed to
master now. (CLI & cordova-lib)

-Steve


On Mon, Aug 4, 2014 at 4:52 PM, Suraj Pindoria <
suraj.pindoria@yahoo.com.invalid> wrote:

> Hi Vladimir,
>
> Thank you for pointing out these issues to me.  The first one has actually
> been handled already, there is a PR waiting that adds the browserify option
> in the CLI.
> https://github.com/apache/cordova-cli/pull/185
>
> And for the second I just pushed a change that takes care of this by
> passing in the value of 'is_top_level'.
>
> Regards,
> Suraj.
>
>
>
> On Monday, August 4, 2014 4:55 AM, Vladimir Kotikov <
> vladimir.kotikov@akvelon.com> wrote:
>
>
>
> Tested this with windows and android platforms and found two issues:
>
>     1.  'browserify' option is not passed down to `cordova
> platform/plugin` commands. It seems that additional property `browserify:
> args.browserify` need to be added to download_opts in cli.js near line 273.
>
> 2.  When I add some plugins using `cordova plugin add --browserify` and
> after that run `cordova prepare --browserify` the project is seems to be
> broken (no plugins added to cordova.js).
> Seems that problem is at line 110 in plugman/prepare-browserify.js
> (`is_top_level` is undefined, when this method called from
> cordova/prepare.js and this will always return without adding any plugin to
> cordova.js).
>
> ---------------
> Best regards, Vladimir
>
>
> -----Original Message-----
> From: Steven Gill [mailto:stevengill97@gmail.com]
> Sent: Friday, 1 August, 2014 0:29
> To: dev@cordova.apache.org; Suraj Pindoria
> Subject: Re: Browserify support for cordova-lib/cordova-cli
>
> This looks good to me. Anyone else want to test it before I merge it in?
>
>
> On Wed, Jul 30, 2014 at 3:38 PM, Suraj Pindoria <
> suraj.pindoria@yahoo.com.invalid> wrote:
>
> > So I updated this to include some of the additional use cases
> > discussed earlier.  Now, running "cordova prepare --browserify" in an
> > existing project will update it use prepare-browserify.  It also works
> > with "cordova run --browserify".  Adding and removing plugins should
> > still use the "--browserify" flag.
> >
> > Please try it out and let me know if there are any other use cases
> > that are still missing.
> >
> > Thanks,
> > Suraj.
> >
> >
> > On Tuesday, July 29, 2014 7:35 PM, Michal Mocny <mm...@chromium.org>
> > wrote:
> >
> >
> >
> > Sounds like a setting that would go well in .cordova/config.json, I
> think.
> >
> > -Michal
> >
> >
> >
> > On Tue, Jul 29, 2014 at 6:10 PM, Steven Gill <st...@gmail.com>
> > wrote:
> >
> > > Decided to add a few more issues and organize around a master issue.
> > >
> > > https://issues.apache.org/jira/browse/CB-7190
> > >
> > > If you guys think of other use cases, let us know!
> > >
> > >
> > > On Tue, Jul 29, 2014 at 2:47 PM, Suraj Pindoria <
> > > suraj.pindoria@yahoo.com.invalid> wrote:
> > >
> > > > Right now it only works when you add the plugins with the flag.
> > > >
> > > > Current working use case:
> > > > -Create a project
> > > > -Add platform
> > > > -Add plugins with browserify flag
> > > >
> > > > Adding a platform after does not use the proper browserify-prepare.
> > > >  Obviously an issue.
> > > >
> > > > We just realized an issue we need to solve first.
> > > > https://issues.apache.org/jira/browse/CB-7227
> > > >
> > > > Also, the case for "cordova prepare --browserify" on an existing
> > project
> > > > needs to be handled.
> > > >
> > > > We are also thinking about saving the browserify flag, so that way
> > > > we
> > do
> > > > not need to keep adding the flag after it has been used once.
> > > > Where
> > > would
> > > > be the best place to save this?
> > > > "cordova create --browserify test com.example.test browserifyTest"
> > > > Saves browserify flag for use throughout the project.
> > > >
> > > > Suraj.
> > > >
> > > >
> > > > On Tuesday, July 29, 2014 2:21 PM, Michal Mocny
> > > > <mm...@chromium.org>
> > > > wrote:
> > > >
> > > >
> > > >
> > > > Just to confirm: Can I run "cordova prepare --browserify" is any
> > existing
> > > > workspace, or would I have needed to add all plugins / platforms
> > > > with
> > > that
> > > > flag as well?
> > > >
> > > > -Michal
> > > >
> > > >
> > > >
> > > > On Tue, Jul 29, 2014 at 3:27 PM, Steven Gill
> > > > <st...@gmail.com>
> > > > wrote:
> > > >
> > > > > cordova prepare --browserify works too
> > > > >
> > > > > https://issues.apache.org/jira/browse/CB-7001
> > > > > https://issues.apache.org/jira/browse/CB-7190
> > > > >
> > > > >
> > > > > On Tue, Jul 29, 2014 at 12:02 PM, Suraj Pindoria <
> > > > > suraj.pindoria@yahoo.com.invalid> wrote:
> > > > >
> > > > > > Hi everyone,
> > > > > >
> > > > > > I have been working with Anis and Steve to add browserify
> > > > > > support
> > in
> > > > > > cordova-lib and cordova-cli.  They way this is being done is
> > through
> > > a
> > > > > flag
> > > > > > in the CLI which then calls prepare-browserify versus the
> > > > > > standard
> > > > > prepare,
> > > > > > an example:
> > > > > > "cordova plugin --browserify add org.apache.cordova.*"
> > > > > > "cordova plugin --browserify rm org.apache.cordova.*"
> > > > > >
> > > > > >
> > > > > > So far it has only been tested using iOS and Android and
> > > > > > requires
> > > that
> > > > > the
> > > > > > browserify flag is present whenever you add or remove a plugin.
> > Let
> > > me
> > > > > > know if you have any questions or concerns.
> > > > > >
> > > > > > https://github.com/apache/cordova-lib/pull/66
> > > > > >
> > > > > > https://github.com/apache/cordova-cli/pull/185
> > > > > >
> > > > > >
> > > > > > Thanks,
> > > > > > Suraj.
> > > > >
> > > >
> > >
> >
>

Re: Browserify support for cordova-lib/cordova-cli

Posted by Suraj Pindoria <su...@yahoo.com.INVALID>.
Hi Vladimir,

Thank you for pointing out these issues to me.  The first one has actually been handled already, there is a PR waiting that adds the browserify option in the CLI.
https://github.com/apache/cordova-cli/pull/185

And for the second I just pushed a change that takes care of this by passing in the value of 'is_top_level'.

Regards,
Suraj.



On Monday, August 4, 2014 4:55 AM, Vladimir Kotikov <vl...@akvelon.com> wrote:
 


Tested this with windows and android platforms and found two issues:

    1.  'browserify' option is not passed down to `cordova platform/plugin` commands. It seems that additional property `browserify: args.browserify` need to be added to download_opts in cli.js near line 273.
    
2.  When I add some plugins using `cordova plugin add --browserify` and after that run `cordova prepare --browserify` the project is seems to be broken (no plugins added to cordova.js).
Seems that problem is at line 110 in plugman/prepare-browserify.js (`is_top_level` is undefined, when this method called from cordova/prepare.js and this will always return without adding any plugin to cordova.js).

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


-----Original Message-----
From: Steven Gill [mailto:stevengill97@gmail.com] 
Sent: Friday, 1 August, 2014 0:29
To: dev@cordova.apache.org; Suraj Pindoria
Subject: Re: Browserify support for cordova-lib/cordova-cli

This looks good to me. Anyone else want to test it before I merge it in?


On Wed, Jul 30, 2014 at 3:38 PM, Suraj Pindoria < suraj.pindoria@yahoo.com.invalid> wrote:

> So I updated this to include some of the additional use cases 
> discussed earlier.  Now, running "cordova prepare --browserify" in an 
> existing project will update it use prepare-browserify.  It also works 
> with "cordova run --browserify".  Adding and removing plugins should 
> still use the "--browserify" flag.
>
> Please try it out and let me know if there are any other use cases 
> that are still missing.
>
> Thanks,
> Suraj.
>
>
> On Tuesday, July 29, 2014 7:35 PM, Michal Mocny <mm...@chromium.org>
> wrote:
>
>
>
> Sounds like a setting that would go well in .cordova/config.json, I think.
>
> -Michal
>
>
>
> On Tue, Jul 29, 2014 at 6:10 PM, Steven Gill <st...@gmail.com>
> wrote:
>
> > Decided to add a few more issues and organize around a master issue.
> >
> > https://issues.apache.org/jira/browse/CB-7190
> >
> > If you guys think of other use cases, let us know!
> >
> >
> > On Tue, Jul 29, 2014 at 2:47 PM, Suraj Pindoria < 
> > suraj.pindoria@yahoo.com.invalid> wrote:
> >
> > > Right now it only works when you add the plugins with the flag.
> > >
> > > Current working use case:
> > > -Create a project
> > > -Add platform
> > > -Add plugins with browserify flag
> > >
> > > Adding a platform after does not use the proper browserify-prepare.
> > >  Obviously an issue.
> > >
> > > We just realized an issue we need to solve first.
> > > https://issues.apache.org/jira/browse/CB-7227
> > >
> > > Also, the case for "cordova prepare --browserify" on an existing
> project
> > > needs to be handled.
> > >
> > > We are also thinking about saving the browserify flag, so that way 
> > > we
> do
> > > not need to keep adding the flag after it has been used once.  
> > > Where
> > would
> > > be the best place to save this?
> > > "cordova create --browserify test com.example.test browserifyTest"
> > > Saves browserify flag for use throughout the project.
> > >
> > > Suraj.
> > >
> > >
> > > On Tuesday, July 29, 2014 2:21 PM, Michal Mocny 
> > > <mm...@chromium.org>
> > > wrote:
> > >
> > >
> > >
> > > Just to confirm: Can I run "cordova prepare --browserify" is any
> existing
> > > workspace, or would I have needed to add all plugins / platforms 
> > > with
> > that
> > > flag as well?
> > >
> > > -Michal
> > >
> > >
> > >
> > > On Tue, Jul 29, 2014 at 3:27 PM, Steven Gill 
> > > <st...@gmail.com>
> > > wrote:
> > >
> > > > cordova prepare --browserify works too
> > > >
> > > > https://issues.apache.org/jira/browse/CB-7001
> > > > https://issues.apache.org/jira/browse/CB-7190
> > > >
> > > >
> > > > On Tue, Jul 29, 2014 at 12:02 PM, Suraj Pindoria < 
> > > > suraj.pindoria@yahoo.com.invalid> wrote:
> > > >
> > > > > Hi everyone,
> > > > >
> > > > > I have been working with Anis and Steve to add browserify 
> > > > > support
> in
> > > > > cordova-lib and cordova-cli.  They way this is being done is
> through
> > a
> > > > flag
> > > > > in the CLI which then calls prepare-browserify versus the 
> > > > > standard
> > > > prepare,
> > > > > an example:
> > > > > "cordova plugin --browserify add org.apache.cordova.*"
> > > > > "cordova plugin --browserify rm org.apache.cordova.*"
> > > > >
> > > > >
> > > > > So far it has only been tested using iOS and Android and 
> > > > > requires
> > that
> > > > the
> > > > > browserify flag is present whenever you add or remove a plugin.
> Let
> > me
> > > > > know if you have any questions or concerns.
> > > > >
> > > > > https://github.com/apache/cordova-lib/pull/66
> > > > >
> > > > > https://github.com/apache/cordova-cli/pull/185
> > > > >
> > > > >
> > > > > Thanks,
> > > > > Suraj.
> > > >
> > >
> >
>