At the moment, the CLI cheats in some respects:
var cordova = require('cordova');
var qrcode = require('qrcode-terminal');
var config = require('../common/config');
Additionally, it must awkwardly pass the phonegap object around. The PhoneGap object has been updated to include a global instance under lib/main.js, which is exposed as the npm main entry point.
The CLI should be updated to only use the lib/main.js. This is a good exercise for the library.
[#30] Replace CLI uses library instance of PhoneGap.
[#30] Remove cli.phonegap instance to treat as external library.
[#30] CLI only binds to log/warn/error events.
[#30] $ phonegap app consumes phonegap library.
[#30] Fix broken app specs.
[#30] $ phonegap create <path> uses phonegap lib.
[#30] $ phonegap local build <platform> uses phonegap library.
[#30] $ phonegap remote logout uses phonegap library.
[#30] $ phonegap remote login uses phonegap library.
[#30] $ phonegap remote build <platform> uses phonegap library.
[#30] $ phonegap build <platform> uses phonegap library.
The CLI is now a minimal implementation is consumes the phonegap library.