🚧 build binaries for all targets

This commit is contained in:
Nate Sesti 2024-02-17 23:41:42 -08:00
parent 5f1d9f088d
commit 246ae3f5e3
2 changed files with 19 additions and 7 deletions

View file

@ -8,9 +8,11 @@ The build process is otherwise defined entirely in `build.js`.
### List of native modules
- sqlite3
- lancedb
- esbuild
- sqlite3/build/Release/node_sqlite3.node (\*)
- @lancedb/\*\*
- esbuild?
- @esbuild?
- onnxruntime-node?
### List of dynamically imported modules
@ -22,3 +24,5 @@ The build process is otherwise defined entirely in `build.js`.
- tree-sitter.wasm
- tree-sitter-wasms/
(\*) = need to download for each platform manually

View file

@ -4,6 +4,11 @@ const fs = require("fs");
const ncp = require("ncp").ncp;
const esbuildOutputFile = "out/index.js";
const platforms = ["darwin", "linux", "win32"];
const architectures = ["x64", "arm64"];
const targets = platforms.flatMap((platform) =>
architectures.map((arch) => `${platform}-${arch}`)
);
let esbuildOnly = false;
for (let i = 2; i < process.argv.length; i++) {
@ -86,10 +91,13 @@ for (let i = 2; i < process.argv.length; i++) {
return;
}
console.log("[info] Building binary with pkg...");
execSync(
`npx pkg --no-bytecode --public-packages "*" --public pkgJson/darwin-arm64`
);
console.log("[info] Building binaries with pkg...");
for (const target of targets) {
console.log(`[info] Building ${target}...`);
execSync(
`npx pkg --no-bytecode --public-packages "*" --public pkgJson/${target} --out-path bin/${target}`
);
}
// execSync(
// `npx pkg out/index.js --target node18-darwin-arm64 --no-bytecode --public-packages "*" --public -o bin/pkg`
// );