build(vscode): stop bundling esbuild; remove @esbuild binary staging and checks
This commit is contained in:
parent
d9b426d166
commit
fb1c29e146
5 changed files with 9 additions and 122 deletions
|
|
@ -24,4 +24,9 @@ e2e
|
|||
|
||||
server/exe/**
|
||||
!out/node_modules/**
|
||||
!node_modules/@vscode/ripgrep/bin/rg
|
||||
!node_modules/@vscode/ripgrep/bin/rg
|
||||
|
||||
# Do not ship esbuild in VSIX
|
||||
out/node_modules/esbuild/**
|
||||
out/node_modules/@esbuild/**
|
||||
**/*.exe
|
||||
|
|
@ -737,7 +737,6 @@
|
|||
"dbinfoz": "^0.14.0",
|
||||
"diff": "^7.0.0",
|
||||
"downshift": "^7.6.0",
|
||||
"esbuild": "0.17.19",
|
||||
"express": "^4.18.2",
|
||||
"fkill": "^8.1.0",
|
||||
"follow-redirects": "^1.15.4",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ const {
|
|||
copyTreeSitterWasms,
|
||||
copyTreeSitterTagQryFiles,
|
||||
copyNodeModules,
|
||||
downloadEsbuildBinary,
|
||||
downloadRipgrepBinary,
|
||||
copySqliteBinary,
|
||||
installNodeModuleInTempDirAndCopyToCurrent,
|
||||
|
|
@ -116,12 +115,6 @@ async function package(target, os, arch, exe) {
|
|||
lancePackageToInstall,
|
||||
"@lancedb",
|
||||
);
|
||||
// *** esbuild ***
|
||||
// await installNodeModuleInTempDirAndCopyToCurrent(
|
||||
// "esbuild@0.17.19",
|
||||
// "@esbuild",
|
||||
// );
|
||||
await downloadEsbuildBinary(target);
|
||||
|
||||
// *** sqlite ***
|
||||
await downloadSqliteBinary(target);
|
||||
|
|
@ -187,19 +180,11 @@ async function package(target, os, arch, exe) {
|
|||
|
||||
// out/node_modules (to be accessed by extension.js)
|
||||
`out/node_modules/@vscode/ripgrep/bin/rg${exe}`,
|
||||
`out/node_modules/@esbuild/${
|
||||
target === "win32-arm64"
|
||||
? "esbuild.exe"
|
||||
: target === "win32-x64"
|
||||
? "win32-x64/esbuild.exe"
|
||||
: `${target}/bin/esbuild`
|
||||
}`,
|
||||
`out/node_modules/@lancedb/vectordb-${
|
||||
os === "win32"
|
||||
? "win32-x64-msvc"
|
||||
: `${target}${os === "linux" ? "-gnu" : ""}`
|
||||
}/index.node`,
|
||||
`out/node_modules/esbuild/lib/main.js`,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const {
|
|||
autodetectPlatformAndArch,
|
||||
} = require("../../../scripts/util/index");
|
||||
|
||||
const { copySqlite, copyEsbuild } = require("./download-copy-sqlite-esbuild");
|
||||
const { copySqlite } = require("./download-copy-sqlite-esbuild");
|
||||
const { generateAndCopyConfigYamlSchema } = require("./generate-copy-config");
|
||||
const { installAndCopyNodeModules } = require("./install-copy-nodemodule");
|
||||
const { npmInstall } = require("./npm-install");
|
||||
|
|
@ -303,14 +303,9 @@ void (async () => {
|
|||
);
|
||||
|
||||
await Promise.all([
|
||||
copyEsbuild(target),
|
||||
copySqlite(target),
|
||||
installAndCopyNodeModules(packageToInstall, "@lancedb"),
|
||||
]);
|
||||
} else {
|
||||
// Download esbuild from npm in tmp and copy over
|
||||
console.log("[info] npm installing esbuild binary");
|
||||
await installAndCopyNodeModules("esbuild@0.17.19", "@esbuild");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -349,13 +344,7 @@ void (async () => {
|
|||
});
|
||||
|
||||
// Copy node_modules for pre-built binaries
|
||||
const NODE_MODULES_TO_COPY = [
|
||||
"esbuild",
|
||||
"@esbuild",
|
||||
"@lancedb",
|
||||
"@vscode/ripgrep",
|
||||
"workerpool",
|
||||
];
|
||||
const NODE_MODULES_TO_COPY = ["@lancedb", "@vscode/ripgrep", "workerpool"];
|
||||
|
||||
fs.mkdirSync("out/node_modules", { recursive: true });
|
||||
|
||||
|
|
@ -382,9 +371,6 @@ void (async () => {
|
|||
),
|
||||
);
|
||||
|
||||
// delete esbuild/bin because platform-specific @esbuild is downloaded
|
||||
fs.rmSync(`out/node_modules/esbuild/bin`, { recursive: true });
|
||||
|
||||
console.log(`[info] Copied ${NODE_MODULES_TO_COPY.join(", ")}`);
|
||||
|
||||
// Copy over any worker files
|
||||
|
|
@ -442,15 +428,7 @@ void (async () => {
|
|||
|
||||
// out/node_modules (to be accessed by extension.js)
|
||||
`out/node_modules/@vscode/ripgrep/bin/rg${exe}`,
|
||||
`out/node_modules/@esbuild/${
|
||||
target === "win32-arm64"
|
||||
? "esbuild.exe"
|
||||
: target === "win32-x64"
|
||||
? "win32-x64/esbuild.exe"
|
||||
: `${target}/bin/esbuild`
|
||||
}`,
|
||||
`out/node_modules/@lancedb/vectordb-${target}${isWinTarget ? "-msvc" : ""}${isLinuxTarget ? "-gnu" : ""}/index.node`,
|
||||
`out/node_modules/esbuild/lib/main.js`,
|
||||
]);
|
||||
|
||||
console.log(
|
||||
|
|
|
|||
|
|
@ -198,13 +198,7 @@ async function copyNodeModules() {
|
|||
// Copy node_modules for pre-built binaries
|
||||
process.chdir(path.join(continueDir, "extensions", "vscode"));
|
||||
|
||||
const NODE_MODULES_TO_COPY = [
|
||||
"esbuild",
|
||||
"@esbuild",
|
||||
"@lancedb",
|
||||
"@vscode/ripgrep",
|
||||
"workerpool",
|
||||
];
|
||||
const NODE_MODULES_TO_COPY = ["@lancedb", "@vscode/ripgrep", "workerpool"];
|
||||
fs.mkdirSync("out/node_modules", { recursive: true });
|
||||
|
||||
await Promise.all(
|
||||
|
|
@ -230,82 +224,9 @@ async function copyNodeModules() {
|
|||
),
|
||||
);
|
||||
|
||||
// delete esbuild/bin because platform-specific @esbuild is downloaded
|
||||
fs.rmdirSync(`out/node_modules/esbuild/bin`, { recursive: true });
|
||||
|
||||
console.log(`[info] Copied ${NODE_MODULES_TO_COPY.join(", ")}`);
|
||||
}
|
||||
|
||||
// async function downloadEsbuildBinary(isGhAction, isArm, target) {
|
||||
// process.chdir(path.join(continueDir, "extensions", "vscode"));
|
||||
|
||||
// if (isGhAction && isArm) {
|
||||
// // Download and unzip esbuild
|
||||
// console.log("[info] Downloading pre-built esbuild binary");
|
||||
// rimrafSync("node_modules/@esbuild");
|
||||
// fs.mkdirSync("node_modules/@esbuild", { recursive: true });
|
||||
// execCmdSync(
|
||||
// `curl -o node_modules/@esbuild/esbuild.zip https://continue-server-binaries.s3.us-west-1.amazonaws.com/${target}/esbuild.zip`,
|
||||
// );
|
||||
// execCmdSync(`cd node_modules/@esbuild && unzip esbuild.zip`);
|
||||
// fs.unlinkSync("node_modules/@esbuild/esbuild.zip");
|
||||
// } else {
|
||||
// // Download esbuild from npm in tmp and copy over
|
||||
// console.log("npm installing esbuild binary");
|
||||
// await installNodeModuleInTempDirAndCopyToCurrent(
|
||||
// "esbuild@0.17.19",
|
||||
// "@esbuild",
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
async function downloadEsbuildBinary(target) {
|
||||
console.log("[info] Downloading pre-built esbuild binary");
|
||||
rimrafSync("out/node_modules/@esbuild");
|
||||
fs.mkdirSync(`out/node_modules/@esbuild/${target}/bin`, { recursive: true });
|
||||
fs.mkdirSync(`out/tmp`, { recursive: true });
|
||||
const downloadUrl = {
|
||||
"darwin-arm64":
|
||||
"https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz",
|
||||
"linux-arm64":
|
||||
"https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz",
|
||||
"win32-arm64":
|
||||
"https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz",
|
||||
"linux-x64":
|
||||
"https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz",
|
||||
"darwin-x64":
|
||||
"https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz",
|
||||
"win32-x64":
|
||||
"https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz",
|
||||
}[target];
|
||||
execCmdSync(`curl -L -o out/tmp/esbuild.tgz ${downloadUrl}`);
|
||||
execCmdSync("cd out/tmp && tar -xvzf esbuild.tgz");
|
||||
// Copy the installed package back to the current directory
|
||||
let tmpPath = "out/tmp/package/bin";
|
||||
let outPath = `out/node_modules/@esbuild/${target}/bin`;
|
||||
if (target.startsWith("win")) {
|
||||
tmpPath = "out/tmp/package";
|
||||
outPath = `out/node_modules/@esbuild/${target}`;
|
||||
}
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
ncp(
|
||||
path.join(tmpPath),
|
||||
path.join(outPath),
|
||||
{ dereference: true },
|
||||
(error) => {
|
||||
if (error) {
|
||||
console.error(`[error] Error copying esbuild package`, error);
|
||||
reject(error);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
rimrafSync("out/tmp");
|
||||
}
|
||||
|
||||
async function downloadSqliteBinary(target) {
|
||||
console.log("[info] Downloading pre-built sqlite3 binary");
|
||||
rimrafSync("../../core/node_modules/sqlite3/build");
|
||||
|
|
@ -477,7 +398,6 @@ module.exports = {
|
|||
copyTreeSitterWasms,
|
||||
copyTreeSitterTagQryFiles,
|
||||
copyNodeModules,
|
||||
downloadEsbuildBinary,
|
||||
copySqliteBinary,
|
||||
installNodeModuleInTempDirAndCopyToCurrent,
|
||||
downloadSqliteBinary,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue