correct to copy-nodemodule.js

This commit is contained in:
uinstinct 2025-06-06 21:20:16 +05:30
parent e98307aafa
commit 8d48cefc2e
3 changed files with 9 additions and 15 deletions

View File

@ -6,10 +6,7 @@ const { rimrafSync } = require("rimraf");
const { validateFilesPresent } = require("../scripts/util");
const { ALL_TARGETS, TARGET_TO_LANCEDB } = require("./utils/targets");
const { fork } = require("child_process");
const {
copyLanceDBFilePath,
copyLanceDB,
} = require("../scripts/util/copy-lancedb");
const { copyNodeModule } = require("../scripts/util/copy-nodemodule");
const bin = path.join(__dirname, "bin");
const out = path.join(__dirname, "out");
@ -107,7 +104,7 @@ async function buildWithEsbuild() {
}
console.log(`[info] Downloading for ${target}...`);
copyLanceDBPromises.push(
copyLanceDB(TARGET_TO_LANCEDB[target], "@lancedb"),
copyNodeModule(TARGET_TO_LANCEDB[target], "@lancedb"),
);
}
await Promise.all(copyLanceDBPromises).catch(() => {

View File

@ -4,7 +4,7 @@ const path = require("path");
const ncp = require("ncp").ncp;
const { rimrafSync } = require("rimraf");
const { copyLanceDB } = require("../../../scripts/util/copy-lancedb");
const { copyNodeModule } = require("../../../scripts/util/copy-nodemodule");
const {
validateFilesPresent,
execCmdSync,
@ -283,15 +283,12 @@ void (async () => {
await Promise.all([
copyEsbuild(target),
copySqlite(target),
copyLanceDB(packageToInstall, "@lancedb"),
copyNodeModule(packageToInstall, "@lancedb"),
]);
} else {
// Download esbuild from npm in tmp and copy over
console.log("[info] npm installing esbuild binary");
await installNodeModuleInTempDirAndCopyToCurrent(
"esbuild@0.17.19",
"@esbuild",
);
await copyNodeModule("esbuild@0.17.19", "@esbuild");
}
console.log("[info] Copying sqlite node binding from core");

View File

@ -82,11 +82,11 @@ process.on("message", (msg) => {
});
/**
* invoke a child process to install and copy lancedb into node modules
* @param {string} packageName the lancedb platform to install and copy
* invoke a child process to install a node module into temporary directory and copy it over into node modules
* @param {string} packageName the module to install and copy
* @param {string} toCopy directory to copy into inside node modules
*/
async function copyLanceDB(packageName, toCopy) {
async function copyNodeModule(packageName, toCopy) {
const child = fork(__filename, { stdio: "inherit", cwd: process.cwd() });
child.send({
payload: {
@ -106,5 +106,5 @@ async function copyLanceDB(packageName, toCopy) {
}
module.exports = {
copyLanceDB,
copyNodeModule,
};