private static ProcessArgumentBuilder GetYarnAddArguments(YarnAddSettings settings) { var args = new ProcessArgumentBuilder(); if (settings != null && settings.Global) { args.Append("global"); } settings?.Evaluate(args); return(args); }
/// <summary> /// execute 'yarn add' with options /// </summary> /// <param name="configure">options when running 'yarn install'</param> /// <example> /// <para>Run 'yarn add gulp'</para> /// <code> /// <![CDATA[ /// Task("Yarn-Add-Gulp") /// .Does(() => /// { /// Yarn.Add(settings => settings.Package("gulp")); /// }); /// ]]> /// </code> /// <para>Run 'yarn global add gulp'</para> /// <code> /// <![CDATA[ /// Task("Yarn-Add-Gulp") /// .Does(() => /// { /// Yarn.Add(settings => settings.Package("gulp").Globally()); /// }); /// ]]> /// </code> /// </example> public IYarnRunnerCommands Add(Action <YarnAddSettings> configure = null) { var settings = new YarnAddSettings(); configure?.Invoke(settings); var args = GetYarnAddArguments(settings); Run(settings, args); return(this); }