Skip to content

Commit

Permalink
(GH-92) Add NpmUpdate alias which accepts a settings configurator
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Sep 11, 2018
1 parent 9ca9682 commit 07d9626
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/Cake.Npm/NpmUpdateAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,38 @@ public static void NpmUpdate(this ICakeContext context)
}

/// <summary>
/// Updates all packages for the project in the current working directory.
/// Updates all packages for the project using the settings returned by a configurator.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="configurator">The settings configurator.</param>
/// <example>
/// <code>
/// <![CDATA[
/// NpmUpdate(settings => settings.UpdateGlobalPackages());
/// ]]>
/// </code>
/// </example>
[CakeMethodAlias]
[CakeAliasCategory("Update")]
public static void NpmUpdate(this ICakeContext context, Action<NpmUpdateSettings> configurator)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}

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

var settings = new NpmUpdateSettings();
configurator(settings);
context.NpmUpdate(settings);
}

/// <summary>
/// Updates all packages for the project using the specified settings.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="settings">The settings.</param>
Expand Down

0 comments on commit 07d9626

Please sign in to comment.