Skip to content

Commit

Permalink
Add missing publish alias for fluent settings API
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed May 18, 2017
1 parent d57b486 commit b290cfa
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/Cake.Npm/NpmPublishAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,37 @@ public static void NpmPublish(this ICakeContext context, string source)
context.NpmPublish(new NpmPublishSettings { Source = source });
}

/// <summary>
/// Publishes a npm package using the settings returned by a configurator.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="configurator">The settings configurator.</param>
/// <example>
/// <code>
/// <![CDATA[
/// NpmPack(settings => settings.WithLogLevel(NpmLogLevel.Verbose));
/// ]]>
/// </code>
/// </example>
[CakeMethodAlias]
[CakeAliasCategory("Publish")]
public static void NpmPublish(this ICakeContext context, Action<NpmPublishSettings> configurator)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}

if (configurator == null)
{
throw new ArgumentNullException(nameof(configurator));
}

var settings = new NpmPublishSettings();
configurator(settings);
context.NpmPublish(settings);
}

/// <summary>
/// Publishes a npm package based on the specified settings.
/// </summary>
Expand Down

0 comments on commit b290cfa

Please sign in to comment.