Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,25 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
os: [windows-latest, ubuntu-latest, macos-latest] # macos-latest runs on arm64e causing issues with .net 8 (https://github.com/actions/runner-images/issues/9766)
env:
# https://github.com/NuGet/Home/issues/11548
# https://twitter.com/xoofx/status/1488617114940452872?s=20&t=BKSN4j9rP6fOyg8l7aW0eg
NUGET_CERT_REVOCATION_MODE: offline
steps:
- name: Get Source
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install .NET Core SDK
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
6.0.x
9.0.x
- name: Build and Test
run: dotnet test --logger "trx;LogFileName=test-results.trx"
- name: Upload Test Results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results-${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ TestResult.xml
*.pfx
.idea
.ionide
cache/
cache/
39 changes: 23 additions & 16 deletions src/core/Statiq.App/Statiq.App.csproj
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Statiq is a configurable static content generation framework. This library provides everything you need to start using it to make your own static generator.</Description>
<PackageTags>Statiq Static StaticContent StaticSite</PackageTags>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904;CA1724;CA1062;CA1725;VSTHRD103;CA1711</WarningsNotAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904;CA1724;CA1062;CA1725;VSTHRD103;CA1711</WarningsNotAsErrors>
</PropertyGroup>

<ItemGroup>
<None Include="Statiq.App.targets" Pack="true" PackagePath="build\$(TargetFramework)\" />
<None Include="Statiq.App.targets" Pack="true" PackagePath="buildTransitive\$(TargetFramework)\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.18" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.14.0" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="3.1.0" />
<PackageReference Include="NetEscapades.Extensions.Logging.RollingFile" Version="2.2.0" />
<PackageReference Include="Spectre.Console" Version="0.45.0" />
<PackageReference Include="Spectre.Console.Cli" Version="0.45.0" />
<PackageReference Include="NetEscapades.Extensions.Logging.RollingFile" Version="2.5.0" />
<PackageReference Include="Spectre.Console" Version="0.50.0" />
<PackageReference Include="Spectre.Console.Cli" Version="0.50.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.5" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Statiq.Common\Statiq.Common.csproj" />
<ProjectReference Include="..\Statiq.Core\Statiq.Core.csproj" />
<ProjectReference Include="..\Statiq.Testing\Statiq.Testing.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15" />
<PackageReference Update="Roslynator.Analyzers" Version="4.13.1" />
</ItemGroup>
</Project>
26 changes: 19 additions & 7 deletions src/core/Statiq.Common/Statiq.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@
<PropertyGroup>
<Description>Statiq is a configurable static content generation framework. This library provides a common set of abstractions and other classes to make writing extensions easier.</Description>
<PackageTags>Statiq Static StaticContent StaticSite Blog BlogEngine</PackageTags>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904;CA1724;CA1062;CA1040;CA1711;CA1725;CA1021;CA1720;CS0672;CA1721;CA1710;SYSLIB0010;VSTHRD110</WarningsNotAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904;CA1724;CA1062;CA1040;CA1711;CA1725;CA1021;CA1720;CS0672;CA1721;CA1710;SYSLIB0010;VSTHRD110</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.16.1" />
<PackageReference Include="ConcurrentHashSet" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="3.1.6" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.18" />
<PackageReference Include="AngleSharp" Version="1.3.0" />
<PackageReference Include="ConcurrentHashSet" Version="1.3.0" />
<PackageReference Include="NetFabric.Hyperlinq" Version="3.0.0-beta48" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.5" />
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
Expand All @@ -21,4 +28,9 @@
<_Parameter1>Statiq.Testing</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15" />
<PackageReference Update="Roslynator.Analyzers" Version="4.13.1" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/core/Statiq.Core/Execution/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public Engine(
FileCleaner = Services.GetRequiredService<IFileCleaner>();

_diagnosticsTraceListener = new DiagnosticsTraceListener(Logger);
Trace.Listeners.Add(_diagnosticsTraceListener);
System.Diagnostics.Trace.Listeners.Add(_diagnosticsTraceListener);

// Add the service-based pipelines as late as possible so other services have been configured
AddServicePipelines();
Expand Down Expand Up @@ -1140,7 +1140,7 @@ public void Dispose()
}
}

