private string BuildHtmlDesign(string tempFolder) { string user = System.Security.Principal.WindowsIdentity.GetCurrent().Name; ProcessStartInfo info = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/c npm start --color=false", WorkingDirectory = tempFolder, CreateNoWindow = true, ErrorDialog = false, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, StandardErrorEncoding = Encoding.UTF8, StandardOutputEncoding = Encoding.UTF8 }; using (Process cmd = new Process { StartInfo = info }) { cmd.Start(); using (StreamReader reader = cmd.StandardOutput) { string output = reader.ReadToEnd(); if (!String.IsNullOrEmpty(output)) { Logger.Info(output); } } using (StreamReader reader = cmd.StandardError) { string error = reader.ReadToEnd(); if (!string.IsNullOrEmpty(error)) { Exception ex = new DxaException(error); ex.Data.Add("Filename", info.FileName); ex.Data.Add("Arguments", info.Arguments); ex.Data.Add("User", user); throw ex; } } cmd.WaitForExit(); } string distFolder = Path.Combine(tempFolder, "dist"); if (!Directory.Exists(distFolder)) { throw new DxaException("HTML Design build failed; dist folder is missing."); } return(distFolder); }
private string BuildHtmlDesign(string tempFolder) { string user = System.Security.Principal.WindowsIdentity.GetCurrent().Name; ProcessStartInfo info = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/c npm start --color=false", WorkingDirectory = tempFolder, CreateNoWindow = true, ErrorDialog = false, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, StandardErrorEncoding = Encoding.UTF8, StandardOutputEncoding = Encoding.UTF8 }; using (Process cmd = new Process { StartInfo = info }) { cmd.Start(); using (StreamReader reader = cmd.StandardOutput) { string output = reader.ReadToEnd(); if (!String.IsNullOrEmpty(output)) { Logger.Info(output); } } using (StreamReader reader = cmd.StandardError) { string error = reader.ReadToEnd(); if (!string.IsNullOrEmpty(error)) { Exception ex = new DxaException(error); ex.Data.Add("Filename", info.FileName); ex.Data.Add("Arguments", info.Arguments); ex.Data.Add("User", user); throw ex; } } cmd.WaitForExit(); } string distFolder = Path.Combine(tempFolder, "dist"); if (!Directory.Exists(distFolder)) { throw new DxaException("HTML Design build failed; dist folder is missing."); } return distFolder; }