cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Mocny <mmo...@chromium.org>
Subject Re: cordova cli global vs. local install
Date Fri, 20 Sep 2013 16:22:24 GMT
Some food for thought:

* Cordova-cli uses a global ~/.cordova folder, which means each workspace
is never fully isolated from all the others since they share global state.
 This means all versions of cordova-cli should be forwards and backwards
compatible with the structure of ~/.cordova.  **This is already true
today** regardless of supporting local npm installs, because we run into
this issue every time you upgrade your global version and have the old
~/.cordova around.

* The wrapper I wrote defaults to creating a locally installed npm cordova
for you, but that was just for testing.  I think if we decide to add this
to cordova-cli proper it should default to using a globally installed
version (effectively what cordova-cli does right now).  Cli would fork to
local version only if you had a local install
  * Should still add a convenience helper "cordova create
--version=@version" (something like that).  This is useful for the reasons
outlined earlier in this thread about the bootstrapping problem (i.e. you
have to install cordova version in order to call its create method, but
where do you install it if you haven't created workspace yet).

* For the default "use globally installed cordova" option, do we add the
smarts inside the wrapper to looking globally, or do we just leverage npm
--link and always expect a local node_modules?

* Do we want to add something like this right in to `cordova`, or leave it
as a userland tool like it is now / publish to npm under a different
package?

-Michal


On Fri, Sep 20, 2013 at 8:47 AM, Michal Mocny <mmocny@chromium.org> wrote:

> I decided to scratch this itch and have a super early version here:
> https://github.com/mmocny/cordova-cli-wrapper
>
> README.md should describe more or less the usage.
>
> -Michal
>
>
> On Tue, Sep 10, 2013 at 6:56 AM, Carlos Santana <csantana23@gmail.com>wrote:
>
>> Wow! I went to bed and came back too much awesomeness (that's what
>> happens when you are in the east coast :-) )
>>
>> Thank you for taking the time to provide feedback and brainstorm around
>> this topic.
>>
>> I agree with Michal, I think cordova-cli doesn't fit the use case
>> perfectly because of bootstrap, cordova creates the empty directory and
>> populates workspace where grunt already assumes directory&file created
>> I agree with Tommy to many commands to get started. and thanks for the
>> tip of using npm link that could be use in the blog also
>>
>> I will continue brainstorm maybe there is a solution outside cordova,
>> maybe some type of bootstrapping with template/scaffolding or "cordova init"
>>
>> But from the discussion I think there are some good outcomes that I like:
>>
>> *+1 Write a blog post about using cordova locally*
>>      The scenario (having one build server that runs cordova builds for
>> different teams/apps, not all teams might want to share same cordova cli
>> and its dependencies)
>>      Global requirements: Only node and npm install globally
>>      Installing with npm locally
>>      Running the local version (./node_modules/.bin/cordova or
>> ./node_modules/cordova)
>>      Using npm link or modifying $PATH
>>      Checking into source control local node_modules/ including cordova
>> cli and its dependencies
>>            (http://www.futurealoof.com/posts/nodemodules-in-git.html)
>> "Only checkin node_modules for applications you deploy, not reusable
>> packages you maintain."
>>      etc...
>>
>> *+1 Version detection for cli tool*
>>     cordova and plugman to inform the user that a new version of the tool
>> is available
>> [Bower] (http://bower.io) does something similar:
>> exp5:$ ./node_modules/.bin/bower install jquery
>> -----------------------------------------
>> Update available: 1.2.6 (current: 1.2.5)
>> Run npm update -g bower to update
>> -----------------------------------------
>> [image: Inline image 1]
>>
>> *+1 I'm adding this one "version reporting for platforms and plugins"*
>> What about reporting the versions of the platforms and the plugins?
>>
>> Today I only get a list of them but it doesn't let me know what version
>> are installed or check if a new version is available for plugin or platform.
>> Reporting what's install should be a good start
>>
>>
>> myHybridAppFolder:(master)$ cordova platforms
>> Installed platforms: android, ios
>> Available platforms: blackberry10
>> myHybridAppFolder:(master)$ cordova plugins
>> [ 'org.apache.cordova.core.device',
>>   'org.apache.cordova.core.device-orientation',
>>   'org.apache.cordova.core.dialogs',
>>   'org.apache.cordova.core.file',
>>   'org.apache.cordova.core.geolocation',
>>   'org.apache.cordova.core.globalization',
>>   'org.apache.cordova.core.inappbrowser',
>>   'org.apache.cordova.core.media-capture',
>>   'org.apache.cordova.core.network-information',
>>   'org.apache.cordova.core.vibration' ]
>> myHybridAppFolder:(master)$
>>
>>
>>
>>
>>
>>
>> On Tue, Sep 10, 2013 at 5:55 AM, Jesse <purplecabbage@gmail.com> wrote:
>>
>>> cd 3.0
>>> npm link .
>>> cd ..
>>> cordova -v
>>>
>>> cd 3.1
>>> npm link .
>>> cd ..
>>> cordova -v
>>>
>>> Very gruntable
>>>
>>>
>>> @purplecabbage
>>> risingj.com
>>>
>>>
>>> On Mon, Sep 9, 2013 at 9:27 PM, Tommy-Carlos Williams <
>>> tommy@devgeeks.org>wrote:
>>>
>>> > Or, we could just drop it... and just write a blog post on how to use a
>>> > local cordova vs the global one in projects you want to have a specific
>>> > version (i.e.: some script code example wrapper for a cordova command
>>> in
>>> > ./node_modules/.bin/cordova).
>>> >
>>> > 0.o
>>> >
>>> > - tommy
>>> >
>>> >
>>> >
>>> > On 10/09/2013, at 1:42 PM, Michal Mocny <mmocny@chromium.org> wrote:
>>> >
>>> > > An alternative to leveraging npm locally may be to split cli/lib node
>>> > > modules as proposed, but just use the existing .cordova/config.json
>>> file
>>> > to
>>> > > specify the cordova lib location.  By default, cordova-cli uses the
>>> > global
>>> > > npm install of cordova-lib, but that could be overwritten just like
>>> > > platform versions.  This would also support both a "global lib,
>>> upgrade
>>> > all
>>> > > at once" as well as a "local lib, upgrade on demand" workflow.
>>> >
>>> >
>>>
>>
>>
>>
>> --
>> Carlos Santana
>> <csantana23@gmail.com>
>>
>
>

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