Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0A03D98CD for ; Wed, 6 Mar 2013 17:30:14 +0000 (UTC) Received: (qmail 42271 invoked by uid 500); 6 Mar 2013 17:30:13 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 42171 invoked by uid 500); 6 Mar 2013 17:30:13 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 42157 invoked by uid 99); 6 Mar 2013 17:30:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 17:30:13 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of pmuellr@gmail.com designates 209.85.128.176 as permitted sender) Received: from [209.85.128.176] (HELO mail-ve0-f176.google.com) (209.85.128.176) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 17:30:09 +0000 Received: by mail-ve0-f176.google.com with SMTP id cz10so6855939veb.21 for ; Wed, 06 Mar 2013 09:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=DkbWPWxCpk85on14w761M933h4SxmnOThuFb2FvI0q4=; b=xILVbURfRy5uixGFST+xbGDi7m7f+nRRmItawt+4YBEOjwDkqbvbeMH03iNVsMhnje n+68vq/VhxPTJl8HjFLicyk8yDc6O5TqUXcnmGweTE2pdPV+7gcuF+zpUYCq6BjJvu7+ ALafusb+XKykkMc+qeBElidm96rDsilbDdJP4eetPGyldFG2LzOSLGnGmXvDH+4q+pMc C90tfhsTGvit5q7HjCAPz32NiuhuouhoHKsG6zWKcBkORD/+3Gz2VRHlEZsXMoZypDvW oYKd3FlrvlbbmGM7XdvCg3n0ABp6CcOJoVdmFpXFCtJhmZUkHxadFntx68qhL8Oeactd 6Iiw== MIME-Version: 1.0 X-Received: by 10.52.21.212 with SMTP id x20mr10058221vde.106.1362590987873; Wed, 06 Mar 2013 09:29:47 -0800 (PST) Received: by 10.58.96.43 with HTTP; Wed, 6 Mar 2013 09:29:47 -0800 (PST) In-Reply-To: References: Date: Wed, 6 Mar 2013 12:29:47 -0500 Message-ID: Subject: Re: Issues with CLI From: Patrick Mueller To: dev@cordova.apache.org Content-Type: multipart/alternative; boundary=20cf3079bb28cea30504d744efc2 X-Virus-Checked: Checked by ClamAV on apache.org --20cf3079bb28cea30504d744efc2 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Mar 5, 2013 at 2:39 PM, Becky Gibson wrote: > I played around a bit with cordova-cli and have a few comments and > questions. Been a long time since I've looked at this, so I just did, and have a few comments. Nice work so far! First, to get going quickly, I did this: cd ~/tmp mkdir cli cd cli touch package.json npm install cordova 18 minutes later (!!!) the beast was done installing. Curious about the size, I did a `du -h -d3` or some such, and here are some interesting thangs: 5.1M ./node_modules/cordova/lib/cordova-android 2.6M ./node_modules/cordova/lib/cordova-blackberry 8.9M ./node_modules/cordova/lib/cordova-ios ---- 17M ./node_modules/cordova/lib 15M ./node_modules/cordova/node_modules/plist 1.8M ./node_modules/cordova/node_modules/plugman 1.8M ./node_modules/cordova/node_modules/prompt ---- 23M ./node_modules/cordova/node_modules 28M ./node_modules/cordova/spec/fixtures 4.0K ./node_modules/cordova/temp/.cordova 6.6M ./node_modules/cordova/temp/www ---- 6.6M ./node_modules/cordova/temp ---- 81M ./node_modules/cordova Some simple stuff first - add the `temp` directory to your .npmignore so it doesn't get added to the package when publishing. And I wonder why plist, plugman, and prompt are so big? (didn't investigate). So a big chunk of this change comes from our test cases `spec/fixtures` and runtime libraries `lib/cordova-*`. Basically we're shipping the tool(s), the runtimes, and the tests all in one big package. Seems like we shouldn't be doing this, at least long term. Check out what grunt recently did with their package: http://gruntjs.com/blog/2013-02-18-grunt-0.4.0-released It now ships a tool that you install globally, and then when you want to use grunt in one of your packages, you add the grunt runtime and plugins to your package. Of course, this means your tooling needs to be able to handle any version of the runtime and plugins. Prolly can't do that now - for us - but a nice long-term. I think the work-flow I'd like to see, in terms of how wads of runtimes, tests, plugins are handled is something like this: - install the command-line tool globally, once - optionally cache runtimes, tests, plugins via the globally command - `cordova platform add foo` would then use the cached runtime, if available, or download it if not - same for plugins and tests and whatever else - I'd want to be able to set the cordova version in my project; another cli command `cordova version xyz` that writes to a file in the project. Thereafter, you never need to specify a cordova version for your project. - the cached runtimes, plugins, versions would all be versioned, so I can have multiple versions of cordova installed simultaneously on my box, and so have different projects using different versions, but the same tools, at the same time. Until we get to a point where the shapes of runtimes, plugins, etc isn't changing, we can't really have a single global command that works across versions. Kind of. You could imagine the single global command - for now - also downloads the "real" tooling for the specific version, based on whatever version you set. Either store that in the project as well (it's just JS code), or in the cache. We can arrange to have the hefty pre-reqs like `plist` downloaded with the global tool shim, and then pass it along to the version-specific tool meat. I think it may well make sense to make the runtimes, plugins, etc as npm packages, but I'm not sure it makes sense to actually put them in npmjs.org. What I'm thinking is that our cli can programmatically use npm, and then allow it to work off multiple, user-specified repositories. The existing npm cli doesn't make it easy to deal with multiple, or even non-default repos, but presumably this is easier from the npm module itself. We wouldn't even have to run an actual npm server, we could arrange for our code to download lists of modules it gets from somewhere, where the repo for the package eventually points to a plain ol' tar.gz of the package, or a git repo, or whatever. -- Patrick Mueller http://muellerware.org --20cf3079bb28cea30504d744efc2--