fix build to include package.json

This commit is contained in:
Nate Sesti 2024-08-18 20:49:48 -07:00
parent a25d56b543
commit 0f24577bd1

View file

@ -238,17 +238,16 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
}.tar.gz`;
execCmdSync(`curl -L -o ${targetDir}/build.tar.gz ${downloadUrl}`);
execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`);
fs.copyFileSync(
`${targetDir}/build/Release/node_sqlite3.node`,
`${targetDir}/node_sqlite3.node`,
);
// Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
fs.writeFileSync(`${targetDir}/package.json`, "");
// Copy to build directory for testing
try {
const [platform, arch] = target.split("-");
if (platform === currentPlatform && arch === currentArch) {
fs.copyFileSync(
`${targetDir}/node_sqlite3.node`,
`${targetDir}/build/Release/node_sqlite3.node`,
`build/node_sqlite3.node`,
);
}
@ -258,10 +257,6 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
}
fs.unlinkSync(`${targetDir}/build.tar.gz`);
fs.rmSync(`${targetDir}/build`, {
recursive: true,
force: true,
});
// Download and unzip prebuilt esbuild binary for the target
console.log(`[info] Downloading esbuild for ${target}...`);
@ -300,7 +295,8 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
`${targetDir}/continue-binary${exe}`,
`${targetDir}/esbuild${exe}`,
`${targetDir}/index.node`, // @lancedb
`${targetDir}/node_sqlite3.node`,
"package.json", // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
`${targetDir}/build/Release/node_sqlite3.node`,
);
}