mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-15 11:12:54 +02:00
chore: improve error handling in theme update script to check for merge conflicts
This commit is contained in:
parent
42225906ab
commit
2d28bf93a5
1 changed files with 13 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
||||||
import { execSync } from 'node:child_process'
|
import { execSync } from 'node:child_process'
|
||||||
|
import fs from 'node:fs'
|
||||||
|
import path from 'node:path'
|
||||||
import process from 'node:process'
|
import process from 'node:process'
|
||||||
|
|
||||||
// Check and set up the remote repository
|
// Check and set up the remote repository
|
||||||
|
@ -25,6 +27,15 @@ try {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error('❌ Update failed:', error)
|
// Check if there's a merge conflict
|
||||||
process.exit(1)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue