From 03d654061f596ee81a9473985ff306558950d0e1 Mon Sep 17 00:00:00 2001 From: David Snelling Date: Wed, 24 Jun 2026 15:18:26 -0700 Subject: [PATCH] build(8.0): clean dist before every build so stale artifacts never ship MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The incremental `tsc` build never removed dist output for source files deleted in earlier refactors, so a cluster of 5-month-old artifacts kept shipping in the published package — an entire orphaned native module tree (dist/native/*, the Native* graph/metadata adapters, the mmap adapter) whose source was removed when those responsibilities moved behind the provider boundary. Nothing in the live tree imported them; they were dead weight in every tarball, carrying stale type signatures with no source. Add a `clean` script (cross-platform `fs.rmSync`) and a `prebuild` hook so every build — including the `prepare` build that runs on publish — starts from an empty dist. Verified: a planted stale file is wiped on the next build, and a clean rebuild drops the entire orphaned tree. Co-Authored-By: Claude Opus 4.8 --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index 0f312ba9..195d88df 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,8 @@ "bun": ">=1.0.0" }, "scripts": { + "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"", + "prebuild": "npm run clean", "build": "npm run build:types:if-needed && npm run build:patterns:if-needed && tsc && tsc -p tsconfig.cli.json && npm run build:copy-wasm", "build:copy-wasm": "node -e \"const fs=require('fs');const src='src/embeddings/wasm/pkg';const dst='dist/embeddings/wasm/pkg';const skip=new Set(['package.json','.gitignore']);if(fs.existsSync(src)){fs.mkdirSync(dst,{recursive:true});fs.readdirSync(src).filter(f=>!skip.has(f)).forEach(f=>fs.copyFileSync(src+'/'+f,dst+'/'+f));console.log('Copied WASM pkg to dist')}\"", "build:types": "tsx scripts/buildTypeEmbeddings.ts",