fix: Update backup strategy by removing dist/ from critical files and ensuring clean rebuild

This commit is contained in:
2025-11-14 23:26:08 +01:00
parent 6eb175d4e1
commit 9ef12b934b

View File

@@ -419,7 +419,8 @@ async function performUpdate() {
}
// Backup critical files for potential rollback
const criticalFiles = ['package.json', 'package-lock.json', 'dist']
// FIXED: Don't backup dist/ - it must be rebuilt from new source code
const criticalFiles = ['package.json', 'package-lock.json']
for (const file of criticalFiles) {
const srcPath = join(process.cwd(), file)
if (!existsSync(srcPath)) continue
@@ -435,6 +436,16 @@ async function performUpdate() {
}
}
// CRITICAL FIX: Delete old dist/ before update to force clean rebuild
const oldDistPath = join(process.cwd(), 'dist')
if (existsSync(oldDistPath)) {
try {
rmSync(oldDistPath, { recursive: true, force: true })
} catch {
// Continue - build will overwrite anyway
}
}
// Step 3: Download latest code from GitHub
process.stdout.write('📥 Downloading...')
const repoOwner = 'Obsidian-wtf'