From 9ef12b934b8494e8d3ce8b487d169516ef46fed5 Mon Sep 17 00:00:00 2001 From: LightZirconite Date: Fri, 14 Nov 2025 23:26:08 +0100 Subject: [PATCH] fix: Update backup strategy by removing dist/ from critical files and ensuring clean rebuild --- scripts/installer/update.mjs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/installer/update.mjs b/scripts/installer/update.mjs index 9822eb1..7907913 100644 --- a/scripts/installer/update.mjs +++ b/scripts/installer/update.mjs @@ -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'