chore: prep 0.1.2 release, tidy repo

This commit is contained in:
Aaron
2025-12-13 17:04:32 -05:00
parent 0c69e9bf90
commit b70f4c5f3f
43 changed files with 4259 additions and 4167 deletions

View File

@@ -0,0 +1,38 @@
export function shorten(text, max = 90) {
if (!text || typeof text !== "string") return text;
return text.length > max ? `${text.slice(0, max - 3)}...` : text;
}
export function createReleaseLogger(logUi = () => {}) {
let lines = [];
let lastMessage = null;
const state = { el: null };
function render() {
if (state.el) {
state.el.textContent = lines.join("\n");
state.el.scrollTop = 0;
}
}
function log(msg) {
if (!msg) return;
const plain = msg.trim();
if (plain === lastMessage) return;
lastMessage = plain;
const ts = new Date().toLocaleTimeString();
const line = `${ts} ${msg}`;
lines.unshift(line);
lines = lines.slice(0, 120);
render();
const lvl = msg.toLowerCase().startsWith("error") ? "error" : "info";
logUi(`Update: ${msg}`, lvl);
}
function attach(el) {
state.el = el;
render();
}
return { log, attach, getLines: () => lines.slice() };
}