Trace.Listeners.Remove(_diagnosticsTraceListener);
System.Diagnostics.Trace.Listeners.Remove(_diagnosticsTraceListener);
FileCleaner.CleanDirectory(FileSystem.GetTempDirectory(), "temp");
_serviceScope.Dispose();
_disposed = true;
Expand Down
8 changes: 4 additions & 4 deletions src/core/Statiq.Core/Execution/IEngineExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ public static void LogAndCheckVersion(this IEngine engine, Assembly assembly, st
// Get and print the version
string informationalVersion = versionAttribute.InformationalVersion;
engine.Logger.LogInformation($"{name} version {informationalVersion}", true);
SemVer.Version version = new SemVer.Version(informationalVersion, true);
SemanticVersioning.Version version = new SemanticVersioning.Version(informationalVersion, true);

// Get all version ranges
(string Key, SemVer.Version Version)[] minimumVersions = engine.Settings.Keys
(string Key, SemanticVersioning.Version Version)[] minimumVersions = engine.Settings.Keys
.Where(k => k.StartsWith(minimumVersionKey))
.Select(k => (Key: k, Value: engine.Settings.GetString(k)))
.Where(x => !x.Value.IsNullOrWhiteSpace())
.Select(x => (x.Key, new SemVer.Version(x.Value, true)))
.Select(x => (x.Key, new SemanticVersioning.Version(x.Value, true)))
.ToArray();
foreach ((string Key, SemVer.Version Version) minimumVersion in minimumVersions)
foreach ((string Key, SemanticVersioning.Version Version) minimumVersion in minimumVersions)
{
if (version < minimumVersion.Version)
{
Expand Down
12 changes: 6 additions & 6 deletions src/core/Statiq.Core/Execution/MemoryStreamFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public class MemoryStreamFactory : IMemoryStreamFactory
private const int BlockSize = 16384;

private readonly RecyclableMemoryStreamManager _manager =
new RecyclableMemoryStreamManager(
BlockSize,
RecyclableMemoryStreamManager.DefaultLargeBufferMultiple,
RecyclableMemoryStreamManager.DefaultMaximumBufferSize)
new RecyclableMemoryStreamManager(new RecyclableMemoryStreamManager.Options
{
MaximumFreeSmallPoolBytes = BlockSize * 32768L * 2, // 1 GB
};
BlockSize = BlockSize,
LargeBufferMultiple = RecyclableMemoryStreamManager.DefaultLargeBufferMultiple,
MaximumBufferSize = RecyclableMemoryStreamManager.DefaultMaximumBufferSize,
MaximumSmallPoolFreeBytes = BlockSize * 32768L * 2, // 1 GB
});

public virtual MemoryStream GetStream() => _manager.GetStream();

Expand Down
2 changes: 1 addition & 1 deletion src/core/Statiq.Core/Modules/Content/InsertLinks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public InsertLinks WithEndWordSeparators(params char[] endWordSeparators)
foreach (IElement element in htmlDocument.QuerySelectorAll(_querySelector).Where(t => !t.Ancestors<IHtmlAnchorElement>().Any()))
{
// Enumerate all descendant text nodes not already in a link element
foreach (IText text in element.Descendents().OfType<IText>().Where(t => !t.Ancestors<IHtmlAnchorElement>().Any()))
foreach (IText text in element.Descendants<IText>().Where(t => !t.Ancestors<IHtmlAnchorElement>().Any()))
{
if (ReplaceStrings(text, links, out string newText))
{
Expand Down
11 changes: 7 additions & 4 deletions src/core/Statiq.Core/Modules/IO/MirrorResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ public MirrorResources(Func<Uri, NormalizedPath> pathFunc)

protected override async Task<IEnumerable<Common.IDocument>> ExecuteContextAsync(IExecutionContext context)
{
#pragma warning disable RCS1163 // Unused parameter.
// Handle invalid HTTPS certificates and allow alternate security protocols (see http://stackoverflow.com/a/5670954/807064)
ServicePointManager.ServerCertificateValidationCallback = (s, cert, chain, ssl) => true;
#pragma warning restore RCS1163 // Unused parameter.
ArgumentNullException.ThrowIfNull(context, nameof(context));

#pragma warning disable RCS1163
/* Handle invalid HTTPS certificates and allow alternate security protocols (see http://stackoverflow.com/a/5670954/807064)
SYSLIB0014: ServicePointManager is obsolete , use HttpClient instead.
ServicePointManager.ServerCertificateValidationCallback = (s, cert, chain, ssl) => true; */
#pragma warning restore RCS1163

// Cache downloaded resources
Dictionary<string, string> mirrorCache = new Dictionary<string, string>();
Expand Down
1 change: 1 addition & 0 deletions src/core/Statiq.Core/Modules/IO/ReadWeb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public ReadWeb(string uri, WebRequestHeaders headers)
/// <returns>The current module instance.</returns>
public ReadWeb WithUris(params string[] uris)
{
ArgumentNullException.ThrowIfNull(uris, nameof(uris)); // fix CA1062
foreach (string uri in uris)
{
_requests.Add(new WebRequest(uri));
Expand Down
32 changes: 22 additions & 10 deletions src/core/Statiq.Core/Statiq.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@
<PropertyGroup>
<Description>Statiq is a configurable static content generation framework.</Description>
<PackageTags>Statiq Static StaticContent StaticSite Blog BlogEngine</PackageTags>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904;CA1724;CA1062;CA1725;CA1711;CA1505</WarningsNotAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904;CA1724;CA1062;CA1725;CA1711;CA1505</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.21.0" />
<PackageReference Include="JavaScriptEngineSwitcher.Jint" Version="3.21.2" />
<PackageReference Include="JSPool" Version="2.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.18" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="1.2.2" />
<PackageReference Include="Polly" Version="7.1.1" />
<PackageReference Include="SemanticVersioning" Version="1.2.2" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.0.1" />
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.24.1" />
<PackageReference Include="JavaScriptEngineSwitcher.Jint" Version="3.29.1" />
<PackageReference Include="JSPool" Version="4.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageReference Include="Polly" Version="8.5.2" />
<PackageReference Include="SemanticVersioning" Version="3.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.2" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.5" />
<PackageReference Include="System.Collections.Immutable" Version="9.0.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Statiq.Common\Statiq.Common.csproj" />
Expand All @@ -24,4 +31,9 @@
<_Parameter1>Statiq.Common.Tests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15" />
<PackageReference Update="Roslynator.Analyzers" Version="4.13.1" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
<PropertyGroup>
<Description>Statiq is a configurable static content generation framework. This library provides utility classes to make testing JavaScript components easier.</Description>
<PackageTags>Statiq Static StaticContent StaticSite Blog BlogEngine</PackageTags>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.21.0" />
<PackageReference Include="JavaScriptEngineSwitcher.Jint" Version="3.21.2" />
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.24.1" />
<PackageReference Include="JavaScriptEngineSwitcher.Jint" Version="3.29.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Statiq.Common\Statiq.Common.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15" />
<PackageReference Update="Roslynator.Analyzers" Version="4.13.1" />
</ItemGroup>
</Project>
Loading
Loading