Merge pull request #48 from juliascript/master

Update ThirdPartyPackageManagers.md
diff --git a/README.md b/README.md
index 3eea5d5..60e0c92 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@
 | Proposal | Status/Notes
 |----------|-------------------
 | [Nightly Builds for Cordova and platforms](https://github.com/cordova/cordova-discuss/pull/47) | Proposed |
+| [Templates in Cordova CLI Part 2](https://github.com/cordova/cordova-discuss/pull/49) | Proposed |
 
 
 ## Completed Proposals
@@ -32,5 +33,6 @@
 | [Add Telemetry to Cordova CLI](proposals/Telemetry.md) | In Progress
 | Ideas for improving documentation [[1]](proposals/ImprovedDocumentation.md) [[2]](proposals/ImproveCordovaDocumentation.md) | Most of the recommendations completed |
 | [CI for PRs submitted for cordova plugins](proposals/ci-for-plugin-prs.md) | Completed
+| [Unified cordova-fetch proposal](https://github.com/cordova/cordova-discuss/blob/master/proposals/fetching.md) | Completed
 
 
diff --git a/proposals/fetching.md b/proposals/fetching.md
new file mode 100644
index 0000000..c69164b
--- /dev/null
+++ b/proposals/fetching.md
@@ -0,0 +1,59 @@
+# Unified Cordova Fetching Proposal
+- Status: Completed
+
+### Current
+
+Three existing fetching implementations.
+
+1. Platform Fetching 
+    - Platform.js https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/platform.js#L258
+    - Lazy Load https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/lazy_load.js
+
+2. Plugin Fetching
+
+    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
+
+3. Template Fetching
+    - create.js https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/create.js#L167
+    - remote load https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/remote_load.js
+
+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 `~/.npm/PACKAGE`.
+
+### Proposal:
+
+* Create a new module named `cordova-fetch`. Fetches from npm and git. 
+* Start using system installed `npm` instead of packaging our own `npm` in `cordoba-lib`. We already check for `git` being installed, we should do the same for `npm`. We would use  `superspawn` to shell out to the system `npm`.
+* Stop using `.cordova/lib/npm_cache/`. Modules instead get fetched to root `node_modules` directory in your applications
+* Add new `--fetch` flag to `cordova` and `plugman` to use `cordova-fetch` over existing fetching methods
+* Plugin/platform removal should run `npm uninstall` on your cordova projects to remove the module from the apps `node_modules` directory.
+* if a `package.json` exists, adding `--save` will 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 `config.xml` to `package.json`. Just adding it now for future proofing.
+* Add `--fetch` flag to `cordova create APPID --template TEMPLATEID/GITURL` to use cordova-fetch when getting the template. The template is fetched to `.cordova/node_modules/` directory and the appropriate files are added. 
+
+### New Requirements
+
+* Have to remove support for installing plugins/platforms from git subdirectoires. https://cordova.apache.org/docs/en/5.0.0/guide/cli/#advanced-plugin-options. I recommend we add deprecation notices for this ASAP.
+* Every plugin, platform and template requires a `package.json`
+
+### Quirks
+
+* Currently, I am using a diff of `npm ls` to 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 `node_modules` directory.
+* As a fallback to the diffing method, I am taking the target or repo-name as the module name. Hopefully this won't be needed.
+
+### Future goals
+
+* add a package.json to cordova projects, update `cordova` to start using `package.json` as well as `config.xml`. This requires moving over some functionality from `config.xml` and updating tools to look in `package.json` before checking `config.xml`.
+
+### Links
+Issues: https://issues.apache.org/jira/browse/CB-9858 & https://issues.apache.org/jira/browse/CB-11349
+
+