From 728b18431dbe731d4cfbbde4c98c1c35d097a667 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Sun, 11 Jun 2017 19:28:51 +0100 Subject: [PATCH 1/4] In dotnet new templates, only show "npm install" instruction when executing in CLI --- templates/package-builder/src/build/build.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/package-builder/src/build/build.ts b/templates/package-builder/src/build/build.ts index d5d246e..cb549b5 100644 --- a/templates/package-builder/src/build/build.ts +++ b/templates/package-builder/src/build/build.ts @@ -203,6 +203,10 @@ function buildDotNetNewNuGetPackage(packageId: string) { replaces: 'netcoreapp2.0', defaultValue: 'netcoreapp2.0' }, + HostIdentifier: { + type: 'bind', + binding: 'HostIdentifier' + }, skipRestore: { type: 'parameter', datatype: 'bool', @@ -236,6 +240,7 @@ function buildDotNetNewNuGetPackage(packageId: string) { // For the preview2 release, just display manual instructions instead. // This is only applicable on the command line, because VS will restore // NPM packages automatically by default. + condition: '(HostIdentifier == "dotnetcli" || HostIdentifier == "dotnetcli-preview")', actionId: 'AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C', description: '\n\n-------------------------------------------------------------------\nIMPORTANT: Before running this project on the command line,\n you must restore NPM packages by running "npm install"\n-------------------------------------------------------------------\n', manualInstructions: [{ text: 'Run "npm install"' }] From 8396be24c8779f5b29f77f2c5dbcc20a9418eb58 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Sun, 11 Jun 2017 19:39:46 +0100 Subject: [PATCH 2/4] Fix VS2017.3 warning about not specifying TypeScriptToolsVersion --- templates/AngularSpa/AngularSpa.csproj | 1 + templates/AureliaSpa/AureliaSpa.csproj | 1 + templates/KnockoutSpa/KnockoutSpa.csproj | 1 + templates/ReactReduxSpa/ReactReduxSpa.csproj | 1 + templates/ReactSpa/ReactSpa.csproj | 1 + templates/VueSpa/VueSpa.csproj | 1 + 6 files changed, 6 insertions(+) diff --git a/templates/AngularSpa/AngularSpa.csproj b/templates/AngularSpa/AngularSpa.csproj index 8eedd19..4d07626 100644 --- a/templates/AngularSpa/AngularSpa.csproj +++ b/templates/AngularSpa/AngularSpa.csproj @@ -4,6 +4,7 @@ netcoreapp2.0 TargetFrameworkOverride true + Latest $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; false diff --git a/templates/AureliaSpa/AureliaSpa.csproj b/templates/AureliaSpa/AureliaSpa.csproj index 5c07238..56fde8c 100644 --- a/templates/AureliaSpa/AureliaSpa.csproj +++ b/templates/AureliaSpa/AureliaSpa.csproj @@ -4,6 +4,7 @@ netcoreapp2.0 TargetFrameworkOverride true + Latest $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; false diff --git a/templates/KnockoutSpa/KnockoutSpa.csproj b/templates/KnockoutSpa/KnockoutSpa.csproj index 5c07238..56fde8c 100644 --- a/templates/KnockoutSpa/KnockoutSpa.csproj +++ b/templates/KnockoutSpa/KnockoutSpa.csproj @@ -4,6 +4,7 @@ netcoreapp2.0 TargetFrameworkOverride true + Latest $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; false diff --git a/templates/ReactReduxSpa/ReactReduxSpa.csproj b/templates/ReactReduxSpa/ReactReduxSpa.csproj index aa05850..3706db8 100644 --- a/templates/ReactReduxSpa/ReactReduxSpa.csproj +++ b/templates/ReactReduxSpa/ReactReduxSpa.csproj @@ -4,6 +4,7 @@ netcoreapp2.0 TargetFrameworkOverride true + Latest $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; false diff --git a/templates/ReactSpa/ReactSpa.csproj b/templates/ReactSpa/ReactSpa.csproj index 5c07238..56fde8c 100644 --- a/templates/ReactSpa/ReactSpa.csproj +++ b/templates/ReactSpa/ReactSpa.csproj @@ -4,6 +4,7 @@ netcoreapp2.0 TargetFrameworkOverride true + Latest $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; false diff --git a/templates/VueSpa/VueSpa.csproj b/templates/VueSpa/VueSpa.csproj index 5c07238..56fde8c 100644 --- a/templates/VueSpa/VueSpa.csproj +++ b/templates/VueSpa/VueSpa.csproj @@ -4,6 +4,7 @@ netcoreapp2.0 TargetFrameworkOverride true + Latest $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; false From 5e7bb0f5c5a12cce07f6d37384f05983d4d16ef8 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Sun, 11 Jun 2017 19:57:26 +0100 Subject: [PATCH 3/4] Don't log OperationCanceledException every time an HMR client disconnects --- .../Webpack/ConditionalProxyMiddleware.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.SpaServices/Webpack/ConditionalProxyMiddleware.cs b/src/Microsoft.AspNetCore.SpaServices/Webpack/ConditionalProxyMiddleware.cs index 118e264..ba0cf9f 100644 --- a/src/Microsoft.AspNetCore.SpaServices/Webpack/ConditionalProxyMiddleware.cs +++ b/src/Microsoft.AspNetCore.SpaServices/Webpack/ConditionalProxyMiddleware.cs @@ -98,7 +98,15 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack using (var responseStream = await responseMessage.Content.ReadAsStreamAsync()) { - await responseStream.CopyToAsync(context.Response.Body, DefaultHttpBufferSize, context.RequestAborted); + try + { + await responseStream.CopyToAsync(context.Response.Body, DefaultHttpBufferSize, context.RequestAborted); + } + catch (OperationCanceledException) + { + // The CopyToAsync task will be canceled if the client disconnects (e.g., user + // closes or refreshes the browser tab). Don't treat this as an error. + } } return true; From a3bcc0d8633f1b615ac82604107ef4b7f7f3b85c Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Sun, 11 Jun 2017 20:28:14 +0100 Subject: [PATCH 4/4] Update debugger detection to support Node v8.1+, and stop aborting if debugger messages are unrecognised. --- .../HostingModels/OutOfProcessNodeInstance.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Microsoft.AspNetCore.NodeServices/HostingModels/OutOfProcessNodeInstance.cs b/src/Microsoft.AspNetCore.NodeServices/HostingModels/OutOfProcessNodeInstance.cs index e353292..d02ccf9 100644 --- a/src/Microsoft.AspNetCore.NodeServices/HostingModels/OutOfProcessNodeInstance.cs +++ b/src/Microsoft.AspNetCore.NodeServices/HostingModels/OutOfProcessNodeInstance.cs @@ -381,12 +381,6 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels { OutputLogger.LogWarning(evt.Data); } - else if (!initializationIsCompleted) - { - _connectionIsReadySource.SetException( - new InvalidOperationException("The Node.js process failed to initialize: " + evt.Data)); - initializationIsCompleted = true; - } else { OnErrorDataReceived(UnencodeNewlines(evt.Data)); @@ -400,10 +394,11 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels private static bool IsDebuggerMessage(string message) { - return message.StartsWith("Debugger attached", StringComparison.OrdinalIgnoreCase) || - message.StartsWith("Debugger listening ", StringComparison.OrdinalIgnoreCase) || - message.StartsWith("To start debugging", StringComparison.OrdinalIgnoreCase) || - message.Equals("Warning: This is an experimental feature and could change at any time.", StringComparison.OrdinalIgnoreCase) || + return message.StartsWith("Debugger attached", StringComparison.Ordinal) || + message.StartsWith("Debugger listening ", StringComparison.Ordinal) || + message.StartsWith("To start debugging", StringComparison.Ordinal) || + message.Equals("Warning: This is an experimental feature and could change at any time.", StringComparison.Ordinal) || + message.Equals("For help see https://nodejs.org/en/docs/inspector", StringComparison.Ordinal) || message.Contains("chrome-devtools:"); }