From 61beff8fd1b69785c58bae0bb4885687b58085fe Mon Sep 17 00:00:00 2001 From: DamianEdwards Date: Mon, 5 May 2014 21:12:26 -0700 Subject: [PATCH] Added grunt to do JS & CSS validation: - Updated JS & CSS files according to errors reported - Updated sake script to find all npm/grunt folders and operate on those, rather than on root Build installs node/npm locally before running grunt Refactored makefile.shade a little --- .gitignore | 3 +- DiagnosticsPages.sln | 82 +- makefile.shade | 49 + src/Microsoft.AspNet.Diagnostics/.csslintrc | 7 + src/Microsoft.AspNet.Diagnostics/.jshintrc | 3 + .../Microsoft.AspNet.Diagnostics.kproj | 987 ++++++++++++++++++ .../Views/ErrorPage.cs | 4 +- .../Views/ErrorPage.css | 24 +- .../Views/ErrorPage.js | 4 +- src/Microsoft.AspNet.Diagnostics/gruntfile.js | 32 + src/Microsoft.AspNet.Diagnostics/package.json | 11 + 11 files changed, 1142 insertions(+), 64 deletions(-) create mode 100644 src/Microsoft.AspNet.Diagnostics/.csslintrc create mode 100644 src/Microsoft.AspNet.Diagnostics/.jshintrc create mode 100644 src/Microsoft.AspNet.Diagnostics/gruntfile.js create mode 100644 src/Microsoft.AspNet.Diagnostics/package.json diff --git a/.gitignore b/.gitignore index 08e21e25bf..2acc3e0dcb 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ nuget.exe *.ncrunchsolution *.*sdf *.ipch -*.sln.ide \ No newline at end of file +*.sln.ide +node_modules \ No newline at end of file diff --git a/DiagnosticsPages.sln b/DiagnosticsPages.sln index efade4376d..a4acc59b29 100644 --- a/DiagnosticsPages.sln +++ b/DiagnosticsPages.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.21628.1 +VisualStudioVersion = 14.0.21706.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{509A6F36-AD80-4A18-B5B1-717D38DFF29D}" EndProject @@ -25,46 +25,46 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|Any CPU.ActiveCfg = Debug|x86 - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|x86.ActiveCfg = Debug|x86 - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|x86.Build.0 = Debug|x86 - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|Any CPU.ActiveCfg = Release|x86 - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|Mixed Platforms.Build.0 = Release|x86 - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|x86.ActiveCfg = Release|x86 - {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|x86.Build.0 = Release|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|Any CPU.ActiveCfg = Debug|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|x86.ActiveCfg = Debug|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|x86.Build.0 = Debug|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|Any CPU.ActiveCfg = Release|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|Mixed Platforms.Build.0 = Release|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|x86.ActiveCfg = Release|x86 - {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|x86.Build.0 = Release|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|Any CPU.ActiveCfg = Debug|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|x86.ActiveCfg = Debug|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|x86.Build.0 = Debug|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|Any CPU.ActiveCfg = Release|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|Mixed Platforms.Build.0 = Release|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|x86.ActiveCfg = Release|x86 - {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|x86.Build.0 = Release|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|Any CPU.ActiveCfg = Debug|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|x86.ActiveCfg = Debug|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|x86.Build.0 = Debug|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Any CPU.ActiveCfg = Release|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.Build.0 = Release|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|x86.ActiveCfg = Release|x86 - {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|x86.Build.0 = Release|x86 + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Debug|x86.ActiveCfg = Debug|Any CPU + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|Any CPU.Build.0 = Release|Any CPU + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {C5F59CBA-DF2D-4983-8CBB-11B6AF21B416}.Release|x86.ActiveCfg = Release|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Debug|x86.ActiveCfg = Debug|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|Any CPU.Build.0 = Release|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE}.Release|x86.ActiveCfg = Release|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|Any CPU.Build.0 = Debug|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Debug|x86.ActiveCfg = Debug|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|Any CPU.ActiveCfg = Release|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|Any CPU.Build.0 = Release|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {589AC17F-9455-4764-8F82-FCD2AE58DA14}.Release|x86.ActiveCfg = Release|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Debug|x86.ActiveCfg = Debug|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Any CPU.Build.0 = Release|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/makefile.shade b/makefile.shade index 6357ea2841..50e343e22c 100644 --- a/makefile.shade +++ b/makefile.shade @@ -1,3 +1,4 @@ +use namespace="System.Net" var VERSION='0.1' var FULL_VERSION='0.1' @@ -5,3 +6,51 @@ var AUTHORS='Microsoft' use-standard-lifecycle k-standard-goals + +#install-node + var binDir = '${Path.Combine(Directory.GetCurrentDirectory(), "bin")}' + var nodeDir = '${Path.Combine(binDir, "node")}' + + -// Check if node is already installed locally + var nodeVer = '0.10.28' + var nodeMsi = 'node-v${nodeVer}-x86.msi' + var nodeUrl = 'http://nodejs.org/dist/v${nodeVer}/${nodeMsi}' + var nodeMsiPath = '${Path.Combine(binDir, nodeMsi)}' + var nodeInstalled = '${Directory.Exists(nodeDir)}' + @{ + Directory.CreateDirectory(nodeDir); + if (!nodeInstalled) { + // Download node installer msi + var wc = new WebClient(); + wc.DownloadFile(nodeUrl, nodeMsiPath); + } + } + + -// Extract it to local dir using msiexec: + exec program='msiexec' commandline='/a ${nodeMsiPath} /qb TARGETDIR=${nodeDir}' if='!nodeInstalled' + +#restore-npm-modules .install-node + @{ + // Find all dirs that contain a package.json file that aren't installed node modules + var currentDir = Directory.GetCurrentDirectory(); + var npmCmd = Path.Combine(currentDir, "bin\\node\\nodejs\\npm.cmd"); + var npmDirs = Directory.GetFiles(currentDir, "package.json", SearchOption.AllDirectories) + .Where(p => p.IndexOf(Path.DirectorySeparatorChar + "node_modules" + Path.DirectorySeparatorChar) < 0) + .Select(p => Path.GetDirectoryName(p)) + .Distinct(); + } + + exec program='${npmCmd}' commandline='install' workingdir='${dir}' each='var dir in npmDirs' + +#run-grunt .restore-npm-modules target='compile' + @{ + // Find all dirs that contain a gruntfile.js file + var currentDir = Directory.GetCurrentDirectory(); + var nodeExe = Path.Combine(currentDir, "bin\\node\\nodejs\\node.exe"); + var gruntDirs = Directory.GetFiles(currentDir, "gruntfile.js", SearchOption.AllDirectories) + .Where(p => p.IndexOf(Path.DirectorySeparatorChar + "node_modules" + Path.DirectorySeparatorChar) < 0) + .Select(p => Path.GetDirectoryName(p)) + .Distinct(); + } + + exec program='${nodeExe}' commandline='node_modules\\grunt-cli\\bin\\grunt' workingdir='${dir}' each='var dir in gruntDirs' \ No newline at end of file diff --git a/src/Microsoft.AspNet.Diagnostics/.csslintrc b/src/Microsoft.AspNet.Diagnostics/.csslintrc new file mode 100644 index 0000000000..fda9775958 --- /dev/null +++ b/src/Microsoft.AspNet.Diagnostics/.csslintrc @@ -0,0 +1,7 @@ +{ + "unique-headings": false, + "ids": false, + "box-sizing": false, + "qualified-headings": false, + "display-property-grouping": false +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Diagnostics/.jshintrc b/src/Microsoft.AspNet.Diagnostics/.jshintrc new file mode 100644 index 0000000000..077404aaa4 --- /dev/null +++ b/src/Microsoft.AspNet.Diagnostics/.jshintrc @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Diagnostics/Microsoft.AspNet.Diagnostics.kproj b/src/Microsoft.AspNet.Diagnostics/Microsoft.AspNet.Diagnostics.kproj index 6749d006c1..e26cfea10f 100644 --- a/src/Microsoft.AspNet.Diagnostics/Microsoft.AspNet.Diagnostics.kproj +++ b/src/Microsoft.AspNet.Diagnostics/Microsoft.AspNet.Diagnostics.kproj @@ -17,6 +17,993 @@ 2.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs index cc429e1755..c657b10dbb 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs +++ b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs @@ -71,7 +71,7 @@ using Views #line hidden ); - WriteLiteral("\r\n