You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Braden Shepherdson <br...@chromium.org> on 2013/03/06 16:43:06 UTC
Re: Prototype for automatic JS installation in cordova-cli
Ping. Now that folks are back from ApacheCon, I'd like to get this moving
forward.
Also, are there any other ideas/prototypes to compare against?
Braden
On Mon, Feb 25, 2013 at 1:52 PM, Braden Shepherdson <br...@chromium.org>wrote:
> Yes, Andrew is right. This concats a small bit of code to the end of
> cordova.js that:
> - injects a <script> tag for each plugin
> - waits for all the <script> tags to load
> - calls cordova.require('some.plugin.module') and uses modulemapper to
> clobber/merge things.
>
> We decided that if loading two dozen script tags is too slow (probably
> not) then we can make the decision whether to sacrifice error message
> clarity for speed.
>
> Braden
>
>
> On Mon, Feb 25, 2013 at 1:20 PM, Filip Maj <fi...@adobe.com> wrote:
>
>> Sweet! I should keep my mouth shut until I play with the code :)
>>
>> On 2/25/13 10:06 AM, "Andrew Grieve" <ag...@chromium.org> wrote:
>>
>> >Just to clarify - Braden's prototype doesn't concat plugin js.
>> >
>> >I think we're on the same page in terms of concatenating making it hard
>> to
>> >figure out user reports.
>> >
>> >What this does is concat the code to inject script tags. Each plugin's
>> >code
>> >then lives in their own .js files.
>> >
>> >
>> >On Mon, Feb 25, 2013 at 12:55 PM, Filip Maj <fi...@adobe.com> wrote:
>> >
>> >> Sweet! Thanks for putting this together Braden. I now have something to
>> >> play with on the flight to Portland this afternoon :D
>> >>
>> >> Related, we had spoke a few months ago [1] about what to do with plugin
>> >> installation and inclusion of plugin JS (as either concat'ed to
>> >>cordova.js
>> >> or with new script tags added to html files). We never really got to a
>> >> solid conclusion but it seems like concatenation was the general
>> >>consensus.
>> >>
>> >> The concern with concating is issue tracking will be hard (my
>> cordova.js
>> >> is different from yours). Brian brought up a good point in [1] that the
>> >> config.xml ends up being a manifest that summarizes what your
>> cordova.js
>> >> should look like. While this helps, then we keep going up the slope
>> once
>> >> we hit different plugin versions.. Likely in the end we will need users
>> >>to
>> >> upload their cordova.js for figuring out plugin versions and whatnot.
>> >>
>> >> Just wanted to reiterate and perhaps bring that back to light.
>> >>
>> >> [1] http://markmail.org/message/tsbypckth2vcuib3
>> >>
>> >> On 2/25/13 8:20 AM, "Braden Shepherdson" <br...@chromium.org> wrote:
>> >>
>> >> >I sent around a document[1] outlining my plan for automatically
>> >>installing
>> >> >plugin Javascript files last week. The prototype is complete and in a
>> >>pull
>> >> >request[2] now.
>> >> >
>> >> >tl;dr for how this works is: <js-module> tags in the plugin.xml
>> specify
>> >> ><clobbers>, <merges> and <runs> for each JS file; cordova prepare
>> >>copies
>> >> >the JS files into the platforms and injects code at the end of
>> >>cordova.js
>> >> >to cordova.require the modules and do the clobbering and merging.
>> >> >
>> >> >Please take a look and see what you think. If you want to try it,
>> check
>> >> >out
>> >> >my fork's auto_js branch and install it. You'll need some ported
>> >>plugins
>> >> >to
>> >> >install, for which see:
>> >> >https://github.com/MobileChromeApps/refresh
>> >> >
>> >>
>> >>
>> https://github.com/MobileChromeApps/chrome-cordova/tree/plugins/plugins/s
>> >>o
>> >> >cket
>> >> >
>> >>
>> >>
>> https://github.com/MobileChromeApps/chrome-cordova/tree/plugins/plugins/s
>> >>t
>> >> >orage
>> >> >
>> >> >I'm pleased with how things turned out, in the code and in the
>> >>interface.
>> >> >I
>> >> >think this is the right approach for automatic installation. It
>> doesn't
>> >> >pollute top-level www, has no risk of collision between plugins or
>> >>between
>> >> >plugins and user code, and uses existing tools like the module mapper.
>> >> >
>> >> >Comments welcome.
>> >> >
>> >> >Braden
>> >> >
>> >> >[1]
>> >> >
>> >>
>> >>
>> https://docs.google.com/document/d/1fhwnIZ5TqwklGx71pLmfSghysls1S4_5ktEsj
>> >>A
>> >> >9ac5Y/edit
>> >> >[2] https://github.com/apache/cordova-cli/pull/4
>> >>
>> >>
>>
>>
>
Re: Prototype for automatic JS installation in cordova-cli
Posted by Brian LeRoux <b...@brian.io>.
Hey Braden, we're getting a few ppl together to review/discuss this
week. Stay tuned.
On Wed, Mar 6, 2013 at 7:43 AM, Braden Shepherdson <br...@chromium.org> wrote:
> Ping. Now that folks are back from ApacheCon, I'd like to get this moving
> forward.
>
> Also, are there any other ideas/prototypes to compare against?
>
> Braden
>
>
> On Mon, Feb 25, 2013 at 1:52 PM, Braden Shepherdson <br...@chromium.org>wrote:
>
>> Yes, Andrew is right. This concats a small bit of code to the end of
>> cordova.js that:
>> - injects a <script> tag for each plugin
>> - waits for all the <script> tags to load
>> - calls cordova.require('some.plugin.module') and uses modulemapper to
>> clobber/merge things.
>>
>> We decided that if loading two dozen script tags is too slow (probably
>> not) then we can make the decision whether to sacrifice error message
>> clarity for speed.
>>
>> Braden
>>
>>
>> On Mon, Feb 25, 2013 at 1:20 PM, Filip Maj <fi...@adobe.com> wrote:
>>
>>> Sweet! I should keep my mouth shut until I play with the code :)
>>>
>>> On 2/25/13 10:06 AM, "Andrew Grieve" <ag...@chromium.org> wrote:
>>>
>>> >Just to clarify - Braden's prototype doesn't concat plugin js.
>>> >
>>> >I think we're on the same page in terms of concatenating making it hard
>>> to
>>> >figure out user reports.
>>> >
>>> >What this does is concat the code to inject script tags. Each plugin's
>>> >code
>>> >then lives in their own .js files.
>>> >
>>> >
>>> >On Mon, Feb 25, 2013 at 12:55 PM, Filip Maj <fi...@adobe.com> wrote:
>>> >
>>> >> Sweet! Thanks for putting this together Braden. I now have something to
>>> >> play with on the flight to Portland this afternoon :D
>>> >>
>>> >> Related, we had spoke a few months ago [1] about what to do with plugin
>>> >> installation and inclusion of plugin JS (as either concat'ed to
>>> >>cordova.js
>>> >> or with new script tags added to html files). We never really got to a
>>> >> solid conclusion but it seems like concatenation was the general
>>> >>consensus.
>>> >>
>>> >> The concern with concating is issue tracking will be hard (my
>>> cordova.js
>>> >> is different from yours). Brian brought up a good point in [1] that the
>>> >> config.xml ends up being a manifest that summarizes what your
>>> cordova.js
>>> >> should look like. While this helps, then we keep going up the slope
>>> once
>>> >> we hit different plugin versions.. Likely in the end we will need users
>>> >>to
>>> >> upload their cordova.js for figuring out plugin versions and whatnot.
>>> >>
>>> >> Just wanted to reiterate and perhaps bring that back to light.
>>> >>
>>> >> [1] http://markmail.org/message/tsbypckth2vcuib3
>>> >>
>>> >> On 2/25/13 8:20 AM, "Braden Shepherdson" <br...@chromium.org> wrote:
>>> >>
>>> >> >I sent around a document[1] outlining my plan for automatically
>>> >>installing
>>> >> >plugin Javascript files last week. The prototype is complete and in a
>>> >>pull
>>> >> >request[2] now.
>>> >> >
>>> >> >tl;dr for how this works is: <js-module> tags in the plugin.xml
>>> specify
>>> >> ><clobbers>, <merges> and <runs> for each JS file; cordova prepare
>>> >>copies
>>> >> >the JS files into the platforms and injects code at the end of
>>> >>cordova.js
>>> >> >to cordova.require the modules and do the clobbering and merging.
>>> >> >
>>> >> >Please take a look and see what you think. If you want to try it,
>>> check
>>> >> >out
>>> >> >my fork's auto_js branch and install it. You'll need some ported
>>> >>plugins
>>> >> >to
>>> >> >install, for which see:
>>> >> >https://github.com/MobileChromeApps/refresh
>>> >> >
>>> >>
>>> >>
>>> https://github.com/MobileChromeApps/chrome-cordova/tree/plugins/plugins/s
>>> >>o
>>> >> >cket
>>> >> >
>>> >>
>>> >>
>>> https://github.com/MobileChromeApps/chrome-cordova/tree/plugins/plugins/s
>>> >>t
>>> >> >orage
>>> >> >
>>> >> >I'm pleased with how things turned out, in the code and in the
>>> >>interface.
>>> >> >I
>>> >> >think this is the right approach for automatic installation. It
>>> doesn't
>>> >> >pollute top-level www, has no risk of collision between plugins or
>>> >>between
>>> >> >plugins and user code, and uses existing tools like the module mapper.
>>> >> >
>>> >> >Comments welcome.
>>> >> >
>>> >> >Braden
>>> >> >
>>> >> >[1]
>>> >> >
>>> >>
>>> >>
>>> https://docs.google.com/document/d/1fhwnIZ5TqwklGx71pLmfSghysls1S4_5ktEsj
>>> >>A
>>> >> >9ac5Y/edit
>>> >> >[2] https://github.com/apache/cordova-cli/pull/4
>>> >>
>>> >>
>>>
>>>
>>