Updating install and deploy commands for new potential way of distribution

This commit is contained in:
Ryan Ward
2026-08-26 12:12:09 -05:00
parent 82eed08683
commit 596614e0d3
2 changed files with 48 additions and 22 deletions
+18 -5
View File
@@ -52,21 +52,34 @@ function runCommandStreaming(
stdio: ["ignore", "pipe", "pipe"], stdio: ["ignore", "pipe", "pipe"],
}); });
const createChunkProcessor = () => {
let leftover = ""; let leftover = "";
const processChunk = (chunk: Buffer) => { return {
process(chunk: Buffer) {
const text = leftover + chunk.toString(); const text = leftover + chunk.toString();
const lines = text.split("\n"); // Cargo renders progress with carriage returns when attached to a terminal. Treat both
// carriage returns and newlines as line boundaries so build output appears live in Ink.
const lines = text.split(/\r\n|\r|\n/);
leftover = lines.pop() || ""; leftover = lines.pop() || "";
for (const line of lines) { for (const line of lines) {
if (line.trim()) onLog(line); if (line.trim()) onLog(line);
} }
},
flush() {
if (leftover.trim()) onLog(leftover);
leftover = "";
},
}; };
};
const stdout = createChunkProcessor();
const stderr = createChunkProcessor();
child.stdout?.on("data", processChunk); child.stdout?.on("data", (chunk: Buffer) => stdout.process(chunk));
child.stderr?.on("data", processChunk); child.stderr?.on("data", (chunk: Buffer) => stderr.process(chunk));
child.on("close", (code) => { child.on("close", (code) => {
if (leftover.trim()) onLog(leftover); stdout.flush();
stderr.flush();
if (code === 0) resolve(); if (code === 0) resolve();
else reject(new Error(`Command failed with exit code ${code}`)); else reject(new Error(`Command failed with exit code ${code}`));
}); });
@@ -36,21 +36,34 @@ function runCommandStreaming(
stdio: ["ignore", "pipe", "pipe"], stdio: ["ignore", "pipe", "pipe"],
}); });
const createChunkProcessor = () => {
let leftover = ""; let leftover = "";
const processChunk = (chunk: Buffer) => { return {
process(chunk: Buffer) {
const text = leftover + chunk.toString(); const text = leftover + chunk.toString();
const lines = text.split("\n"); // Cargo renders progress with carriage returns when attached to a terminal. Treat both
// carriage returns and newlines as line boundaries so build output appears live in Ink.
const lines = text.split(/\r\n|\r|\n/);
leftover = lines.pop() || ""; leftover = lines.pop() || "";
for (const line of lines) { for (const line of lines) {
if (line.trim()) onLog(line); if (line.trim()) onLog(line);
} }
},
flush() {
if (leftover.trim()) onLog(leftover);
leftover = "";
},
}; };
};
const stdout = createChunkProcessor();
const stderr = createChunkProcessor();
child.stdout?.on("data", processChunk); child.stdout?.on("data", (chunk: Buffer) => stdout.process(chunk));
child.stderr?.on("data", processChunk); child.stderr?.on("data", (chunk: Buffer) => stderr.process(chunk));
child.on("close", (code) => { child.on("close", (code) => {
if (leftover.trim()) onLog(leftover); stdout.flush();
stderr.flush();
if (code === 0) resolve(); if (code === 0) resolve();
else reject(new Error(`Command failed with exit code ${code}`)); else reject(new Error(`Command failed with exit code ${code}`));
}); });