Also, to Jesse's suggestion about having a package.json for each installed platform in a cordova project -- I'm not sure that is necessary. You can require these node scripts explicitly already:
aka: require('./platforms/android/cordova/run') instead of exec('./platforms/android/cordova/run'). We should just update the platform scripts to check "if (require.main === module)". -Michal On Wed, May 28, 2014 at 10:28 AM, Michal Mocny <mmo...@chromium.org> wrote: > I tend to agree with Andrew that it should not be necessary to add > platforms to CLI's package.json dependency list. I'm not sure that there > is a benefit to doing that, except perhaps that ability to add platforms > when offline and you haven't loaded them previously. > > On the other hand, I think users *should* be using the latest platform > versions, and we should continue to make upgrades easier. And even if we > add explicit package.json dependencies, users could manually override npm > package versions if they really wanted specific versions of platforms. > Hopefully those would be rare cases. > > Also, if you upgrade CLI, we would not automatically update all platforms > for existing projects, it would only affect newly created ones. > > So: I think adding platforms as deps to CLI isn't the end of the world, > but I don't see the benefit either.. > > -Michal > > > On Tue, May 27, 2014 at 10:58 PM, Andrew Grieve <agri...@chromium.org> > wrote: > >> Lazy loading is what will give us the ability to support multiple versions >> of platforms. >> >> If we don't support users choosing the version of the platform they want, >> then they will resist updating their version of CLI (like they do right >> now). >> >> I'm very keen to allow users to chose their platform versions, just as >> they >> are able to choose their plugin versions. >> >> >> >> On Tue, May 27, 2014 at 5:57 PM, Mark Koudritsky <kam...@google.com> >> wrote: >> >> > +1 >> > >> > Steve published (some of?) the platforms on npm as part of the latest >> > release. >> > https://www.npmjs.org/package/cordova-android >> > https://www.npmjs.org/package/cordova-ios >> > >> > CLI already require()s npm for downloading plugins from the registry. >> > Extending this to platforms is on my todo list for this\next week. >> > The "lazy" part of the loading was about caching, so we don't lose it >> since >> > npm does its own caching. >> > >> > >> > >> > On Tue, May 27, 2014 at 5:42 PM, Parashuram Narasimhan (MS OPEN TECH) < >> > panar...@microsoft.com> wrote: >> > >> > > +1. This will also be a step towards releasing platforms >> independently. >> > > Will the CLI have a semver like dependency on the platform specified >> > > somewhere ? Would the cli have to require('npm') and do the install? >> > > >> > > -----Original Message----- >> > > From: brian.ler...@gmail.com [mailto:brian.ler...@gmail.com] On >> Behalf >> > Of >> > > Brian LeRoux >> > > Sent: Tuesday, May 27, 2014 2:20 PM >> > > To: dev@cordova.apache.org >> > > Subject: adding platforms to npm for dependency sanity >> > > >> > > We've discussed this but I'm not sure the whole idea has crystalized. >> My >> > > proposal (based on previous discussions) below. I'll use iOS as an >> > example >> > > but this applies to all platforms supported by the CLI. >> > > >> > > First, we'd add two files: >> > > >> > > cordova-ios >> > > |-package.json >> > > '-index.js >> > > >> > > …I don't think I need to describe the utility of package.json but >> > index.js >> > > would expose programatic library apis: >> > > >> > > module.exports = { create:Function, run:Function, build:Function, >> > > clean:Function, log:Function} >> > > >> > > We then publish to npm. That is it for now. Ideal future CLI uses >> > > platforms just like other deps. We lose lazy loading but network and >> disk >> > > is cheap so it wasn't really important anyhow. >> > > >> > > Discuss! >> > > >> > >> > >