Skip to content

Commit

Permalink
Merge branch 'release/4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Feb 10, 2024
2 parents 7ac5b5e + 3abcdb4 commit 866f259
Show file tree
Hide file tree
Showing 35 changed files with 141 additions and 114 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ install:
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 5.0.408 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.411 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 7.0.305 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 8.0.100 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
- ps: dotnet --info

Expand Down
7 changes: 7 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>cake-contrib/renovate-presets:cake-recipe",
":semanticCommitsDisabled"
]
}
5 changes: 4 additions & 1 deletion nuspec/nuget/Cake.Npm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<repository type="git" url="https://github.com/cake-contrib/Cake.Npm.git"/>
<tags>cake npm cake-addin cake-build cake-contrib</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Npm/releases/tag/3.0.0</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Npm/releases/tag/4.0.0</releaseNotes>
</metadata>
<files>
<file src="..\..\..\..\nuspec\nuget\icon.png" target="" />
Expand All @@ -24,5 +24,8 @@
<file src="net7.0\Cake.Npm.dll" target="lib\net7.0" />
<file src="net7.0\Cake.Npm.pdb" target="lib\net7.0" />
<file src="net7.0\Cake.Npm.xml" target="lib\net7.0" />
<file src="net8.0\Cake.Npm.dll" target="lib\net8.0" />
<file src="net8.0\Cake.Npm.pdb" target="lib\net8.0" />
<file src="net8.0\Cake.Npm.xml" target="lib\net8.0" />
</files>
</package>
2 changes: 1 addition & 1 deletion recipe.cake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#load nuget:?package=Cake.Recipe&version=3.0.1
#load nuget:?package=Cake.Recipe&version=3.1.1

