Skip to content

Commit 0f24577

Browse files
committed
fix build to include package.json
1 parent a25d56b commit 0f24577

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

binary/build.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,16 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
238238
}.tar.gz`;
239239
execCmdSync(`curl -L -o ${targetDir}/build.tar.gz ${downloadUrl}`);
240240
execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`);
241-
fs.copyFileSync(
242-
`${targetDir}/build/Release/node_sqlite3.node`,
243-
`${targetDir}/node_sqlite3.node`,
244-
);
241+
242+
// Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
243+
fs.writeFileSync(`${targetDir}/package.json`, "");
245244

246245
// Copy to build directory for testing
247246
try {
248247
const [platform, arch] = target.split("-");
249248
if (platform === currentPlatform && arch === currentArch) {
250249
fs.copyFileSync(
251-
`${targetDir}/node_sqlite3.node`,
250+
`${targetDir}/build/Release/node_sqlite3.node`,
252251
`build/node_sqlite3.node`,
253252
);
254253
}
@@ -258,10 +257,6 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
258257
}
259258

260259
fs.unlinkSync(`${targetDir}/build.tar.gz`);
261-
fs.rmSync(`${targetDir}/build`, {
262-
recursive: true,
263-
force: true,
264-
});
265260

266261
// Download and unzip prebuilt esbuild binary for the target
267262
console.log(`[info] Downloading esbuild for ${target}...`);
@@ -300,7 +295,8 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
300295
`${targetDir}/continue-binary${exe}`,
301296
`${targetDir}/esbuild${exe}`,
302297
`${targetDir}/index.node`, // @lancedb
303-
`${targetDir}/node_sqlite3.node`,
298+
"package.json", // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
299+
`${targetDir}/build/Release/node_sqlite3.node`,
304300
);
305301
}
306302

0 commit comments

Comments
 (0)