[exe] install dependencies and download dist

pull/2191/head
Louis Lam 2 years ago
parent 655ba015a0
commit a487347b33

@ -63,12 +63,6 @@ namespace UptimeKuma {
}
void npmSetup() {
if (Directory.Exists("core/node_modules")) {
// Application.Restart();
}
label.Text = "npm run setup";
progressBar.Value = 50;
labelData.Text = "";
var startInfo = new ProcessStartInfo {
@ -86,10 +80,12 @@ namespace UptimeKuma {
process.StartInfo = startInfo;
process.EnableRaisingEvents = true;
process.Exited += (object _, EventArgs e) => {
// Application.Restart();
progressBar.Value = 100;
progressBar.Value = 100;
if (process.ExitCode == 0) {
Task.Delay(2000).ContinueWith((task) => {
Application.Restart();
});
label.Text = "Done";
} else {
label.Text = "Failed, exit code: " + process.ExitCode;
@ -97,7 +93,12 @@ namespace UptimeKuma {
};
process.Start();
process.StandardInput.WriteLine("\"../node/npm\" run setup");
label.Text = "Installing dependencies and download dist files";
progressBar.Value = 50;
process.StandardInput.WriteLine("\"../node/npm\" ci --production");
process.StandardInput.WriteLine("\"../node/npm\" run download-dist");
process.StandardInput.WriteLine("exit");
}
void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) {
@ -110,7 +111,7 @@ namespace UptimeKuma {
}
}
async void DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) {
void DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) {
Extract(currentDownloadItem);
DownloadNextFile();
}

@ -45,7 +45,7 @@ namespace UptimeKuma {
trayIcon.MouseDoubleClick += new MouseEventHandler(Open);
trayIcon.Visible = true;
if (Directory.Exists("core") && Directory.Exists("node") && Directory.Exists("core/node_modules")) {
if (Directory.Exists("core") && Directory.Exists("node") && Directory.Exists("core/node_modules") && Directory.Exists("core/dist")) {
// Go go go
StartProcess();
} else {

Loading…
Cancel
Save