From 07d9626cca940624c9f2967c86896d48b2592f23 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Tue, 11 Sep 2018 21:13:57 +0200 Subject: [PATCH] (GH-92) Add NpmUpdate alias which accepts a settings configurator --- src/Cake.Npm/NpmUpdateAliases.cs | 33 +++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/Cake.Npm/NpmUpdateAliases.cs b/src/Cake.Npm/NpmUpdateAliases.cs index 6ef192f..ec33397 100644 --- a/src/Cake.Npm/NpmUpdateAliases.cs +++ b/src/Cake.Npm/NpmUpdateAliases.cs @@ -36,7 +36,38 @@ public static void NpmUpdate(this ICakeContext context) } /// - /// Updates all packages for the project in the current working directory. + /// Updates all packages for the project using the settings returned by a configurator. + /// + /// The context. + /// The settings configurator. + /// + /// + /// settings.UpdateGlobalPackages()); + /// ]]> + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Update")] + public static void NpmUpdate(this ICakeContext context, Action 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); + } + + /// + /// Updates all packages for the project using the specified settings. /// /// The context. /// The settings.