👷 download esbuild binaries to out dir for pkg
This commit is contained in:
parent
f4a749f351
commit
10b987ec24
1 changed files with 25 additions and 2 deletions
27
pkg/build.js
27
pkg/build.js
|
|
@ -34,8 +34,8 @@ const targetToLanceDb = {
|
|||
|
||||
// Copy node_modules for pre-built binaries
|
||||
const DYNAMIC_IMPORTS = [
|
||||
// "esbuild",
|
||||
// "@esbuild",
|
||||
"esbuild",
|
||||
"@esbuild",
|
||||
// // "@lancedb",
|
||||
// "posthog-node",
|
||||
// "@octokit",
|
||||
|
|
@ -84,6 +84,29 @@ const targetToLanceDb = {
|
|||
}
|
||||
}
|
||||
|
||||
console.log("[info] Downloading prebuilt esbuild...");
|
||||
const esbuildDir = "out/node_modules/@esbuild";
|
||||
for (const target of targets) {
|
||||
const targetDir = `${esbuildDir}/${target}`;
|
||||
|
||||
console.log(`[info] Downloading ${target}...`);
|
||||
fs.mkdirSync(`${targetDir}/bin`, {
|
||||
recursive: true,
|
||||
});
|
||||
execSync(
|
||||
`curl -o ${esbuildDir}/esbuild.tgz https://registry.npmjs.org/@esbuild/${target}/-/${target}-0.19.11.tgz`
|
||||
);
|
||||
execSync(`tar -xzvf ${esbuildDir}/esbuild.tgz -C ${esbuildDir}`);
|
||||
await new Promise((resolve) =>
|
||||
ncp(`${esbuildDir}/package`, targetDir, resolve)
|
||||
);
|
||||
fs.rmSync(`${esbuildDir}/esbuild.tgz`);
|
||||
fs.rmSync(`${esbuildDir}/package`, {
|
||||
force: true,
|
||||
recursive: true,
|
||||
});
|
||||
}
|
||||
|
||||
console.log("[info] Building with esbuild...");
|
||||
// Bundles the extension into one file
|
||||
await esbuild.build({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue