diff --git a/package.json b/package.json index 18f67bb7..9d194816 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,6 @@ "@types/react": "^18.3.5", "@types/react-dom": "^18.3.0", "esbuild": "^0.27.2", - "node-addon-api": "^8.5.0", "np": "^11.0.2", "tsx": "^4.20.6", "typescript": "^5.3.0" diff --git a/scripts/smart-install.js b/scripts/smart-install.js index eb93aa8c..2e429798 100644 --- a/scripts/smart-install.js +++ b/scripts/smart-install.js @@ -5,7 +5,7 @@ * Ensures Bun runtime and uv (Python package manager) are installed * (auto-installs if missing) and handles dependency installation when needed. */ -import { existsSync, readFileSync, writeFileSync, rmSync } from 'fs'; +import { existsSync, readFileSync, writeFileSync } from 'fs'; import { execSync, spawnSync } from 'child_process'; import { join } from 'path'; import { homedir } from 'os'; @@ -260,18 +260,17 @@ function installDeps() { console.error('📦 Installing dependencies with Bun...'); - // Clear stale native module cache (sharp/libvips) to prevent broken dylib references. - // Bun's cache can retain native binaries that reference companion libraries at - // broken relative paths after version upgrades. - const bunCacheImgDir = join(homedir(), '.bun', 'install', 'cache', '@img'); - if (existsSync(bunCacheImgDir)) { - console.error(' Clearing stale native module cache (@img/sharp)...'); - rmSync(bunCacheImgDir, { recursive: true, force: true }); - } - // Quote path for Windows paths with spaces const bunCmd = IS_WINDOWS && bunPath.includes(' ') ? `"${bunPath}"` : bunPath; + // Clear Bun's package cache to prevent stale native module artifacts + try { + execSync(`${bunCmd} pm cache rm`, { cwd: ROOT, stdio: 'pipe', shell: IS_WINDOWS }); + console.error(' Cleared Bun package cache'); + } catch { + // Cache may not exist yet on first install + } + execSync(`${bunCmd} install`, { cwd: ROOT, stdio: 'inherit', shell: IS_WINDOWS }); // Write version marker diff --git a/scripts/sync-marketplace.cjs b/scripts/sync-marketplace.cjs index c7b325d0..190dcc23 100644 --- a/scripts/sync-marketplace.cjs +++ b/scripts/sync-marketplace.cjs @@ -80,22 +80,12 @@ try { { stdio: 'inherit' } ); - // Remove stale lockfiles before install — they pin old native dep versions - const { unlinkSync, rmSync } = require('fs'); - for (const lockfile of ['package-lock.json', 'bun.lock']) { - const lockpath = path.join(INSTALLED_PATH, lockfile); - if (existsSync(lockpath)) { - unlinkSync(lockpath); - console.log(`Removed stale ${lockfile}`); - } - } - - // Clear stale native module cache (sharp/libvips) — Bun's cache can retain - // native binaries that reference companion libraries at broken relative paths - const bunCacheImgDir = path.join(os.homedir(), '.bun', 'install', 'cache', '@img'); - if (existsSync(bunCacheImgDir)) { - rmSync(bunCacheImgDir, { recursive: true, force: true }); - console.log('Cleared stale native module cache (@img/sharp)'); + // Clear Bun's package cache to prevent stale native module artifacts + try { + execSync('bun pm cache rm', { cwd: INSTALLED_PATH, stdio: 'pipe' }); + console.log('Cleared Bun package cache'); + } catch { + // Cache may not exist yet on first install } console.log('Running bun install in marketplace...');