diff --git a/src/Cake.Npm/NpmPublishAliases.cs b/src/Cake.Npm/NpmPublishAliases.cs index d54f092..853c409 100644 --- a/src/Cake.Npm/NpmPublishAliases.cs +++ b/src/Cake.Npm/NpmPublishAliases.cs @@ -66,6 +66,37 @@ public static void NpmPublish(this ICakeContext context, string source) context.NpmPublish(new NpmPublishSettings { Source = source }); } + /// + /// Publishes a npm package using the settings returned by a configurator. + /// + /// The context. + /// The settings configurator. + /// + /// + /// settings.WithLogLevel(NpmLogLevel.Verbose)); + /// ]]> + /// + /// + [CakeMethodAlias] + [CakeAliasCategory("Publish")] + public static void NpmPublish(this ICakeContext context, Action 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); + } + /// /// Publishes a npm package based on the specified settings. ///