Finalizing #10

- Added a stash command to stash any found changs
- Added a post-update script (needs testing)
This commit is contained in:
Logan Cusano
2024-03-24 18:55:29 -04:00
parent 2754494083
commit 3e50f0b2f3
2 changed files with 10 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import simpleGit from 'simple-git';
import { restartService } from './serviceHandler.mjs'
import { launchProcess } from './subprocessHandler.mjs'
const git = simpleGit();
@@ -24,13 +25,18 @@ export const checkForUpdates = async () => {
if (gitStatus.modified.length > 0){
// There is locally modified code
console.log("There is locally modified code, resetting...");
await git.reset('hard', ['origin/master'])
await git.stash();
await git.reset('hard', ['origin/master']);
}
// Pull the latest changes from the remote repository
await git.pull();
console.log('Update completed successfully. Restarting the application...');
// Run the post-update script
await launchProcess("bash", ['./post-update.sh']);
// Restart the application to apply the updates
restartApplication();
return true

3
client/post-update.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
npm install