cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Grieve <agri...@chromium.org>
Subject Re: Moving plugin JS files around
Date Wed, 09 Jan 2013 21:41:44 GMT
Coolio. Won't be moving any files until everyone agrees.

The requirements (in my eyes) are:
- Should be easy for plugins to write x-platform JS
  - Cordova packager eases this with it's directory structure
- Should be easy to install / remove plugins
  - I don't think people should need to add/remove script tags in the HTML
when plugins are added/removed


On Wed, Jan 9, 2013 at 4:20 PM, Jesse <purplecabbage@gmail.com> wrote:

> Well, I kinda have to demonstrate it, I am in proof of concept mode now.
>
> I will at least elaborate on my disagreement ...
>
> >> The building tool already is a requirement of every platform, no?
> The build tool is currently only a requirement at 'package/release' time,
> so it is a requirement of ours, but not our users.  My guess is that >75%
> of people using Apache Cordova do not have cordova-js setup, they simply
> use the pre-built versioned js file that comes with each major release.
>
> Specifically, from Andrew's proposal, I am concerned with item 2:
> >> 2. "cordova build ios" will use the cordova-js packager and pass it
> >> the plugin/ directory to use
>
> I don't think there is benefit in the added complexity of having all
> plugins munged by the js packager before the output project is built, every
> time the output project is built.
>
> My original email was partially intended to buy time so I can (better)
> formalize my ideas, and hopefully demonstrate exactly what I mean. Also, I
> wanted to state that we need to talk more about it before we go hard.
>
> The term 'kinda passive aggressive' IS passive aggressive.
>
>
> On Wed, Jan 9, 2013 at 12:45 PM, Brian LeRoux <b@brian.io> wrote:
>
> > The building tool already is a requirement of every platform, no?
> >
> > Could you describe your solution Jesse? Saying you don't agree w/
> > something but failing to back it up is kinda passive aggressive.
> >
> > On Wed, Jan 9, 2013 at 11:23 AM, Jesse <purplecabbage@gmail.com> wrote:
> > > Andrew,
> > > The approach you mention makes the cordova-js builder tool a
> requirement
> > of
> > > every platform.
> > > I don't think this is the correct approach.
> > >
> > > I will be sharing my implementation soon, in my own branch.
> > >
> > >
> > >
> > > On Wed, Jan 9, 2013 at 11:10 AM, Shazron <shazron@gmail.com> wrote:
> > >
> > >> +1
> > >>
> > >>
> > >> On Wed, Jan 9, 2013 at 10:57 AM, Filip Maj <fil@adobe.com> wrote:
> > >>
> > >> > https://github.com/alunny/cordova-plugin-spec
> > >> >
> > >> >
> > >> > We should move this to our wiki asap
> > >> >
> > >> > On 1/9/13 7:28 AM, "Gord Tanner" <gtanner@gmail.com> wrote:
> > >> >
> > >> > >Ideally the require paths should stay true to the following rules
> > (not
> > >> > >that
> > >> > >we follow them exactly now but we are close):
> > >> > >
> > >> > >1. should always start with cordova (in case we ever share a
> require
> > >> > >framework)
> > >> > >2. should follow as close as possible to the folder structure.
> > >> > >
> > >> > >We don't really do this now (but we are close).  It is mainly
to
> help
> > >> with
> > >> > >navigation of the project from a require statement:
> > >> > >
> > >> > >     var foo = require('cordova/plugin/foo/submodule')
> > >> > >
> > >> > >Ideally I should be able to navigate to a file that lives in:
> > >> > >
> > >> > >     ~/cordova.js/plugin/foo/submodule.js
> > >> > >
> > >> > >But realistically we are probably going to see:
> > >> > >
> > >> > >    ~/cordova.js/plugin/foo/js/submodule.js
> > >> > >
> > >> > >Assuming we are dumping everything into a js folder here is the
> > >> "mapping"
> > >> > >off the top of my head:
> > >> > >
> > >> > >    var foo = require('cordova/plugin/foo')
> > >> > >    ~/cordova.js/plugin/foo/js/index.js
> > >> > >
> > >> > >    var foo = require('cordova/plugin/foo/ios')
> > >> > >    ~/cordova.js/plugin/foo/js/ios.js
> > >> > >
> > >> > >    var foo = require('cordova/plugin/foo/blackberry/qnx')
> > >> > >    ~/cordova.js/plugin/foo/js/blackberry/qnx.js
> > >> > >
> > >> > >What does a plugin (native and js code) folder structure look
like?
> > >> > >
> > >> > >
> > >> > >On Wed, Jan 9, 2013 at 9:42 AM, Andrew Grieve <agrieve@google.com>
> > >> wrote:
> > >> > >
> > >> > >> I'd like to take a first step towards moving plugin JS into
> > separate
> > >> > >>repos
> > >> > >> by first moving them around within cordova-js.
> > >> > >>
> > >> > >> Here is my proposal:
> > >> > >>
> > >> > >> Current structure:
> > >> > >>         lib/common/plugin/*.js
> > >> > >>         lib/$PLATFORM/plugin/*.js
> > >> > >>
> > >> > >> New structure:
> > >> > >>         plugin/$PLUGIN_NAME/js/common/*.js
> > >> > >>         plugin/$PLUGIN_NAME/js/$PLATFORM/*.js
> > >> > >>
> > >> > >> The require path will need to change. Going from:
> > >> > >>         cordova.require('cordova/plugin/FileTransferError')
> > >> > >> To:
> > >> > >>         cordova.require('plugin/file/FileTransferError')
> > >> > >>
> > >> > >>
> > >> > >> I'll obviously need to update the builder scripts accordingly.
> The
> > >> idea
> > >> > >> here is that we:
> > >> > >>         1. "cordova plugin add" will copy files into a project's
> > >> plugins
> > >> > >> directory
> > >> > >>         2. "cordova build ios" will use the cordova-js packager
> and
> > >> > >>pass it
> > >> > >> the plugin/ directory to use
> > >> > >>
> > >> > >> This will not involve changing how we export modules onto
> > namespaces
> > >> in
> > >> > >> common.js / platform.js. That will come next though.
> > >> > >>
> > >> > >>
> > >> > >> The resulting structure will look like:
> > >> > >>
> > >> > >> plugin/accelerometer/js/common/Acceleration.js
> > >> > >> plugin/accelerometer/js/common/accelerometer.js
> > >> > >> plugin/battery/js/common/battery.js
> > >> > >> plugin/compass/js/common/Compass*.js
> > >> > >> plugin/contacts/js/common/Contact*.js
> > >> > >> plugin/device/js/common/device.js
> > >> > >> plugin/geolocation/js/common/Coordinates.js
> > >> > >> plugin/geolocation/js/common/Position*.js
> > >> > >> plugin/globalization/js/common/Globalization*.js
> > >> > >> plugin/inappbrowser/js/common/InAppBrowser.js
> > >> > >> plugin/logger/js/common/logger.js
> > >> > >> plugin/logger/js/common/console-via-logger.js
> > >> > >> plugin/media/js/common/Capture*.js
> > >> > >> plugin/media/js/common/ConfigurationData.js
> > >> > >> plugin/media/js/common/Media*.js
> > >> > >> plugin/network/js/common/Connection.js
> > >> > >> plugin/notification/js/common/notification.js
> > >> > >> plugin/camera/js/common/Camera*.js
> > >> > >> plugin/echo/js/common/echo.js
> > >> > >> plugin/file/js/common/Directory*.js
> > >> > >> plugin/file/js/common/Entry.js
> > >> > >> plugin/file/js/common/File*.js
> > >> > >> plugin/file/js/common/Flags.js
> > >> > >> plugin/file/js/common/LocalFileSystem.js
> > >> > >> plugin/file/js/common/Metadata.js
> > >> > >> plugin/file/js/common/ProgressEvent.js
> > >> > >> plugin/splashscreen/js/common/splashscreen.js
> > >> > >>
> > >> >
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > @purplecabbage
> > > risingj.com
> >
>
>
>
> --
> @purplecabbage
> risingj.com
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message