{"action":"created","issue":{"url":"https://api.github.com/repos/cordova/cordova-discuss/issues/12","labels_url":"https://api.github.com/repos/cordova/cordova-discuss/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/cordova/cordova-discuss/issues/12/comments","events_url":"https://api.github.com/repos/cordova/cordova-discuss/issues/12/events","html_url":"https://github.com/cordova/cordova-discuss/pull/12","id":94735710,"number":12,"title":"Cordova-lib refactoring proposal","user":{"login":"vladimir-kotikov","id":3857604,"avatar_url":"https://avatars.githubusercontent.com/u/3857604?v=3","gravatar_id":"","url":"https://api.github.com/users/vladimir-kotikov","html_url":"https://github.com/vladimir-kotikov","followers_url":"https://api.github.com/users/vladimir-kotikov/followers","following_url":"https://api.github.com/users/vladimir-kotikov/following{/other_user}","gists_url":"https://api.github.com/users/vladimir-kotikov/gists{/gist_id}","starred_url":"https://api.github.com/users/vladimir-kotikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladimir-kotikov/subscriptions","organizations_url":"https://api.github.com/users/vladimir-kotikov/orgs","repos_url":"https://api.github.com/users/vladimir-kotikov/repos","events_url":"https://api.github.com/users/vladimir-kotikov/events{/privacy}","received_events_url":"https://api.github.com/users/vladimir-kotikov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-07-13T14:35:01Z","updated_at":"2015-10-22T22:24:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cordova/cordova-discuss/pulls/12","html_url":"https://github.com/cordova/cordova-discuss/pull/12","diff_url":"https://github.com/cordova/cordova-discuss/pull/12.diff","patch_url":"https://github.com/cordova/cordova-discuss/pull/12.patch"},"body":"This PR is an updated version of #9 with addressed notes\r\n\r\nThe proposal describes the way how we can improve current cordova lib design and interaction between cordova lib and platforms. The document contains high-level descriptions of proposed interfaces only. For more details on methods signatures see *.js files in this pull request.\r\n\r\nThe most important points of this proposal are:\r\n\r\n## 1. The PlatformApi class\r\n\r\nPlatformApi (or CordovaPlatform) class - an abstraction around particular platform that exposes all the actions for this platform (such as build/run), so they're accessible programmatically. It also knows how to install/uninstall plugins with all source files, web assets and js files, so this is no more responsibility of cordova-lib. It also exposes single 'prepare' method to provide a way for cordova-lib to apply project's settings/www content to platform.\r\n\r\nThe PlatformApi class needs to be implemented by each platform, that wants to use new API flow. For those platforms, which doesn't provide own PlatformApi, there will be a polyfill in cordova-lib.\r\n\r\nThere is a PR to cordova-lib, which implements the polyfill: https://github.com/MSOpenTech/cordova-lib/pull/2\r\n\r\nMore detailed info: [Cordova-lib refactoring proposal.md](https://github.com/vladimir-kotikov/cordova-discuss/blob/1d32d08ae63b854c1f107846ba19bc39db0be137/proposals/Cordova-lib%20refactoring%20proposal.md#1-the-platformapi-class)\r\nInterface reference: [PlatformApi.js](https://github.com/vladimir-kotikov/cordova-discuss/blob/1d32d08ae63b854c1f107846ba19bc39db0be137/proposals/PlatformApi.js)\r\n\r\n## 2. The ProjectAPI class\r\n\r\nProjectAPI (or CordovaProject) class - an abstraction of cordova project with multiple platforms/plugins installed. Manages the platforms and delegates the responsibilities to corresponding platform:\r\n\r\n    Project.run -> this.platforms.foreach(platform.run);\r\n\r\nIt also does some additional job:\r\n\r\n  * fetches plugins/platforms from any sources (git/npm/web)\r\n  * resolves plugin dependencies\r\n  * handles platform's restrictions (<engine> tag)\r\n\r\nMore detailed info: [Cordova-lib refactoring proposal.md](https://github.com/vladimir-kotikov/cordova-discuss/blob/1d32d08ae63b854c1f107846ba19bc39db0be137/proposals/Cordova-lib%20refactoring%20proposal.md#2-the-projectapi-class)\r\nInterface reference: [ProjectApi.js](https://github.com/vladimir-kotikov/cordova-discuss/blob/1d32d08ae63b854c1f107846ba19bc39db0be137/proposals/ProjectApi.js)\r\n\r\n## `cordova-common` module\r\n\r\n'cordova-common' module - required to share similar code between platforms and lib. Currently there are following candidates for moving to `cordova-common`:\r\n\r\n    `superspawn`\r\n    `ActionStack`\r\n    `CordovaError`\r\n    `PlatformJson`\r\n    `ConfigParser`\r\n    `PluginInfo`\r\n    `PluginInfoProvider`\r\n    `ConfigChanges`\r\n    `ConfigKeeper`\r\n    `ConfigFile`\r\n    `mungeUtil`\r\n    `xmlHelpers`\r\n\r\nThe PR for `cordova-common` module is ready and published here: https://github.com/MSOpenTech/cordova-lib/pull/3.\r\n\r\n## Links:\r\nPlatformApi proposal with APIs' definitions: https://github.com/cordova/cordova-discuss/pull/9\r\nPlatformApi polyfill implementation for cordova-lib: https://github.com/MSOpenTech/cordova-lib/pull/2\r\n`cordova-common` implementation: https://github.com/MSOpenTech/cordova-lib/pull/3\r\n\r\nPull requests:\r\n\r\n- `PlatformApi` polyfill: https://github.com/MSOpenTech/cordova-lib/pull/2\r\n- `cordova-common` implementation: https://github.com/MSOpenTech/cordova-lib/pull/3"},"comment":{"url":"https://api.github.com/repos/cordova/cordova-discuss/issues/comments/150372708","html_url":"https://github.com/cordova/cordova-discuss/pull/12#issuecomment-150372708","issue_url":"https://api.github.com/repos/cordova/cordova-discuss/issues/12","id":150372708,"user":{"login":"stevengill","id":169536,"avatar_url":"https://avatars.githubusercontent.com/u/169536?v=3","gravatar_id":"","url":"https://api.github.com/users/stevengill","html_url":"https://github.com/stevengill","followers_url":"https://api.github.com/users/stevengill/followers","following_url":"https://api.github.com/users/stevengill/following{/other_user}","gists_url":"https://api.github.com/users/stevengill/gists{/gist_id}","starred_url":"https://api.github.com/users/stevengill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevengill/subscriptions","organizations_url":"https://api.github.com/users/stevengill/orgs","repos_url":"https://api.github.com/users/stevengill/repos","events_url":"https://api.github.com/users/stevengill/events{/privacy}","received_events_url":"https://api.github.com/users/stevengill/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T22:24:20Z","updated_at":"2015-10-22T22:24:20Z","body":"Minor nit pick, can we move this entire proposal in to a sub directory. Right now it would add 5 new files into the root proposals directory. We can also do this after merge though. "}}