Finalizing #10
- Added a stash command to stash any found changs - Added a post-update script (needs testing)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import simpleGit from 'simple-git';
|
import simpleGit from 'simple-git';
|
||||||
import { restartService } from './serviceHandler.mjs'
|
import { restartService } from './serviceHandler.mjs'
|
||||||
|
import { launchProcess } from './subprocessHandler.mjs'
|
||||||
|
|
||||||
const git = simpleGit();
|
const git = simpleGit();
|
||||||
|
|
||||||
@@ -24,13 +25,18 @@ export const checkForUpdates = async () => {
|
|||||||
if (gitStatus.modified.length > 0){
|
if (gitStatus.modified.length > 0){
|
||||||
// There is locally modified code
|
// There is locally modified code
|
||||||
console.log("There is locally modified code, resetting...");
|
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
|
// Pull the latest changes from the remote repository
|
||||||
await git.pull();
|
await git.pull();
|
||||||
|
|
||||||
console.log('Update completed successfully. Restarting the application...');
|
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
|
// Restart the application to apply the updates
|
||||||
restartApplication();
|
restartApplication();
|
||||||
return true
|
return true
|
||||||
|
|||||||
3
client/post-update.sh
Normal file
3
client/post-update.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
npm install
|
||||||
Reference in New Issue
Block a user