incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Mueller <pmue...@gmail.com>
Subject Re: proposed common-js file moves/renames for post-1.5
Date Fri, 24 Feb 2012 16:11:29 GMT
On Fri, Feb 24, 2012 at 10:39, Drew Walters <deedubbu@gmail.com> wrote:

> > - move the platform-specific modules out of `lib`, into a new top-level
> > directory named `platform`, which has subdirectories for each platform,
> and
> > then cordova/blah/... directories for any additional files for the
> > platform, including potentially overlaid files
> I don't understand why this would be a peer of `lib` and not a child.
> In your examples you list 'platform/android/cordova/exec.js'. This
> seems to imply that the platform specific files could apply to more
> then just cordova since cordova would be a child.
>

Right; there would be multiple `cordova` subdirectories in the tree:

   cordova-js/cordova/... - all the portable stuff
   cordova-js/platform/android/cordova - all the android specfic stuff
   cordova-js/platform/ios/cordova - all the ios specfic stuff

So, yes, I would expect that platforms could supply modules "outside" of
the cordova module-id-space.  So, there might exist a file

   cordova-js/platform/android/my-coolio-stuff.js

This would end up getting built as a top-level 'my-coolio-stuff' module -
require('my-coolio-stuff') would return that module, for android.

But I don't expect that we would actually do that.  The reason to have the
cordova directory IN the `cordova/platform/android` directory, is so that
the directories of the modules line up with the module ids that we
generate.  Otherwise, you'll need to do the translation everytime you see

    cordova-js/platform/android/app.js

and realize - "oh that's actually the module 'cordova/app'


> Unless there is a
> reason for this, I still like 'cordova/platform/android/exec' better.
> Seems to me we would want to keep the module namespace beneath
> 'cordova'.
>

To be more specific:

- rename `~/lib` to `~/cordova`; there is no more `~/lib`.
- mkdir ~/platform
- mkdir ~/platform/android
- mkdir ~/platform/...
- move platform-specific stuff in ~/cordova (was ~/lib), in such a way as
each module exists in a path associated with it's eventual module id,
prefixed by `~/platform/[whicheverPlatform]`
- move non-modules into a 'new' `~/lib` directory; it's more than just
require.js - bootstrap, etc

Now, to do a build for a platform:
- collect as modules all files from ~/cordova
- collect as modules all files from ~/platform/[whicheverPlatform]/cordova
- collect as scripts all files from ~/lib

bonusi:

- the files are laid out exactly as the modules will be named, modulo
platform-specific prefix directories for platform-specific files; no more
in-head conversion when I'm looking at directory listings of modules.

- no more logic in the build script, just three "virtual" `cp -R`s.

- prolly easy to use with requirejs et al

 > - there are also plain ol' scripts like `require.js` which should be

> > separate from the modules, in say a top-level `scripts` directory
> +1 though I think require.js is the only example of this so far and I
> would vote for keeping it under 'cordova' name space and in a 'lib'
> folder (showing my C roots).
>

Pretty sure it's more than require.js.  And `scripts` makes more sense to
me than `lib`.

-- 
Patrick Mueller
http://muellerware.org

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