//*************************************************************************************************
// Settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void Should_Throw_If_Settings_Are_Null()
{
// Given
NpmAddUserSettings settings = null;
Uri registry = new Uri("https://myregistry.com");
Uri registry = new("https://myregistry.com");

// When
var result = Record.Exception(() => settings.ForRegistry(registry));
Expand Down Expand Up @@ -42,7 +42,7 @@ public void Should_Set_Registry()
{
// Given
var settings = new NpmAddUserSettings();
Uri registry = new Uri("https://myregistry.com");
Uri registry = new("https://myregistry.com");

// When
var result = settings.ForRegistry(registry);
Expand Down
6 changes: 4 additions & 2 deletions src/Cake.Npm.Tests/AddUser/NpmAddUserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public void Should_Redirect_Standard_Error()
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new NpmAddUserFixture();
fixture.Settings = null;
var fixture = new NpmAddUserFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down
30 changes: 29 additions & 1 deletion src/Cake.Npm.Tests/BumpVersion/NpmBumpVersionToolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class NpmBumpVersionToolTests
{
public sealed class TheBumpVersionMethod
{
private NpmBumpVersionToolFixture fixture;
private readonly NpmBumpVersionToolFixture fixture;

public TheBumpVersionMethod()
{
Expand Down Expand Up @@ -164,6 +164,34 @@ public void Should_Add_GitTagVersion_False_Switch()
Assert.Equal("version 11.22.33 --git-tag-version=false", result.Args);
}

[Fact]
public void Should_Add_AllowSameVersion_True_Switch()
{
// Given
fixture.Settings.WithVersion("11.22.33");
fixture.Settings.AllowSameVersion = true;

// When
var result = fixture.Run();

// Then
Assert.Equal("version 11.22.33 --allow-same-version=true", result.Args);
}

[Fact]
public void Should_Add_AllowSameVersion_False_Switch()
{
// Given
fixture.Settings.WithVersion("11.22.33");
fixture.Settings.AllowSameVersion = false;

// When
var result = fixture.Run();

// Then
Assert.Equal("version 11.22.33 --allow-same-version=false", result.Args);
}

class ExtensionNullCheckData : IEnumerable<object[]>
{
public IEnumerator<object[]> GetEnumerator()
Expand Down
14 changes: 7 additions & 7 deletions src/Cake.Npm.Tests/Cake.Npm.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
Expand All @@ -10,12 +10,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="3.0.0" />
<PackageReference Include="Cake.Testing" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="Shouldly" Version="3.0.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Cake.Core" Version="4.0.0" />
<PackageReference Include="Cake.Testing" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/Cake.Npm.Tests/Ci/NpmCiToolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public void Should_Redirect_Standard_Error()
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new NpmCiToolFixture();
fixture.Settings = null;
var fixture = new NpmCiToolFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ public void Should_Throw_If_Settings_Are_Null()
{
// Given
NpmInstallSettings settings = null;
Uri registry = new Uri("https://myregistry.com");
Uri registry = new("https://myregistry.com");

// When
var result = Record.Exception(() => settings.FromRegistry(registry));
Expand Down Expand Up @@ -821,7 +821,7 @@ public void Should_Set_Registry()
{
// Given
var settings = new NpmInstallSettings();
Uri registry = new Uri("https://myregistry.com");
Uri registry = new("https://myregistry.com");

// When
var result = settings.FromRegistry(registry);
Expand Down
6 changes: 4 additions & 2 deletions src/Cake.Npm.Tests/Install/NpmInstallerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public void Should_Redirect_Standard_Error()
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new NpmInstallerFixture();
fixture.Settings = null;
var fixture = new NpmInstallerFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down
4 changes: 2 additions & 2 deletions src/Cake.Npm.Tests/NpmSettingsExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void Should_Set_StandardOutputAction()
{
// Given
var settings = new NpmInstallSettings();
Action<string> action = x => { };
static void action(string x) { }

// When
settings.SetRedirectedStandardOutputHandler(action);
Expand All @@ -105,7 +105,7 @@ public void Should_Set_StandardErrorAction()
{
// Given
var settings = new NpmInstallSettings();
Action<string> action = x => { };
static void action(string x) { }

// When
settings.SetRedirectedStandardErrorHandler(action);
Expand Down
6 changes: 4 additions & 2 deletions src/Cake.Npm.Tests/Pack/NpmPackerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ public void Should_Redirect_Standard_Error()
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new NpmPackerFixture();
fixture.Settings = null;
var fixture = new NpmPackerFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down
6 changes: 4 additions & 2 deletions src/Cake.Npm.Tests/Prune/NpmPruneRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ public sealed class ThePruneMethod
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new NpmPruneFixture();
fixture.Settings = null;
var fixture = new NpmPruneFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down
20 changes: 10 additions & 10 deletions src/Cake.Npm.Tests/Prune/NpmPruneSettingsExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Should_Throw_If_Settings_Are_Null()
public void Should_Set_Production_Flag_True_()
{
// Given
NpmPruneSettings settings = new NpmPruneSettings();
NpmPruneSettings settings = new();

// When
settings.ForProduction();
Expand All @@ -38,7 +38,7 @@ public void Should_Set_Production_Flag_True_()
public void Should_Set_Production_Flag_False()
{
// Given
NpmPruneSettings settings = new NpmPruneSettings() { Production = true };
NpmPruneSettings settings = new() { Production = true };

// When
settings.ForProduction(false);
Expand Down Expand Up @@ -69,7 +69,7 @@ public void Should_Throw_If_Settings_Are_Null()
public void Should_Throw_If_PackageName_Is_Null_Or_Whitespace(string packageName)
{
// Given
NpmPruneSettings settings = new NpmPruneSettings();
NpmPruneSettings settings = new();

// When
var result = Record.Exception(() => settings.AddPackage(packageName));
Expand All @@ -82,7 +82,7 @@ public void Should_Throw_If_PackageName_Is_Null_Or_Whitespace(string packageName
public void Should_Throw_If_Scope_Does_Not_Start_With_At_Symbol()
{
// Given
NpmPruneSettings settings = new NpmPruneSettings();
NpmPruneSettings settings = new();

// When
var result = Record.Exception(() => settings.AddPackage("test", "badscope"));
Expand All @@ -95,7 +95,7 @@ public void Should_Throw_If_Scope_Does_Not_Start_With_At_Symbol()
public void Should_Add_PackageName_To_Packages()
{
// Given
NpmPruneSettings settings = new NpmPruneSettings();
NpmPruneSettings settings = new();

// When
settings.AddPackage("test");
Expand All @@ -108,7 +108,7 @@ public void Should_Add_PackageName_To_Packages()
public void Should_Add_PackageName_And_Scope_To_Packages()
{
// Given
NpmPruneSettings settings = new NpmPruneSettings();
NpmPruneSettings settings = new();

// When
settings.AddPackage("test", "@scope");
Expand Down Expand Up @@ -136,7 +136,7 @@ public void Should_Throw_If_Settings_Are_Null()
public void Should_Set_DryRun_Flag_True_()
{
// Given
NpmPruneSettings settings = new NpmPruneSettings();
NpmPruneSettings settings = new();

// When
settings.DryRun();
Expand All @@ -149,7 +149,7 @@ public void Should_Set_DryRun_Flag_True_()
public void Should_Set_DryRun_Flag_False()
{
// Given
NpmPruneSettings settings = new NpmPruneSettings() { DryRun = true };
NpmPruneSettings settings = new() { DryRun = true };

// When
settings.DryRun(false);
Expand Down Expand Up @@ -177,7 +177,7 @@ public void Should_Throw_If_Settings_Are_Null()
public void Should_Set_Json_Flag_True_()
{
// Given
NpmPruneSettings settings = new NpmPruneSettings();
NpmPruneSettings settings = new();

// When
settings.Json();
Expand All @@ -190,7 +190,7 @@ public void Should_Set_Json_Flag_True_()
public void Should_Set_Json_Flag_False()
{
// Given
NpmPruneSettings settings = new NpmPruneSettings() { Json = true };
NpmPruneSettings settings = new() { Json = true };

// When
settings.Json(false);
Expand Down
6 changes: 4 additions & 2 deletions src/Cake.Npm.Tests/RunScript/NpmScriptRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public void Should_Redirect_Standard_Error()
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new NpmRunScriptFixture();
fixture.Settings = null;
var fixture = new NpmRunScriptFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down
6 changes: 4 additions & 2 deletions src/Cake.Npm.Tests/Set/NpmSetToolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public void Should_Redirect_Standard_Error()
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new NpmSetToolFixture();
fixture.Settings = null;
var fixture = new NpmSetToolFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down
6 changes: 4 additions & 2 deletions src/Cake.Npm.Tests/Update/NpmUpdateToolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ public void Should_Redirect_Standard_Error()
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new NpmUpdateToolFixture();
fixture.Settings = null;
var fixture = new NpmUpdateToolFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down
10 changes: 6 additions & 4 deletions src/Cake.Npm.Tests/Version/NpmVersionToolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ public sealed class TheVersionMethod
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new NpmVersionToolFixture();
fixture.Settings = null;
var fixture = new NpmVersionToolFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down Expand Up @@ -71,7 +73,7 @@ public void Should_Determine_Version_From_StandardOutput()
fixture.ProcessRunner.Process.SetStandardOutput(versionInfo);

// When
var result = fixture.Run();
_ = fixture.Run();

// Then
fixture.Version.ShouldBe("5.8.0");
Expand All @@ -92,7 +94,7 @@ public void Should_Determine_Version_From_StandardOutput_Scenarios(string standa
fixture.ProcessRunner.Process.SetStandardOutput(output);

// When
var result = fixture.Run();
_ = fixture.Run();

// Then
fixture.Version.ShouldBe(expectedVersion);
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Npm.Tests/ViewVersion/NpmViewVersionToolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class NpmViewVersionToolTests
{
public sealed class TheViewVersionMethod
{
private NpmViewVersionToolFixture fixture;
private readonly NpmViewVersionToolFixture fixture;

public TheViewVersionMethod()
{
Expand Down
Loading

0 comments on commit 866f259

Please sign in to comment.