{"action":"created","comment":{"url":"https://api.github.com/repos/angular/angular-cli/pulls/comments/56702974","id":56702974,"diff_hunk":"@@ -0,0 +1,83 @@\n+/* jshint node: true, esversion: 6 */\n+'use strict';\n+\n+const Promise           = require('ember-cli/lib/ext/promise');\n+const Task              = require('ember-cli/lib/models/task');\n+const chalk             = require('chalk');\n+const path              = require('path');\n+const fs                = require('fs');\n+const fse               = require('fs-extra');\n+const exec              = Promise.denodeify(require('child_process').exec);\n+const packageJSON       = path.resolve(process.cwd(), 'package.json');\n+const nodeModules       = path.resolve(process.cwd(), 'node_modules');\n+const npmUninstall      = require('./npm-uninstall');\n+const typingsUninstall  = require('./typings-uninstall');\n+\n+module.exports = Task.extend({\n+  completionOKMessage: 'Successfully uninstalled.',\n+  completionErrorMessage: 'Error uninstalling package.',\n+\n+  run: function(options) {\n+    this.package = options.package;\n+    this.typings = options.typings;\n+\n+    return this.uninstallProcedure();\n+  },\n+\n+  uninstallProcedure: function() {\n+    this.ui.startProgress(chalk.green(`Uninstalling package: ${this.package}`), chalk.green(`.`));\n+\n+    return npmUninstall(this.package)\n+      .then(() => this.unlinkPackage(this.package))\n+      .then(() => this.removeFromSystemJSConfig(this.package))\n+      .then(() => this.ui.stopProgress())\n+      .then(() => {\n+        const typings = this.typings;\n+        if (this.typings) {\n+          this.ui.startProgress(chalk.green(`Uninstalling typings: ${typings}`), chalk.green(`.`));\n+          return typingsUninstall(this.typings).then(() => this.ui.stopProgress())\n+        }\n+        else {\n+          this.announceOKCompletion();\n+        }\n+      })\n+      .then(() => this.announceOKCompletion());\n+  },\n+\n+  unlinkPackage: function(pkg) {\n+    const dir = path.resolve(process.cwd(), 'src', 'libs', pkg);\n+    fse.removeSync(dir);\n+\n+    return Promise.resolve();\n+  },\n+\n+  removeFromSystemJSConfig: function(pkg) {\n+    const systemPath = path.resolve(process.cwd(), 'src', 'config', 'system.config.js');\n+    let systemContents = fs.readFileSync(systemPath, 'utf8');\n+\n+    systemContents = systemContents.split('\\n');","path":"addon/ng2/tasks/uninstall.js","position":58,"original_position":58,"commit_id":"0e347f54bb22786aba0aa76c2021d126323139a7","original_commit_id":"0e347f54bb22786aba0aa76c2021d126323139a7","user":{"login":"hansl","id":681969,"avatar_url":"https://avatars.githubusercontent.com/u/681969?v=3","gravatar_id":"","url":"https://api.github.com/users/hansl","html_url":"https://github.com/hansl","followers_url":"https://api.github.com/users/hansl/followers","following_url":"https://api.github.com/users/hansl/following{/other_user}","gists_url":"https://api.github.com/users/hansl/gists{/gist_id}","starred_url":"https://api.github.com/users/hansl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hansl/subscriptions","organizations_url":"https://api.github.com/users/hansl/orgs","repos_url":"https://api.github.com/users/hansl/repos","events_url":"https://api.github.com/users/hansl/events{/privacy}","received_events_url":"https://api.github.com/users/hansl/received_events","type":"User","site_admin":false},"body":"See above. Please move both functions into a separate module and require that module.\r\n\r\nSomething like:\r\n\r\n```typescript\r\nexport function loadSystemJson(systemPath: string): { [name: string]: any } {\r\n  ...\r\n}\r\nexport function saveSystemJson(systemPath: string, json: { [name: string]: any }) {\r\n  ...\r\n}```","created_at":"2016-03-18T18:36:08Z","updated_at":"2016-03-18T18:36:08Z","html_url":"https://github.com/angular/angular-cli/pull/294#discussion_r56702974","pull_request_url":"https://api.github.com/repos/angular/angular-cli/pulls/294","_links":{"self":{"href":"https://api.github.com/repos/angular/angular-cli/pulls/comments/56702974"},"html":{"href":"https://github.com/angular/angular-cli/pull/294#discussion_r56702974"},"pull_request":{"href":"https://api.github.com/repos/angular/angular-cli/pulls/294"}}},"pull_request":{"url":"https://api.github.com/repos/angular/angular-cli/pulls/294","id":62599771,"html_url":"https://github.com/angular/angular-cli/pull/294","diff_url":"https://github.com/angular/angular-cli/pull/294.diff","patch_url":"https://github.com/angular/angular-cli/pull/294.patch","issue_url":"https://api.github.com/repos/angular/angular-cli/issues/294","number":294,"state":"open","locked":false,"title":"feat(libs): 1. phase from design docs","user":{"login":"jkuri","id":1796022,"avatar_url":"https://avatars.githubusercontent.com/u/1796022?v=3","gravatar_id":"","url":"https://api.github.com/users/jkuri","html_url":"https://github.com/jkuri","followers_url":"https://api.github.com/users/jkuri/followers","following_url":"https://api.github.com/users/jkuri/following{/other_user}","gists_url":"https://api.github.com/users/jkuri/gists{/gist_id}","starred_url":"https://api.github.com/users/jkuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkuri/subscriptions","organizations_url":"https://api.github.com/users/jkuri/orgs","repos_url":"https://api.github.com/users/jkuri/repos","events_url":"https://api.github.com/users/jkuri/events{/privacy}","received_events_url":"https://api.github.com/users/jkuri/received_events","type":"User","site_admin":false},"body":"Install example: `ng install moment --typings moment-node`\r\nUninstall examle: `ng uninstall lodash --typings lodash`","created_at":"2016-03-11T20:43:17Z","updated_at":"2016-03-18T18:36:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf1663db0c07ca3642878d3ef13bb25adfe00857","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/angular/angular-cli/pulls/294/commits","review_comments_url":"https://api.github.com/repos/angular/angular-cli/pulls/294/comments","review_comment_url":"https://api.github.com/repos/angular/angular-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/angular-cli/issues/294/comments","statuses_url":"https://api.github.com/repos/angular/angular-cli/statuses/0e347f54bb22786aba0aa76c2021d126323139a7","head":{"label":"jkuri:install","ref":"install","sha":"0e347f54bb22786aba0aa76c2021d126323139a7","user":{"login":"jkuri","id":1796022,"avatar_url":"https://avatars.githubusercontent.com/u/1796022?v=3","gravatar_id":"","url":"https://api.github.com/users/jkuri","html_url":"https://github.com/jkuri","followers_url":"https://api.github.com/users/jkuri/followers","following_url":"https://api.github.com/users/jkuri/following{/other_user}","gists_url":"https://api.github.com/users/jkuri/gists{/gist_id}","starred_url":"https://api.github.com/users/jkuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkuri/subscriptions","organizations_url":"https://api.github.com/users/jkuri/orgs","repos_url":"https://api.github.com/users/jkuri/repos","events_url":"https://api.github.com/users/jkuri/events{/privacy}","received_events_url":"https://api.github.com/users/jkuri/received_events","type":"User","site_admin":false},"repo":{"id":50618479,"name":"angular-cli","full_name":"jkuri/angular-cli","owner":{"login":"jkuri","id":1796022,"avatar_url":"https://avatars.githubusercontent.com/u/1796022?v=3","gravatar_id":"","url":"https://api.github.com/users/jkuri","html_url":"https://github.com/jkuri","followers_url":"https://api.github.com/users/jkuri/followers","following_url":"https://api.github.com/users/jkuri/following{/other_user}","gists_url":"https://api.github.com/users/jkuri/gists{/gist_id}","starred_url":"https://api.github.com/users/jkuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkuri/subscriptions","organizations_url":"https://api.github.com/users/jkuri/orgs","repos_url":"https://api.github.com/users/jkuri/repos","events_url":"https://api.github.com/users/jkuri/events{/privacy}","received_events_url":"https://api.github.com/users/jkuri/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jkuri/angular-cli","description":"","fork":true,"url":"https://api.github.com/repos/jkuri/angular-cli","forks_url":"https://api.github.com/repos/jkuri/angular-cli/forks","keys_url":"https://api.github.com/repos/jkuri/angular-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jkuri/angular-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jkuri/angular-cli/teams","hooks_url":"https://api.github.com/repos/jkuri/angular-cli/hooks","issue_events_url":"https://api.github.com/repos/jkuri/angular-cli/issues/events{/number}","events_url":"https://api.github.com/repos/jkuri/angular-cli/events","assignees_url":"https://api.github.com/repos/jkuri/angular-cli/assignees{/user}","branches_url":"https://api.github.com/repos/jkuri/angular-cli/branches{/branch}","tags_url":"https://api.github.com/repos/jkuri/angular-cli/tags","blobs_url":"https://api.github.com/repos/jkuri/angular-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jkuri/angular-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jkuri/angular-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/jkuri/angular-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jkuri/angular-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/jkuri/angular-cli/languages","stargazers_url":"https://api.github.com/repos/jkuri/angular-cli/stargazers","contributors_url":"https://api.github.com/repos/jkuri/angular-cli/contributors","subscribers_url":"https://api.github.com/repos/jkuri/angular-cli/subscribers","subscription_url":"https://api.github.com/repos/jkuri/angular-cli/subscription","commits_url":"https://api.github.com/repos/jkuri/angular-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/jkuri/angular-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/jkuri/angular-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/jkuri/angular-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/jkuri/angular-cli/contents/{+path}","compare_url":"https://api.github.com/repos/jkuri/angular-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jkuri/angular-cli/merges","archive_url":"https://api.github.com/repos/jkuri/angular-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jkuri/angular-cli/downloads","issues_url":"https://api.github.com/repos/jkuri/angular-cli/issues{/number}","pulls_url":"https://api.github.com/repos/jkuri/angular-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/jkuri/angular-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/jkuri/angular-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jkuri/angular-cli/labels{/name}","releases_url":"https://api.github.com/repos/jkuri/angular-cli/releases{/id}","deployments_url":"https://api.github.com/repos/jkuri/angular-cli/deployments","created_at":"2016-01-28T22:27:19Z","updated_at":"2016-01-28T22:27:20Z","pushed_at":"2016-03-18T00:25:00Z","git_url":"git://github.com/jkuri/angular-cli.git","ssh_url":"git@github.com:jkuri/angular-cli.git","clone_url":"https://github.com/jkuri/angular-cli.git","svn_url":"https://github.com/jkuri/angular-cli","homepage":null,"size":339,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"d3649d518ce6d2aa4fa4fa5e7e784aeb9e5c803f","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":36891867,"name":"angular-cli","full_name":"angular/angular-cli","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/angular-cli","description":"CLI tool for Angular2","fork":false,"url":"https://api.github.com/repos/angular/angular-cli","forks_url":"https://api.github.com/repos/angular/angular-cli/forks","keys_url":"https://api.github.com/repos/angular/angular-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/angular-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/angular-cli/teams","hooks_url":"https://api.github.com/repos/angular/angular-cli/hooks","issue_events_url":"https://api.github.com/repos/angular/angular-cli/issues/events{/number}","events_url":"https://api.github.com/repos/angular/angular-cli/events","assignees_url":"https://api.github.com/repos/angular/angular-cli/assignees{/user}","branches_url":"https://api.github.com/repos/angular/angular-cli/branches{/branch}","tags_url":"https://api.github.com/repos/angular/angular-cli/tags","blobs_url":"https://api.github.com/repos/angular/angular-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/angular-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/angular-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/angular-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/angular-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/angular-cli/languages","stargazers_url":"https://api.github.com/repos/angular/angular-cli/stargazers","contributors_url":"https://api.github.com/repos/angular/angular-cli/contributors","subscribers_url":"https://api.github.com/repos/angular/angular-cli/subscribers","subscription_url":"https://api.github.com/repos/angular/angular-cli/subscription","commits_url":"https://api.github.com/repos/angular/angular-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/angular-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/angular-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/angular-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/angular-cli/contents/{+path}","compare_url":"https://api.github.com/repos/angular/angular-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/angular-cli/merges","archive_url":"https://api.github.com/repos/angular/angular-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/angular-cli/downloads","issues_url":"https://api.github.com/repos/angular/angular-cli/issues{/number}","pulls_url":"https://api.github.com/repos/angular/angular-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/angular-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/angular-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/angular-cli/labels{/name}","releases_url":"https://api.github.com/repos/angular/angular-cli/releases{/id}","deployments_url":"https://api.github.com/repos/angular/angular-cli/deployments","created_at":"2015-06-04T19:49:37Z","updated_at":"2016-03-18T09:35:38Z","pushed_at":"2016-03-18T15:36:09Z","git_url":"git://github.com/angular/angular-cli.git","ssh_url":"git@github.com:angular/angular-cli.git","clone_url":"https://github.com/angular/angular-cli.git","svn_url":"https://github.com/angular/angular-cli","homepage":"","size":438,"stargazers_count":761,"watchers_count":761,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":87,"mirror_url":null,"open_issues_count":20,"forks":87,"open_issues":20,"watchers":761,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/angular-cli/pulls/294"},"html":{"href":"https://github.com/angular/angular-cli/pull/294"},"issue":{"href":"https://api.github.com/repos/angular/angular-cli/issues/294"},"comments":{"href":"https://api.github.com/repos/angular/angular-cli/issues/294/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/angular-cli/pulls/294/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/angular-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/angular-cli/pulls/294/commits"},"statuses":{"href":"https://api.github.com/repos/angular/angular-cli/statuses/0e347f54bb22786aba0aa76c2021d126323139a7"}}}}