From 03ed5c14eca3df60f1cc12fed75637d6ea738cbe Mon Sep 17 00:00:00 2001 From: mssoftjp <115339791+mssoftjp@users.noreply.github.com> Date: Sat, 1 Nov 2025 23:00:00 +0900 Subject: [PATCH] build: skip local vad assets in release bundle --- scripts/post-build.mjs | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/post-build.mjs b/scripts/post-build.mjs index cbdb28f..f351d77 100644 --- a/scripts/post-build.mjs +++ b/scripts/post-build.mjs @@ -79,15 +79,16 @@ function copyToBuildDir(targetDir, targetName) { const fvadSourceDir = path.join(rootDir, 'src', 'lib', 'fvad-wasm'); const fvadJsSrcPath = path.join(fvadSourceDir, 'fvad.js'); - const fvadJsDestPath = path.join(targetDir, 'fvad.js'); - if (fs.existsSync(fvadJsSrcPath)) { - fs.copyFileSync(fvadJsSrcPath, fvadJsDestPath); - console.log(' ✅ fvad.js (WebAssembly loader)'); - } else { - console.warn(' ⚠️ fvad.js not found (local VAD loader will be missing)'); - } if (includeLocalVadAssets) { + const fvadJsDestPath = path.join(targetDir, 'fvad.js'); + if (fs.existsSync(fvadJsSrcPath)) { + fs.copyFileSync(fvadJsSrcPath, fvadJsDestPath); + console.log(' ✅ fvad.js (WebAssembly loader)'); + } else { + console.warn(' ⚠️ fvad.js not found (local VAD loader will be missing)'); + } + const fvadWasmSrcPath = path.join(fvadSourceDir, 'fvad.wasm'); const fvadWasmDestPath = path.join(targetDir, 'fvad.wasm'); if (fs.existsSync(fvadWasmSrcPath)) { @@ -97,7 +98,15 @@ function copyToBuildDir(targetDir, targetName) { console.warn(' ⚠️ fvad.wasm not found (skipped)'); } } else { - console.log(' • Skipping fvad.wasm (INCLUDE_WASM not set)'); + const leftoverFiles = ['fvad.js', 'fvad.wasm']; + leftoverFiles.forEach(file => { + const targetPath = path.join(targetDir, file); + if (fs.existsSync(targetPath)) { + fs.rmSync(targetPath, { force: true }); + console.log(` 🧹 removed leftover ${file}`); + } + }); + console.log(' • Skipping local VAD assets (INCLUDE_WASM not set)'); } // Copy license files (best practice to ship with distribution)