From aaaabb831213e91d09eb08369cb783bf2007dbac Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 7 Jul 2016 16:55:09 -0700 Subject: [PATCH] Log Top Level Npm Packages in Diagnostics Window Bug To investigate perf issues with Typescript/Salsa, we would like to be able to collect a list of installed node modules from users. Fix Adds this information to the Diagnostic window. If a user is running into perf issues, we can requires that they provide the output of the Diagnostics window to us in order to help with out investigations Testing Tested with a few different project/solution types Here's an example for a solution with two express projects: ``` Use Ctrl-C to copy contents Projects: Project: ExpressApp17\ExpressApp17.njsproj Kind: Node.js StartupFile: C:\Users\matb.REDMOND\documents\visual studio 2015\Projects\ExpressApp17\ExpressApp17\bin\www WorkingDirectory: . PublishUrl: SearchPath: CommandLineArguments: Analysis Log: Analysis loading... Top Level Node Packages (9): body-parser 1.8.4 cookie-parser 1.3.5 debug 2.0.0 express 4.9.8 jade 1.6.0 mocha 2.5.3 morgan 1.3.2 serve-favicon 2.1.7 stylus 0.42.3 Project Info: .js (included in project): Number of Files: 4 Average Line Count: 22 Max Line Count: 61 .d.ts (included in project): Number of Files: 14 Average Line Count: 418 Max Line Count: 2557 .js (excluded from project): Number of Files: 641 Average Line Count: 194 Max Line Count: 15226 .html (excluded from project): Number of Files: 6 Average Line Count: 106 Max Line Count: 324 Project: ExpressApp1\ExpressApp1.njsproj Kind: Node.js StartupFile: C:\Users\matb.REDMOND\documents\visual studio 2015\Projects\ExpressApp17\ExpressApp1\bin\www WorkingDirectory: . PublishUrl: SearchPath: CommandLineArguments: Analysis Log: Analysis loading... Top Level Node Packages (8): body-parser 1.8.4 cookie-parser 1.3.5 debug 2.0.0 express 4.9.8 jade 1.6.0 morgan 1.3.2 serve-favicon 2.1.7 stylus 0.42.3 Project Info: .js (included in project): Number of Files: 3 Average Line Count: 26 Max Line Count: 61 .d.ts (included in project): Number of Files: 13 Average Line Count: 432 Max Line Count: 2557 .js (excluded from project): Number of Files: 430 Average Line Count: 179 Max Line Count: 15226 .html (excluded from project): Number of Files: 3 Average Line Count: 88 Max Line Count: 188 ``` --- Nodejs/Product/Nodejs/Commands/DiagnosticsCommand.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Nodejs/Product/Nodejs/Commands/DiagnosticsCommand.cs b/Nodejs/Product/Nodejs/Commands/DiagnosticsCommand.cs index f26d253a0..7a93fe4c7 100644 --- a/Nodejs/Product/Nodejs/Commands/DiagnosticsCommand.cs +++ b/Nodejs/Product/Nodejs/Commands/DiagnosticsCommand.cs @@ -224,9 +224,10 @@ private static string GetProjectNpmInfo(Project.NodejsProjectNode project) { } var res = new StringBuilder(); - res.AppendLine("Npm Info:"); - res.AppendLine(Indent(1, string.Format("Number of Top Level Modules: " + modules.Count()))); - + res.AppendLine(string.Format("Top Level Node Packages ({0}):", modules.Count())); + foreach (var module in modules) { + res.AppendLine(Indent(1, string.Format("{0} {1} ", module.Name, module.Version))); + } return res.ToString(); }