fix: bundle

This commit is contained in:
Carlos Florêncio
2026-02-15 23:38:08 +00:00
parent e24f65a133
commit 95f1b2e13b
3 changed files with 26 additions and 1 deletions
+8
View File
@@ -5,6 +5,14 @@ import path from "node:path";
export function extractZip(zipPath: string, destDir: string): void {
const zip = new AdmZip(zipPath);
zip.extractAllTo(destDir, true);
// adm-zip doesn't preserve Unix file permissions, so mark binaries executable
const binDir = path.join(destDir, "kandev", "bin");
if (fs.existsSync(binDir)) {
for (const file of fs.readdirSync(binDir)) {
fs.chmodSync(path.join(binDir, file), 0o755);
}
}
}
export function ensureExtracted(zipPath: string, destDir: string): void {
+6
View File
@@ -67,6 +67,12 @@ async function prepareReleaseBundle({
throw new Error(`agentctl binary not found at ${agentctlBin}`);
}
// Ensure binaries are executable (adm-zip doesn't preserve Unix permissions)
if (process.platform !== "win32") {
fs.chmodSync(backendBin, 0o755);
fs.chmodSync(agentctlBin, 0o755);
}
const actualBackendPort = backendPort ?? (await pickAvailablePort(DEFAULT_BACKEND_PORT));
const actualWebPort = webPort ?? (await pickAvailablePort(DEFAULT_WEB_PORT));
const agentctlPort = await pickAvailablePort(DEFAULT_AGENTCTL_PORT);
+12 -1
View File
@@ -17,7 +17,18 @@ fi
rm -rf "$OUT_DIR"
mkdir -p "$OUT_DIR"
cp -R "$WEB_DIR/.next/standalone/." "$OUT_DIR/"
# Copy with symlinks dereferenced so pnpm's .pnpm/ structure survives
# zip/unzip (adm-zip can't handle symlinks). The standalone output may
# contain broken symlinks from partial tracing — --safe-links skips those
# and rsync exits with code 23 (partial transfer), which is expected.
rsync -a --copy-links --safe-links "$WEB_DIR/.next/standalone/" "$OUT_DIR/" || {
rc=$?
if [ "$rc" -eq 23 ]; then
echo "Warning: some broken symlinks were skipped (expected for standalone output)"
else
exit "$rc"
fi
}
mkdir -p "$OUT_DIR/.next"
cp -R "$WEB_DIR/.next/static" "$OUT_DIR/.next/"