Refactor database integration to use bun:sqlite instead of better-sqlite3

- Updated import statements across multiple files to use bun:sqlite.
- Changed database query methods from `prepare` to `query` for consistency.
- Removed dependency on better-sqlite3 from package.json and adjusted package.json to specify bun as the engine.
- Modified hook installation process to eliminate unnecessary dependency installation.
- Updated migration scripts to align with bun:sqlite's API.
This commit is contained in:
Alex Newman
2025-10-15 15:03:43 -04:00
parent b5bfc029c3
commit 2663121d9f
14 changed files with 351 additions and 364 deletions
+9 -5
View File
@@ -43,10 +43,11 @@ async function build() {
const buildCommand = [
'bun build',
'src/bin/cli.ts',
'--target=node',
'--target=bun',
'--outfile=dist/claude-mem.min.js',
'--minify',
'--external @anthropic-ai/claude-agent-sdk',
'--external bun:sqlite',
`--define __DEFAULT_PACKAGE_VERSION__='"${version}"'`
].join(' ');
@@ -58,10 +59,13 @@ async function build() {
// Add shebang to output
console.log('\n📝 Adding shebang...');
const distFile = 'dist/claude-mem.min.js';
const content = fs.readFileSync(distFile, 'utf-8');
if (!content.startsWith('#!/usr/bin/env node')) {
fs.writeFileSync(distFile, `#!/usr/bin/env node\n${content}`);
}
let content = fs.readFileSync(distFile, 'utf-8');
// Remove any existing shebangs
content = content.replace(/^#!.*\n/gm, '');
// Add the bun shebang
fs.writeFileSync(distFile, `#!/usr/bin/env bun\n${content}`);
console.log('✓ Shebang added');
// Make executable