feat: add amd64 node support

This commit is contained in:
2026-08-28 21:19:50 +07:00 Unverified
parent 23b4ccaa80
commit a1c3298f02
10 changed files with 856 additions and 177 deletions
+32 -15
View File
@@ -2,6 +2,17 @@ import { defineCommand } from "citty";
import { getPodContainerName, getPodForDeployment } from "../lib/shared";
import { execClient } from "../lib/k8s";
function prepareInteractiveStdin(): (() => void) | undefined {
if (!process.stdin.isTTY) return;
process.stdin.setRawMode?.(true);
process.stdin.resume();
return () => {
process.stdin.setRawMode?.(false);
process.stdin.pause();
};
}
export const exec = defineCommand({
meta: {
name: "exec",
@@ -23,21 +34,27 @@ export const exec = defineCommand({
const podName = pod.metadata?.name;
if (!podName) throw new Error(`No pod name found for deployment ${deployment}`);
const socket = await execClient.exec(
namespace,
podName,
getPodContainerName(pod),
command,
process.stdout,
process.stderr,
process.stdin,
Boolean(process.stdin.isTTY),
);
const restoreStdin = prepareInteractiveStdin();
await new Promise<void>((resolve, reject) => {
socket.onclose = () => resolve();
socket.onerror = (event: { error?: unknown }) =>
reject(event.error ?? new Error("Exec failed"));
});
try {
const socket = await execClient.exec(
namespace,
podName,
getPodContainerName(pod),
command,
process.stdout,
process.stderr,
process.stdin,
Boolean(process.stdin.isTTY),
);
await new Promise<void>((resolve, reject) => {
socket.onclose = () => resolve();
socket.onerror = (event: { error?: unknown }) =>
reject(event.error ?? new Error("Exec failed"));
});
} finally {
restoreStdin?.();
}
},
});
+34
View File
@@ -0,0 +1,34 @@
import { defineCommand } from "citty";
import { resolve } from "node:path";
import { YAML } from "bun";
import { sortResources } from "../lib/apply";
import { ctx } from "../lib/context";
import { renderResources } from "../lib/render";
function toDocumentYaml(resources: Parameters<typeof sortResources>[0]): string {
return `${sortResources(resources)
.map((resource) => YAML.stringify(resource, null, 2).trimEnd())
.join("\n---\n")}\n`;
}
export const exportCommand = defineCommand({
meta: {
name: "export",
description: "Write rendered manifests to a YAML file",
},
args: {
output: {
type: "string",
alias: "o",
description: "Output YAML file path",
},
},
async run({ args }) {
const { project, compose, cwd } = ctx();
const resources = await renderResources(project, await compose(), cwd);
const outputPath = resolve(cwd, args.output || `${project}.yaml`);
await Bun.write(outputPath, toDocumentYaml(resources));
console.log(outputPath);
},
});