{"action":"created","comment":{"url":"https://api.github.com/repos/linnovate/mean/pulls/comments/46764026","id":46764026,"diff_hunk":"@@ -29,79 +29,88 @@ function getPackage(name, callback) {\n function install(module, options) {\n   options = options || {};\n \n-    loadPackageJson('./node_modules/meanio/package.json', function(err, data) {\n+  loadPackageJson('./node_modules/meanio/package.json', function(err, data) {\n \n-      var destination = 'packages/contrib/';\n+    var destination = 'packages/contrib/';\n \n-      if (err || data.version < '0.5.18') destination = 'node_modules/'; //what about the version???\n+    if (err || data.version < '0.5.18') destination = 'node_modules/'; //what about the version???\n \n-      var packageName = module.split('@')[0];\n+    var packageName = module.split('@')[0];\n \n-      var tag = 'master';\n+    var tag = 'master';\n \n-      tag = tag === 'latest' ? 'master' : tag;\n+    tag = tag === 'latest' ? 'master' : tag;\n \n-      getPackage(packageName, function(data) {\n-        console.log(     'Installing module: %s:', packageName);\n+    // Don't check mean.io network if packages are installed locally in core or custom\n+    fs.stat('packages/core/' + packageName, function(err, stat) {\n+      if(err) {\n+        fs.stat('packages/custom/' + packageName, function(err, stat) {\n+          if(err) {\n+            getPackage(packageName, function(data) {\n+              console.log(     'Installing module: %s:', packageName);\n \n-        if (data.repo.indexOf('git.mean.io') === -1) {\n-          options.git = true;\n-        }\n-        \n-        var cloneUrl = options.git ? data.repo : 'https://git.mean.io/' + data.repo.split(':')[1];\n+              if (data.repo.indexOf('git.mean.io') === -1) {\n+                options.git = true;\n+              }\n \n-        shell.rm('-rf', destination + data.name);\n+              var cloneUrl = options.git ? data.repo : 'https://git.mean.io/' + data.repo.split(':')[1];\n \n-        console.log('git clone --branch ' + tag + ' ' + cloneUrl + ' ' + destination + data.name);\n+              shell.rm('-rf', destination + data.name);\n \n-        var silentState = shell.config.silent; // save old silent state\n-        shell.config.silent = true;\n+              console.log('git clone --branch ' + tag + ' ' + cloneUrl + ' ' + destination + data.name);\n \n-        shell.exec('git clone --branch ' + tag + ' --depth 1 ' + cloneUrl + ' ' + destination + data.name, function(code) {\n+              var silentState = shell.config.silent; // save old silent state\n+              shell.config.silent = true;\n \n-          shell.config.silent = silentState;\n+              shell.exec('git clone --branch ' + tag + ' --depth 1 ' + cloneUrl + ' ' + destination + data.name, function(code) {\n \n-          if (code) return console.log('Failed to clone repo');\n+                shell.config.silent = silentState;\n \n+                if (code) return console.log('Failed to clone repo: ' + cloneUrl);\n \n-          var pkgPath = destination + data.name;\n \n-          shell.rm('-rf', destination + data.name + '/.git');\n-          shell.rm('-rf', destination + data.name + '/.gitignore');\n+                var pkgPath = destination + data.name;\n \n-          // Load mean.json\n-          packagesMeanJson(__dirname);\n+                shell.rm('-rf', destination + data.name + '/.git');\n+                shell.rm('-rf', destination + data.name + '/.gitignore');\n \n-          if (options.skipNpm) return;\n+                // Load mean.json\n+                packagesMeanJson(__dirname);","path":"tools/scripts/postinstall.js","position":85,"original_position":85,"commit_id":"f52399a94f63c7c95d6ee052b231f618c66cc37c","original_commit_id":"f52399a94f63c7c95d6ee052b231f618c66cc37c","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"'__dirname' is not defined.","created_at":"2015-12-05T22:36:42Z","updated_at":"2015-12-05T22:36:42Z","html_url":"https://github.com/linnovate/mean/pull/1418#discussion_r46764026","pull_request_url":"https://api.github.com/repos/linnovate/mean/pulls/1418","_links":{"self":{"href":"https://api.github.com/repos/linnovate/mean/pulls/comments/46764026"},"html":{"href":"https://github.com/linnovate/mean/pull/1418#discussion_r46764026"},"pull_request":{"href":"https://api.github.com/repos/linnovate/mean/pulls/1418"}}},"pull_request":{"url":"https://api.github.com/repos/linnovate/mean/pulls/1418","id":52766782,"html_url":"https://github.com/linnovate/mean/pull/1418","diff_url":"https://github.com/linnovate/mean/pull/1418.diff","patch_url":"https://github.com/linnovate/mean/pull/1418.patch","issue_url":"https://api.github.com/repos/linnovate/mean/issues/1418","number":1418,"state":"open","locked":false,"title":"Bypass contrib clone if package already exists in core or custom","user":{"login":"rjVapes","id":1992658,"avatar_url":"https://avatars.githubusercontent.com/u/1992658?v=3","gravatar_id":"","url":"https://api.github.com/users/rjVapes","html_url":"https://github.com/rjVapes","followers_url":"https://api.github.com/users/rjVapes/followers","following_url":"https://api.github.com/users/rjVapes/following{/other_user}","gists_url":"https://api.github.com/users/rjVapes/gists{/gist_id}","starred_url":"https://api.github.com/users/rjVapes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjVapes/subscriptions","organizations_url":"https://api.github.com/users/rjVapes/orgs","repos_url":"https://api.github.com/users/rjVapes/repos","events_url":"https://api.github.com/users/rjVapes/events{/privacy}","received_events_url":"https://api.github.com/users/rjVapes/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-05T22:36:40Z","updated_at":"2015-12-05T22:36:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e7f6cf2258169aa61b9ca54c018a3b3674f0be79","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/linnovate/mean/pulls/1418/commits","review_comments_url":"https://api.github.com/repos/linnovate/mean/pulls/1418/comments","review_comment_url":"https://api.github.com/repos/linnovate/mean/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linnovate/mean/issues/1418/comments","statuses_url":"https://api.github.com/repos/linnovate/mean/statuses/f52399a94f63c7c95d6ee052b231f618c66cc37c","head":{"label":"rjVapes:fixes/existing-package-cloning","ref":"fixes/existing-package-cloning","sha":"f52399a94f63c7c95d6ee052b231f618c66cc37c","user":{"login":"rjVapes","id":1992658,"avatar_url":"https://avatars.githubusercontent.com/u/1992658?v=3","gravatar_id":"","url":"https://api.github.com/users/rjVapes","html_url":"https://github.com/rjVapes","followers_url":"https://api.github.com/users/rjVapes/followers","following_url":"https://api.github.com/users/rjVapes/following{/other_user}","gists_url":"https://api.github.com/users/rjVapes/gists{/gist_id}","starred_url":"https://api.github.com/users/rjVapes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjVapes/subscriptions","organizations_url":"https://api.github.com/users/rjVapes/orgs","repos_url":"https://api.github.com/users/rjVapes/repos","events_url":"https://api.github.com/users/rjVapes/events{/privacy}","received_events_url":"https://api.github.com/users/rjVapes/received_events","type":"User","site_admin":false},"repo":{"id":36514054,"name":"mean","full_name":"rjVapes/mean","owner":{"login":"rjVapes","id":1992658,"avatar_url":"https://avatars.githubusercontent.com/u/1992658?v=3","gravatar_id":"","url":"https://api.github.com/users/rjVapes","html_url":"https://github.com/rjVapes","followers_url":"https://api.github.com/users/rjVapes/followers","following_url":"https://api.github.com/users/rjVapes/following{/other_user}","gists_url":"https://api.github.com/users/rjVapes/gists{/gist_id}","starred_url":"https://api.github.com/users/rjVapes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjVapes/subscriptions","organizations_url":"https://api.github.com/users/rjVapes/orgs","repos_url":"https://api.github.com/users/rjVapes/repos","events_url":"https://api.github.com/users/rjVapes/events{/privacy}","received_events_url":"https://api.github.com/users/rjVapes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rjVapes/mean","description":"MEAN (Mongo, Express, Angular, Node) - A Simple, Scalable and Easy starting point for full stack javascript web development - utilizing many of the best practices we've found on the way","fork":true,"url":"https://api.github.com/repos/rjVapes/mean","forks_url":"https://api.github.com/repos/rjVapes/mean/forks","keys_url":"https://api.github.com/repos/rjVapes/mean/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rjVapes/mean/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rjVapes/mean/teams","hooks_url":"https://api.github.com/repos/rjVapes/mean/hooks","issue_events_url":"https://api.github.com/repos/rjVapes/mean/issues/events{/number}","events_url":"https://api.github.com/repos/rjVapes/mean/events","assignees_url":"https://api.github.com/repos/rjVapes/mean/assignees{/user}","branches_url":"https://api.github.com/repos/rjVapes/mean/branches{/branch}","tags_url":"https://api.github.com/repos/rjVapes/mean/tags","blobs_url":"https://api.github.com/repos/rjVapes/mean/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rjVapes/mean/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rjVapes/mean/git/refs{/sha}","trees_url":"https://api.github.com/repos/rjVapes/mean/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rjVapes/mean/statuses/{sha}","languages_url":"https://api.github.com/repos/rjVapes/mean/languages","stargazers_url":"https://api.github.com/repos/rjVapes/mean/stargazers","contributors_url":"https://api.github.com/repos/rjVapes/mean/contributors","subscribers_url":"https://api.github.com/repos/rjVapes/mean/subscribers","subscription_url":"https://api.github.com/repos/rjVapes/mean/subscription","commits_url":"https://api.github.com/repos/rjVapes/mean/commits{/sha}","git_commits_url":"https://api.github.com/repos/rjVapes/mean/git/commits{/sha}","comments_url":"https://api.github.com/repos/rjVapes/mean/comments{/number}","issue_comment_url":"https://api.github.com/repos/rjVapes/mean/issues/comments{/number}","contents_url":"https://api.github.com/repos/rjVapes/mean/contents/{+path}","compare_url":"https://api.github.com/repos/rjVapes/mean/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rjVapes/mean/merges","archive_url":"https://api.github.com/repos/rjVapes/mean/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rjVapes/mean/downloads","issues_url":"https://api.github.com/repos/rjVapes/mean/issues{/number}","pulls_url":"https://api.github.com/repos/rjVapes/mean/pulls{/number}","milestones_url":"https://api.github.com/repos/rjVapes/mean/milestones{/number}","notifications_url":"https://api.github.com/repos/rjVapes/mean/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rjVapes/mean/labels{/name}","releases_url":"https://api.github.com/repos/rjVapes/mean/releases{/id}","created_at":"2015-05-29T15:53:37Z","updated_at":"2015-05-29T15:53:39Z","pushed_at":"2015-12-05T22:36:19Z","git_url":"git://github.com/rjVapes/mean.git","ssh_url":"git@github.com:rjVapes/mean.git","clone_url":"https://github.com/rjVapes/mean.git","svn_url":"https://github.com/rjVapes/mean","homepage":"http://mean.io","size":7435,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"linnovate:master","ref":"master","sha":"17587490e10e2a345ae4291f9f32eb154f864c95","user":{"login":"linnovate","id":307487,"avatar_url":"https://avatars.githubusercontent.com/u/307487?v=3","gravatar_id":"","url":"https://api.github.com/users/linnovate","html_url":"https://github.com/linnovate","followers_url":"https://api.github.com/users/linnovate/followers","following_url":"https://api.github.com/users/linnovate/following{/other_user}","gists_url":"https://api.github.com/users/linnovate/gists{/gist_id}","starred_url":"https://api.github.com/users/linnovate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linnovate/subscriptions","organizations_url":"https://api.github.com/users/linnovate/orgs","repos_url":"https://api.github.com/users/linnovate/repos","events_url":"https://api.github.com/users/linnovate/events{/privacy}","received_events_url":"https://api.github.com/users/linnovate/received_events","type":"Organization","site_admin":false},"repo":{"id":10219106,"name":"mean","full_name":"linnovate/mean","owner":{"login":"linnovate","id":307487,"avatar_url":"https://avatars.githubusercontent.com/u/307487?v=3","gravatar_id":"","url":"https://api.github.com/users/linnovate","html_url":"https://github.com/linnovate","followers_url":"https://api.github.com/users/linnovate/followers","following_url":"https://api.github.com/users/linnovate/following{/other_user}","gists_url":"https://api.github.com/users/linnovate/gists{/gist_id}","starred_url":"https://api.github.com/users/linnovate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linnovate/subscriptions","organizations_url":"https://api.github.com/users/linnovate/orgs","repos_url":"https://api.github.com/users/linnovate/repos","events_url":"https://api.github.com/users/linnovate/events{/privacy}","received_events_url":"https://api.github.com/users/linnovate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linnovate/mean","description":"MEAN (Mongo, Express, Angular, Node) - A Simple, Scalable and Easy starting point for full stack javascript web development - utilizing many of the best practices we've found on the way","fork":false,"url":"https://api.github.com/repos/linnovate/mean","forks_url":"https://api.github.com/repos/linnovate/mean/forks","keys_url":"https://api.github.com/repos/linnovate/mean/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linnovate/mean/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linnovate/mean/teams","hooks_url":"https://api.github.com/repos/linnovate/mean/hooks","issue_events_url":"https://api.github.com/repos/linnovate/mean/issues/events{/number}","events_url":"https://api.github.com/repos/linnovate/mean/events","assignees_url":"https://api.github.com/repos/linnovate/mean/assignees{/user}","branches_url":"https://api.github.com/repos/linnovate/mean/branches{/branch}","tags_url":"https://api.github.com/repos/linnovate/mean/tags","blobs_url":"https://api.github.com/repos/linnovate/mean/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linnovate/mean/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linnovate/mean/git/refs{/sha}","trees_url":"https://api.github.com/repos/linnovate/mean/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linnovate/mean/statuses/{sha}","languages_url":"https://api.github.com/repos/linnovate/mean/languages","stargazers_url":"https://api.github.com/repos/linnovate/mean/stargazers","contributors_url":"https://api.github.com/repos/linnovate/mean/contributors","subscribers_url":"https://api.github.com/repos/linnovate/mean/subscribers","subscription_url":"https://api.github.com/repos/linnovate/mean/subscription","commits_url":"https://api.github.com/repos/linnovate/mean/commits{/sha}","git_commits_url":"https://api.github.com/repos/linnovate/mean/git/commits{/sha}","comments_url":"https://api.github.com/repos/linnovate/mean/comments{/number}","issue_comment_url":"https://api.github.com/repos/linnovate/mean/issues/comments{/number}","contents_url":"https://api.github.com/repos/linnovate/mean/contents/{+path}","compare_url":"https://api.github.com/repos/linnovate/mean/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linnovate/mean/merges","archive_url":"https://api.github.com/repos/linnovate/mean/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linnovate/mean/downloads","issues_url":"https://api.github.com/repos/linnovate/mean/issues{/number}","pulls_url":"https://api.github.com/repos/linnovate/mean/pulls{/number}","milestones_url":"https://api.github.com/repos/linnovate/mean/milestones{/number}","notifications_url":"https://api.github.com/repos/linnovate/mean/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linnovate/mean/labels{/name}","releases_url":"https://api.github.com/repos/linnovate/mean/releases{/id}","created_at":"2013-05-22T12:15:47Z","updated_at":"2015-12-05T12:04:47Z","pushed_at":"2015-12-05T22:36:41Z","git_url":"git://github.com/linnovate/mean.git","ssh_url":"git@github.com:linnovate/mean.git","clone_url":"https://github.com/linnovate/mean.git","svn_url":"https://github.com/linnovate/mean","homepage":"http://mean.io","size":10189,"stargazers_count":7908,"watchers_count":7908,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2411,"mirror_url":null,"open_issues_count":113,"forks":2411,"open_issues":113,"watchers":7908,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linnovate/mean/pulls/1418"},"html":{"href":"https://github.com/linnovate/mean/pull/1418"},"issue":{"href":"https://api.github.com/repos/linnovate/mean/issues/1418"},"comments":{"href":"https://api.github.com/repos/linnovate/mean/issues/1418/comments"},"review_comments":{"href":"https://api.github.com/repos/linnovate/mean/pulls/1418/comments"},"review_comment":{"href":"https://api.github.com/repos/linnovate/mean/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linnovate/mean/pulls/1418/commits"},"statuses":{"href":"https://api.github.com/repos/linnovate/mean/statuses/f52399a94f63c7c95d6ee052b231f618c66cc37c"}}}}