diff --git a/pkg/build.js b/pkg/build.js index 00844238c..ab0db2c14 100644 --- a/pkg/build.js +++ b/pkg/build.js @@ -20,6 +20,14 @@ for (let i = 2; i < process.argv.length; i++) { } } +const targetToLanceDb = { + "darwin-arm64": "@lancedb/vectordb-darwin-arm64", + "darwin-x64": "@lancedb/vectordb-darwin-x64", + "linux-arm64": "@lancedb/vectordb-linux-arm64-gnu", + "linux-x64": "@lancedb/vectordb-linux-x64-gnu", + "win32-x64": "@lancedb/vectordb-win32-x64-msvc", +}; + (async () => { // console.log("[info] Building with ncc..."); // execSync(`npx ncc build src/index.ts -o out`); @@ -68,6 +76,14 @@ for (let i = 2; i < process.argv.length; i++) { ); console.log(`[info] Copied ${DYNAMIC_IMPORTS.join(", ")}`); + console.log("[info] Downloading prebuilt lancedb..."); + for (const target of targets) { + if (targetToLanceDb[target]) { + console.log(`[info] Downloading ${target}...`); + execSync(`npm install -f ${targetToLanceDb[target]} --no-save`); + } + } + console.log("[info] Building with esbuild..."); // Bundles the extension into one file await esbuild.build({ diff --git a/pkg/pkgJson/darwin-x64/package.json b/pkg/pkgJson/darwin-x64/package.json index aa98b9b17..d064d6c2a 100644 --- a/pkg/pkgJson/darwin-x64/package.json +++ b/pkg/pkgJson/darwin-x64/package.json @@ -9,7 +9,7 @@ ], "assets": [ "../../../core/node_modules/sqlite3/**/*", - "../../node_modules/@lancedb/**/*", + "../../node_modules/@lancedb/vectordb-darwin-x64/index.node", "../../out/tree-sitter.wasm", "../../out/tree-sitter-wasms/*" ], diff --git a/pkg/pkgJson/linux-arm64/package.json b/pkg/pkgJson/linux-arm64/package.json index f1d4c5f67..37a3a5b6d 100644 --- a/pkg/pkgJson/linux-arm64/package.json +++ b/pkg/pkgJson/linux-arm64/package.json @@ -9,7 +9,7 @@ ], "assets": [ "../../../core/node_modules/sqlite3/**/*", - "../../node_modules/@lancedb/**/*", + "../../node_modules/@lancedb/vectordb-linux-arm64-gnu/index.node", "../../out/tree-sitter.wasm", "../../out/tree-sitter-wasms/*" ], diff --git a/pkg/pkgJson/linux-x64/package.json b/pkg/pkgJson/linux-x64/package.json index 62f99ebd0..487886d26 100644 --- a/pkg/pkgJson/linux-x64/package.json +++ b/pkg/pkgJson/linux-x64/package.json @@ -9,7 +9,7 @@ ], "assets": [ "../../../core/node_modules/sqlite3/**/*", - "../../node_modules/@lancedb/**/*", + "../../node_modules/@lancedb/vectordb-linux-x64-gnu/index.node", "../../out/tree-sitter.wasm", "../../out/tree-sitter-wasms/*" ], diff --git a/pkg/pkgJson/win32-arm64/package.json b/pkg/pkgJson/win32-arm64/package.json index c7b16e035..4573ccbca 100644 --- a/pkg/pkgJson/win32-arm64/package.json +++ b/pkg/pkgJson/win32-arm64/package.json @@ -9,7 +9,7 @@ ], "assets": [ "../../../core/node_modules/sqlite3/**/*", - "../../node_modules/@lancedb/**/*", + "../../node_modules/@lancedb/vectordb-win32-x64-msvc/index.node", "../../out/tree-sitter.wasm", "../../out/tree-sitter-wasms/*" ], diff --git a/pkg/pkgJson/win32-x64/package.json b/pkg/pkgJson/win32-x64/package.json index 32ac6e583..c9a4b1a9b 100644 --- a/pkg/pkgJson/win32-x64/package.json +++ b/pkg/pkgJson/win32-x64/package.json @@ -9,7 +9,7 @@ ], "assets": [ "../../../core/node_modules/sqlite3/**/*", - "../../node_modules/@lancedb/**/*", + "../../node_modules/@lancedb/vectordb-win32-x64-msvc/index.node", "../../out/tree-sitter.wasm", "../../out/tree-sitter-wasms/*" ],