Three existing fetching implementations.
a) cordova plugin fetching - plugin.js https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/plugin.js#L147 - fetch.js https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/plugman/fetch.js - registry.fetch https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/plugman/registry/registry.js#L123 b) plugman plugin fetching - install.js https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/plugman/install.js - possiblyFetch https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/plugman/install.js#L104 - fetch.js https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/plugman/fetch.js - registry.fetch https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/plugman/registry/registry.js#L123
Both lazy load and remote load use gitclone.js https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/gitclone.js
Currently, platforms and templates are cached at
~/.cordova/lib/npm_cache/PACKAGE. On master, plugins are being cached to
cordova-fetch. Fetches from npm and git.
npminstead of packaging our own
cordoba-lib. We already check for
gitbeing installed, we should do the same for
npm. We would use
superspawnto shell out to the system
.cordova/lib/npm_cache/. Modules instead get fetched to root
node_modulesdirectory in your applications
cordova-fetchover existing fetching methods
npm uninstallon your cordova projects to remove the module from the apps
--savewill also add the dependency to
package.json(as well as to
config.xml). This won't be used until a future update is made to move save functionality from
package.json. Just adding it now for future proofing.
cordova create APPID --template TEMPLATEID/GITURLto use cordova-fetch when getting the template. The template is fetched to
.cordova/node_modules/directory and the appropriate files are added.
npm lsto determine which module was just installed. This is because the user can pass in a git url as a target to
cordova-fetch. If the git url repo-name is different than the
package.name, only way to get what module was just installed is by doing a diff before and after the installation. The diffing technique can fail if the user is adding a module that has already been npm installed. Luckily cordova doesn't allow adding platform/plugin which has already been added. cordova platform/plugin rm will also remove the module from the applications
cordovato start using
package.jsonas well as
config.xml. This requires moving over some functionality from
config.xmland updating tools to look in