Dependencies now install during update

This commit is contained in:
Isaac Grynsztein
2020-04-01 19:31:41 -04:00
parent 58718b6e3b
commit 89ececdbeb
2 changed files with 25 additions and 15 deletions

View File

@@ -137,9 +137,6 @@ async function startServer() {
});
}
// getLatestVersion();
// restartServer();
updateServer();
}
async function restartServer() {
@@ -173,6 +170,9 @@ async function updateServer() {
// grab new package.json and public folder
await downloadUpdateFiles();
// run npm install
await installDependencies();
restartServer();
});
}
@@ -244,6 +244,16 @@ async function downloadLatestRelease(tag) {
});
}
async function installDependencies() {
return new Promise(resolve => {
var child_process = require('child_process');
child_process.execSync('npm install',{stdio:[0,1,2]});
resolve(true);
});
}
// helper function to download file using fetch
const fetchFile = (async (url, path) => {
const res = await fetch(url);