Skip to content

Commit

Permalink
Merge pull request #178 from JeringTech/replace_aspnetcore_dependency
Browse files Browse the repository at this point in the history
Replaced AspNetCore dependency.
  • Loading branch information
JeremyTCD authored Sep 16, 2023
2 parents 59b108a + af7e54f commit 5999180
Show file tree
Hide file tree
Showing 10 changed files with 430 additions and 1,087 deletions.
11 changes: 7 additions & 4 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Changelog
This project uses [semantic versioning](http://semver.org/spec/v2.0.0.html). Refer to
*[Semantic Versioning in Practice](https://www.jering.tech/articles/semantic-versioning-in-practice)*
for an overview of semantic versioning.
This project uses semantic versioning.

## [Unreleased](https://github.com/JeringTech/Javascript.NodeJS/compare/7.0.0-beta.5...HEAD)
## [Unreleased](https://github.com/JeringTech/Javascript.NodeJS/compare/7.0.0...HEAD)

## [7.0.0](https://github.com/JeringTech/Javascript.NodeJS/compare/7.0.0-beta.5...7.0.0) - Sep 16, 2023
### Changes
- **Breaking Changes**:
- Replaced the deprecated package `Microsoft.AspNetCore.Hosting.Abstractions` with `Microsoft.Extensions.Hosting.Abstractions`. ([#173](https://github.com/JeringTech/Javascript.NodeJS/pull/178)).

## [7.0.0-beta.5](https://github.com/JeringTech/Javascript.NodeJS/compare/7.0.0-beta.4...7.0.0-beta.5) - Jul 28, 2023
### Changes
Expand Down
4 changes: 2 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ public string ProjectPath { get; set; }
```
###### Remarks
If this value is `null`, whitespace or an empty string and the application is an ASP.NET Core application,
project path is `IHostingEnvironment.ContentRootPath`.
project path is `IHostEnvironment.ContentRootPath`.
##### NodeJSProcessOptions.ExecutablePath
The value used to locate the NodeJS executable.
```csharp
Expand Down Expand Up @@ -1295,7 +1295,7 @@ public IDictionary<string, string> EnvironmentVariables { get; set; }
You can configure NodeJS by specifying environment variables for it. Find the full list of environment variables [here](https://nodejs.org/api/cli.html#cli_environment_variables).

If this value doesn't contain an element with key "NODE_ENV" and the application is an ASP.NET Core application,
an element with key "NODE_ENV" is added. The added element's value is "development" if `IHostingEnvironment.EnvironmentName` is `EnvironmentName.Development`,
an element with key "NODE_ENV" is added. The added element's value is "development" if `IHostEnvironment.EnvironmentName` is `Environments.Development`,
and "production" otherwise.
<!-- NodeJSProcessOptions generated docs -->
<!-- OutOfProcessNodeJSServiceOptions generated docs -->
Expand Down
72 changes: 16 additions & 56 deletions perf/NodeJS/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,42 +56,6 @@
"resolved": "1.4.0",
"contentHash": "ewkwHAqWpbsFp/rS9CDgr/5zEyNl47Vo2GBoJJcEMR5lNkjaCAMM/mMrVawJsSIEZtrL1AYm+YOm8OAKmhrDoA=="
},
"Microsoft.AspNetCore.Hosting.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "ubycklv+ZY7Kutdwuy1W4upWcZ6VFR8WUXU7l7B2+mvbDBBPAcfpi+E+Y5GFe+Q157YfA3C49D2GCjAZc7Mobw==",
"dependencies": {
"Microsoft.AspNetCore.Hosting.Server.Abstractions": "2.2.0",
"Microsoft.AspNetCore.Http.Abstractions": "2.2.0",
"Microsoft.Extensions.Hosting.Abstractions": "2.2.0"
}
},
"Microsoft.AspNetCore.Hosting.Server.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "1PMijw8RMtuQF60SsD/JlKtVfvh4NORAhF4wjysdABhlhTrYmtgssqyncR0Stq5vqtjplZcj6kbT4LRTglt9IQ==",
"dependencies": {
"Microsoft.AspNetCore.Http.Features": "2.2.0",
"Microsoft.Extensions.Configuration.Abstractions": "2.2.0"
}
},
"Microsoft.AspNetCore.Http.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "Nxs7Z1q3f1STfLYKJSVXCs1iBl+Ya6E8o4Oy1bCxJ/rNI44E/0f6tbsrVqAWfB7jlnJfyaAtIalBVxPKUPQb4Q==",
"dependencies": {
"Microsoft.AspNetCore.Http.Features": "2.2.0",
"System.Text.Encodings.Web": "4.5.0"
}
},
"Microsoft.AspNetCore.Http.Features": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "ziFz5zH8f33En4dX81LW84I6XrYXKf9jg6aM39cM+LffN9KJahViKZ61dGMSO2gd3e+qe5yBRwsesvyqlZaSMg==",
"dependencies": {
"Microsoft.Extensions.Primitives": "2.2.0"
}
},
"Microsoft.CodeAnalysis.Analyzers": {
"type": "Transitive",
"resolved": "2.6.1",
Expand Down Expand Up @@ -192,10 +156,10 @@
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "3.1.15",
"contentHash": "EEgcdG1SxIqIlMVLva8dLaBTwwzrjOYjQwXxFuULGKRQcglYLf5XTxPZ9RyTZBYxVsYVYolj2AAi8nnx/HD1tg==",
"resolved": "7.0.0",
"contentHash": "f34u2eaqIjNO9YLHBz8rozVZ+TcFiFs0F3r7nUJd7FRkVSxk8u4OpoK226mi49MwexHOR2ibP9MFvRUaLilcQQ==",
"dependencies": {
"Microsoft.Extensions.Primitives": "3.1.15"
"Microsoft.Extensions.Primitives": "7.0.0"
}
},
"Microsoft.Extensions.Configuration.Binder": {
Expand All @@ -217,26 +181,25 @@
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg=="
"resolved": "7.0.0",
"contentHash": "h3j/QfmFN4S0w4C2A6X7arXij/M/OVw3uQHSOFxnND4DyAzO1F9eMX7Eti7lU/OkSthEE0WzRsfT/Dmx86jzCw=="
},
"Microsoft.Extensions.FileProviders.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "EcnaSsPTqx2MGnHrmWOD0ugbuuqVT8iICqSqPzi45V5/MA1LjUNb0kwgcxBGqizV1R+WeBK7/Gw25Jzkyk9bIw==",
"resolved": "7.0.0",
"contentHash": "NyawiW9ZT/liQb34k9YqBSNPLuuPkrjMgQZ24Y/xXX1RoiBkLUdPMaQTmxhZ5TYu8ZKZ9qayzil75JX95vGQUg==",
"dependencies": {
"Microsoft.Extensions.Primitives": "2.2.0"
"Microsoft.Extensions.Primitives": "7.0.0"
}
},
"Microsoft.Extensions.Hosting.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "+k4AEn68HOJat5gj1TWa6X28WlirNQO9sPIIeQbia+91n03esEtMSSoekSTpMjUzjqtJWQN3McVx0GvSPFHF/Q==",
"resolved": "7.0.0",
"contentHash": "43n9Je09z0p/7ViPxfRqs5BUItRLNVh5b6JH40F2Agkh2NBsY/jpNYTtbCcxrHCsA3oRmbR6RJBzUutB4VZvNQ==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "2.2.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.FileProviders.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging.Abstractions": "2.2.0"
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0",
"Microsoft.Extensions.FileProviders.Abstractions": "7.0.0"
}
},
"Microsoft.Extensions.Http": {
Expand Down Expand Up @@ -308,8 +271,8 @@
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==",
"resolved": "7.0.0",
"contentHash": "um1KU5kxcRp3CNuI8o/GrZtD4AIOXDk+RLsytjZ9QPok3ttLUelLKpilVPuaFT3TFjOhSibUAso0odbOaCDj3Q==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
Expand Down Expand Up @@ -1284,11 +1247,8 @@
"jering.javascript.nodejs": {
"type": "Project",
"dependencies": {
"Microsoft.AspNetCore.Hosting.Abstractions": "[2.2.0, )",
"Microsoft.Extensions.DependencyInjection": "[6.0.0, )",
"Microsoft.Extensions.Hosting.Abstractions": "[7.0.0, )",
"Microsoft.Extensions.Http": "[6.0.0, )",
"Microsoft.Extensions.Logging": "[6.0.0, )",
"Microsoft.Extensions.Options": "[6.0.0, )",
"System.Text.Encodings.Web": "[6.0.0, )",
"System.Text.Json": "[6.0.5, )"
}
Expand Down
5 changes: 1 addition & 4 deletions src/NodeJS/Jering.Javascript.NodeJS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -60,10 +61,6 @@
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="6.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;

namespace Jering.Javascript.NodeJS
{
Expand Down Expand Up @@ -59,20 +59,20 @@ public void Configure(NodeJSProcessOptions options)
using IServiceScope scope = _serviceScopeFactory.CreateScope();
IServiceProvider serviceProvider = scope.ServiceProvider;

IHostingEnvironment? hostingEnvironment = serviceProvider.GetService<IHostingEnvironment>();
if (hostingEnvironment == null)
IHostEnvironment? hostEnvironment = serviceProvider.GetService<IHostEnvironment>();
if (hostEnvironment == null)
{
return;
}

if (!projectPathSpecified)
{
options.ProjectPath = hostingEnvironment.ContentRootPath;
options.ProjectPath = hostEnvironment.ContentRootPath;
}

if (!nodeEnvSpecified)
{
options.EnvironmentVariables["NODE_ENV"] = hostingEnvironment.IsDevelopment() ? "development" : "production"; // De-facto standard values for Node
options.EnvironmentVariables["NODE_ENV"] = hostEnvironment.IsDevelopment() ? "development" : "production"; // De-facto standard values for Node
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using System.Collections.Generic;
using System.IO;

Expand All @@ -12,7 +12,7 @@ public class NodeJSProcessOptions
/// <summary>The base path for resolving NodeJS module paths.</summary>
/// <remarks>
/// <para>If this value is <c>null</c>, whitespace or an empty string and the application is an ASP.NET Core application,
/// project path is <see cref="IHostingEnvironment.ContentRootPath"/>.</para>
/// project path is <see cref="IHostEnvironment.ContentRootPath"/>.</para>
/// </remarks>
public string ProjectPath { get; set; } = Directory.GetCurrentDirectory();

Expand Down Expand Up @@ -43,7 +43,7 @@ public class NodeJSProcessOptions
/// <remarks>
/// <para>You can configure NodeJS by specifying environment variables for it. Find the full list of environment variables <a href="https://nodejs.org/api/cli.html#cli_environment_variables">here</a>.</para>
/// <para>If this value doesn't contain an element with key "NODE_ENV" and the application is an ASP.NET Core application,
/// an element with key "NODE_ENV" is added. The added element's value is "development" if <see cref="IHostingEnvironment.EnvironmentName"/> is <see cref="EnvironmentName.Development"/>,
/// an element with key "NODE_ENV" is added. The added element's value is "development" if <see cref="IHostEnvironment.EnvironmentName"/> is <see cref="Environments.Development"/>,
/// and "production" otherwise.</para>
/// </remarks>
public IDictionary<string, string> EnvironmentVariables { get; set; } = new Dictionary<string, string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ internal virtual (bool trackInvokeTasks, ConcurrentDictionary<Task, object?> tra
finally
{
// Remove completed task, note that it might already have been removed in MoveToNewProcessAsync
trackedInvokeTasks.TryRemove(trackedInvokeTask, out object _);
trackedInvokeTasks.TryRemove(trackedInvokeTask, out object? _);
}
}

Expand Down
Loading

0 comments on commit 5999180

Please sign in to comment.