public Task AddAsync(string directory, NpmPackageInfo npmPackage) { var packageJsonFilePath = Path.Combine(directory, "package.json"); if (!File.Exists(packageJsonFilePath)) { return(Task.CompletedTask); } Logger.LogInformation($"Installing '{npmPackage.Name}' package to the project '{packageJsonFilePath}'..."); using (DirectoryHelper.ChangeCurrentDirectory(directory)) { Logger.LogInformation("yarn add " + npmPackage.Name + "... " + Directory.GetCurrentDirectory()); var procStartInfo = new ProcessStartInfo("cmd.exe", "/C yarn add " + npmPackage.Name); Process.Start(procStartInfo).WaitForExit(); Logger.LogInformation("gulp... " + Directory.GetCurrentDirectory()); procStartInfo = new ProcessStartInfo("cmd.exe", "/C gulp"); Process.Start(procStartInfo).WaitForExit(); } return(Task.CompletedTask); }
public Task AddAsync(string directory, NpmPackageInfo npmPackage) { var packageJsonFilePath = Path.Combine(directory, "package.json"); if (!File.Exists(packageJsonFilePath)) { return(Task.CompletedTask); } Logger.LogInformation($"Installing '{npmPackage.Name}' package to the project '{packageJsonFilePath}'..."); Logger.LogInformation("yarn add " + npmPackage.Name + "..."); var procStartInfo = new ProcessStartInfo("cmd.exe", "/C yarn add " + npmPackage.Name); procStartInfo.WindowStyle = ProcessWindowStyle.Normal; Process.Start(procStartInfo).WaitForExit(); Logger.LogInformation("gulp..."); procStartInfo = new ProcessStartInfo("cmd.exe", "/C gulp"); procStartInfo.WindowStyle = ProcessWindowStyle.Normal; Process.Start(procStartInfo).WaitForExit(); return(Task.CompletedTask); }