Skip to content

Commit

Permalink
Merge tag '5.0.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Dec 9, 2024
2 parents c78e881 + 80ff1e5 commit a62c347
Show file tree
Hide file tree
Showing 64 changed files with 422 additions and 917 deletions.
2 changes: 1 addition & 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/4.0.0</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Npm/releases/tag/5.0.0</releaseNotes>
</metadata>
<files>
<file src="..\..\..\..\nuspec\nuget\icon.png" target="" />
Expand Down
6 changes: 3 additions & 3 deletions src/Cake.Npm.Tests/AddUser/NpmAddUserFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cake.Npm.AddUser;

namespace Cake.Npm.Tests.AddUser
namespace Cake.Npm.Tests.AddUser
{
using Cake.Npm.AddUser;

internal class NpmAddUserFixture : NpmFixture<NpmAddUserSettings>
{
public NpmAddUserFixture()
Expand Down
10 changes: 5 additions & 5 deletions src/Cake.Npm.Tests/AddUser/NpmAddUserTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using Xunit;
using Cake.Npm.AddUser;

namespace Cake.Npm.Tests.AddUser
namespace Cake.Npm.Tests.AddUser
{
using System;
using Xunit;
using Cake.Npm.AddUser;

public class NpmAddUserTests
{
public sealed class TheAddUserMethod
Expand Down
6 changes: 3 additions & 3 deletions src/Cake.Npm.Tests/Ci/NpmCiToolFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cake.Npm.Ci;

namespace Cake.Npm.Tests.Ci
namespace Cake.Npm.Tests.Ci
{
using Cake.Npm.Ci;

internal sealed class NpmCiToolFixture : NpmFixture<NpmCiSettings>
{
public NpmCiToolFixture()
Expand Down
12 changes: 6 additions & 6 deletions src/Cake.Npm.Tests/Ci/NpmCiToolTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using Cake.Core.Diagnostics;
using Cake.Npm.Ci;
using Xunit;

namespace Cake.Npm.Tests.Ci
namespace Cake.Npm.Tests.Ci
{
using System;
using Cake.Core.Diagnostics;
using Cake.Npm.Ci;
using Xunit;

public class NpmCiToolTests
{
public sealed class TheAutomatedInstallMethod
Expand Down
6 changes: 3 additions & 3 deletions src/Cake.Npm.Tests/Install/NpmInstallerFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cake.Npm.Install;

namespace Cake.Npm.Tests.Install
namespace Cake.Npm.Tests.Install
{
using Cake.Npm.Install;

internal sealed class NpmInstallerFixture : NpmFixture<NpmInstallSettings>
{
public NpmInstallerFixture()
Expand Down
12 changes: 6 additions & 6 deletions src/Cake.Npm.Tests/Install/NpmInstallerTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using Cake.Core.Diagnostics;
using Xunit;
using Cake.Npm.Install;

namespace Cake.Npm.Tests.Install
namespace Cake.Npm.Tests.Install
{
using System;
using Cake.Core.Diagnostics;
using Xunit;
using Cake.Npm.Install;

public class NpmInstallerTests
{
public sealed class TheInstallMethod
Expand Down
6 changes: 3 additions & 3 deletions src/Cake.Npm.Tests/Set/NpmSetToolFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cake.Npm.Set;

namespace Cake.Npm.Tests.Set
namespace Cake.Npm.Tests.Set
{
using Cake.Npm.Set;

internal sealed class NpmSetToolFixture : NpmFixture<NpmSetSettings>
{
public NpmSetToolFixture()
Expand Down
10 changes: 5 additions & 5 deletions src/Cake.Npm.Tests/Set/NpmSetToolTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Cake.Npm.Set;
using Shouldly;
using Xunit;

namespace Cake.Npm.Tests.Set
namespace Cake.Npm.Tests.Set
{
using Cake.Npm.Set;
using Shouldly;
using Xunit;

public class NpmSetToolTests
{
public sealed class TheSetMethod
Expand Down
6 changes: 3 additions & 3 deletions src/Cake.Npm.Tests/Update/NpmUpdateToolFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cake.Npm.Update;

namespace Cake.Npm.Tests.Update
namespace Cake.Npm.Tests.Update
{
using Cake.Npm.Update;

internal sealed class NpmUpdateToolFixture : NpmFixture<NpmUpdateSettings>
{
public NpmUpdateToolFixture()
Expand Down
8 changes: 4 additions & 4 deletions src/Cake.Npm.Tests/Update/NpmUpdateToolTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Cake.Npm.Update;
using Xunit;

namespace Cake.Npm.Tests.Update
namespace Cake.Npm.Tests.Update
{
using Cake.Npm.Update;
using Xunit;

public class NpmUpdateToolTests
{
public sealed class TheUpdateMethod
Expand Down
8 changes: 4 additions & 4 deletions src/Cake.Npm.Tests/Version/NpmVersionToolFixture.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Text;
using Cake.Npm.Version;

namespace Cake.Npm.Tests.Version
namespace Cake.Npm.Tests.Version
{
using System.Text;
using Cake.Npm.Version;

internal sealed class NpmVersionToolFixture : NpmFixture<NpmVersionSettings>
{
public NpmVersionToolFixture()
Expand Down
16 changes: 8 additions & 8 deletions src/Cake.Npm.Tests/Version/NpmVersionToolTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Cake.Core;
using Shouldly;
using Xunit;

namespace Cake.Npm.Tests.Version
namespace Cake.Npm.Tests.Version
{
using Cake.Core;
using Shouldly;
using Xunit;

public class NpmVersionToolTests
{
public sealed class TheVersionMethod
Expand Down Expand Up @@ -40,8 +40,8 @@ public void Should_Add_Mandatory_Arguments()
[Fact]
public void Should_Determine_Version_From_StandardOutput()
{
string[] versionInfo = new[]
{
string[] versionInfo =
[
"{",
" npm: '5.8.0',",
" ares: '1.10.1-DEV',",
Expand All @@ -66,7 +66,7 @@ public void Should_Determine_Version_From_StandardOutput()
"│ Run npm i -g npm to update │",
"│ │",
"╰─────────────────────────────────────╯"
};
];

// Given
var fixture = new NpmVersionToolFixture();
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 @@ -100,7 +100,7 @@ public void Should_Return_Version_From_StandardOutput()
const string version = "1.1.0";

// Given
fixture.ProcessRunner.Process.SetStandardOutput(new[] { version });
fixture.ProcessRunner.Process.SetStandardOutput([version]);

// When
fixture.Run();
Expand Down
34 changes: 12 additions & 22 deletions src/Cake.Npm/AddUser/NpmAddUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,26 @@
/// <summary>
/// Tool for adding a user registry account.
/// </summary>
public class NpmAddUser : NpmTool<NpmAddUserSettings>
/// <param name="fileSystem">The file system.</param>
/// <param name="environment">The environment.</param>
/// <param name="processRunner">The process runner.</param>
/// <param name="tools">The tool locator.</param>
/// <param name="log">Cake log instance.</param>
public class NpmAddUser(
IFileSystem fileSystem,
ICakeEnvironment environment,
IProcessRunner processRunner,
IToolLocator tools,
ICakeLog log) : NpmTool<NpmAddUserSettings>(fileSystem, environment, processRunner, tools, log)
{
/// <summary>
/// Initializes a new instance of the <see cref="NpmAddUser"/> class.
/// </summary>
/// <param name="fileSystem">The file system.</param>
/// <param name="environment">The environment.</param>
/// <param name="processRunner">The process runner.</param>
/// <param name="tools">The tool locator.</param>
/// <param name="log">Cake log instance.</param>
public NpmAddUser(
IFileSystem fileSystem,
ICakeEnvironment environment,
IProcessRunner processRunner,
IToolLocator tools,
ICakeLog log)
: base(fileSystem, environment, processRunner, tools, log)
{
}

/// <summary>
/// Adds a user from the specified settings.
/// </summary>
/// <param name="settings">The settings.</param>
public void AddUser(NpmAddUserSettings settings)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}
ArgumentNullException.ThrowIfNull(settings);

RunCore(settings);
}
Expand Down
24 changes: 6 additions & 18 deletions src/Cake.Npm/AddUser/NpmAddUserSettingsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ public static class NpmAddUserSettingsExtensions
/// <returns>The <paramref name="settings"/> instance with <see cref="NpmAddUserSettings.Registry"/> set to <paramref name="registry" />.</returns>
public static NpmAddUserSettings ForRegistry(this NpmAddUserSettings settings, Uri registry)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}
ArgumentNullException.ThrowIfNull(settings);

settings.Registry = registry ?? throw new ArgumentNullException(nameof(registry));
return settings;
Expand All @@ -32,11 +29,8 @@ public static NpmAddUserSettings ForRegistry(this NpmAddUserSettings settings, U
/// <returns>The <paramref name="settings"/> instance with <paramref name="scope"/> added to <see cref="NpmAddUserSettings.Scope"/>.</returns>
public static NpmAddUserSettings ForScope(this NpmAddUserSettings settings, string scope)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}

ArgumentNullException.ThrowIfNull(settings);

if (string.IsNullOrWhiteSpace(scope))
{
throw new ArgumentNullException(nameof(scope));
Expand All @@ -57,10 +51,7 @@ public static NpmAddUserSettings ForScope(this NpmAddUserSettings settings, stri
/// <returns>The <see cref="NpmAddUserSettings"/> instance with AlwaysAuth set to true.</returns>
public static NpmAddUserSettings AlwaysAuthenticate(this NpmAddUserSettings settings)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}
ArgumentNullException.ThrowIfNull(settings);

settings.AlwaysAuth = true;
return settings;
Expand All @@ -74,11 +65,8 @@ public static NpmAddUserSettings AlwaysAuthenticate(this NpmAddUserSettings sett
/// <returns>The <see cref="NpmAddUserSettings"/> instance with <paramref name="authType"/> added to <see cref="NpmAddUserSettings.AuthType"/>.</returns>
public static NpmAddUserSettings UsingAuthentication(this NpmAddUserSettings settings, AuthType authType)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}

ArgumentNullException.ThrowIfNull(settings);

settings.AuthType = authType;
return settings;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Cake.Npm/AddinInformation.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Reflection;
using Cake.Core.Diagnostics;

namespace Cake.Npm
{
using System.Reflection;
using Cake.Core.Diagnostics;

/// <summary>
/// Helper to log addin version information
/// </summary>
Expand Down
15 changes: 3 additions & 12 deletions src/Cake.Npm/BumpVersion/NpmBumpVersionSettingsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ public static class NpmBumpVersionSettingsExtensions
/// <returns>The <paramref name="settings"/> instance with <see cref="NpmBumpVersionSettings.Force"/> set.</returns>
public static NpmBumpVersionSettings WithForce(this NpmBumpVersionSettings settings, bool force = true)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}
ArgumentNullException.ThrowIfNull(settings);

settings.Force = force;
return settings;
Expand All @@ -32,10 +29,7 @@ public static NpmBumpVersionSettings WithForce(this NpmBumpVersionSettings setti
/// <returns>The <paramref name="settings"/> instance with <see cref="NpmBumpVersionSettings.CommitMessage"/> set.</returns>
public static NpmBumpVersionSettings WithCommitMessage(this NpmBumpVersionSettings settings, string message)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}
ArgumentNullException.ThrowIfNull(settings);

settings.CommitMessage = message;
return settings;
Expand All @@ -49,10 +43,7 @@ public static NpmBumpVersionSettings WithCommitMessage(this NpmBumpVersionSettin
/// <returns>The <paramref name="settings"/> instance with <see cref="NpmBumpVersionSettings.CommitMessage"/> set.</returns>
public static NpmBumpVersionSettings WithVersion(this NpmBumpVersionSettings settings, string version)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}
ArgumentNullException.ThrowIfNull(settings);

settings.Version = version;
return settings;
Expand Down
34 changes: 12 additions & 22 deletions src/Cake.Npm/BumpVersion/NpmBumpVersionTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,26 @@
/// <summary>
/// Tool for bumping the version.
/// </summary>
public class NpmBumpVersionTool : NpmTool<NpmBumpVersionSettings>
/// <param name="fileSystem">The file system.</param>
/// <param name="environment">The environment.</param>
/// <param name="processRunner">The process runner.</param>
/// <param name="tools">The tool locator.</param>
/// <param name="log">Cake log instance.</param>
public class NpmBumpVersionTool(
IFileSystem fileSystem,
ICakeEnvironment environment,
IProcessRunner processRunner,
IToolLocator tools,
ICakeLog log) : NpmTool<NpmBumpVersionSettings>(fileSystem, environment, processRunner, tools, log)
{
/// <summary>
/// Initializes a new instance of the <see cref="NpmBumpVersionTool"/> class.
/// </summary>
/// <param name="fileSystem">The file system.</param>
/// <param name="environment">The environment.</param>
/// <param name="processRunner">The process runner.</param>
/// <param name="tools">The tool locator.</param>
/// <param name="log">Cake log instance.</param>
public NpmBumpVersionTool(
IFileSystem fileSystem,
ICakeEnvironment environment,
IProcessRunner processRunner,
IToolLocator tools,
ICakeLog log)
: base(fileSystem, environment, processRunner, tools, log)
{
}

/// <summary>
/// Calls npm version to bump a version.
/// </summary>
/// <param name="settings">The settings.</param>
public void BumpVersion(NpmBumpVersionSettings settings)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}
ArgumentNullException.ThrowIfNull(settings);

RunCore(settings);
}
Expand Down
Loading

0 comments on commit a62c347

Please sign in to comment.