From c0c2bc43f2c8afffa8e61332c3318617429def44 Mon Sep 17 00:00:00 2001
From: invinciblejai <mailjai.vardhan@gmail.com>
Date: Fri, 14 Sep 2018 20:04:55 +0530
Subject: [PATCH] fix(npm-comp-analyses): fixes comp-analyses for npm, makes
 call only for runtime dependencies and if version is resolved

---
 cico_release.sh  |  2 +-
 src/collector.ts |  2 +-
 src/server.ts    | 17 +++++++++++------
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/cico_release.sh b/cico_release.sh
index 677f3144..8e4a2214 100755
--- a/cico_release.sh
+++ b/cico_release.sh
@@ -25,7 +25,7 @@ function release() {
 
     create_merge_PR_vscode
 
-    create_PR_RHChe
+    # create_PR_RHChe
 }
 
 function publish_tar() {
diff --git a/src/collector.ts b/src/collector.ts
index 08cb54b1..596f473a 100644
--- a/src/collector.ts
+++ b/src/collector.ts
@@ -8,7 +8,7 @@ import * as Xml2Object from 'xml2object';
 import { Stream } from 'stream';
 
 /* By default the collector is going to process these dependency keys */
-const DefaultClasses = ["dependencies", "devDependencies", "optionalDependencies"];
+const DefaultClasses = ["dependencies"];
 
 /* String value with position */
 interface IPositionedString {
diff --git a/src/server.ts b/src/server.ts
index 58c0ff18..18b3dfd2 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -252,13 +252,18 @@ files.on(EventStream.Diagnostics, "^package\\.json$", (uri, name, contents) => {
             connection.sendDiagnostics({uri: uri, diagnostics: diagnostics});
         });
         for (let dependency of deps) {
-            get_metadata('npm', dependency.name.value, dependency.version.value, (response) => {
-                if (response != null) {
-                    let pipeline = new DiagnosticsPipeline(DiagnosticsEngines, dependency, config, diagnostics);
-                    pipeline.run(response);
-                }
+            var regexVersion = new RegExp(/^[0-9]*[.][0-9]*[.][0-9]*[^.]$/);
+            if(dependency.name.value && regexVersion.test(dependency.version.value)) {
+                get_metadata('npm', dependency.name.value, dependency.version.value, (response) => {
+                    if (response != null) {
+                        let pipeline = new DiagnosticsPipeline(DiagnosticsEngines, dependency, config, diagnostics);
+                        pipeline.run(response);
+                    }
+                    aggregator.aggregate(dependency);
+                });
+            } else {
                 aggregator.aggregate(dependency);
-            });
+            }
         }
     });
 });