chore: improve error handling in theme update script to check for merge conflicts

This commit is contained in:
radishzzz 2025-05-29 13:46:51 +01:00
parent 42225906ab
commit 2d28bf93a5

View file

@ -1,4 +1,6 @@
import { execSync } from 'node:child_process'
import fs from 'node:fs'
import path from 'node:path'
import process from 'node:process'
// Check and set up the remote repository
@ -25,6 +27,15 @@ try {
}
}
catch (error) {
console.error('❌ Update failed:', error)
process.exit(1)
// Check if there's a merge conflict
const gitDir = execSync('git rev-parse --git-dir', { encoding: 'utf8' }).trim()
const mergeHeadPath = path.join(gitDir, 'MERGE_HEAD')
if (fs.existsSync(mergeHeadPath)) {
console.log('⚠️ Update fetched with merge conflicts. Please resolve manually')
}
else {
console.error('❌ Update failed:', error)
process.exit(1)
}
}