76b5208b11
Docker Release / build-amd64 (push) Failing after 36s
Workflow Sanity / no-tabs (push) Failing after 31s
CI / install-check (push) Has been cancelled
CI / checks (bunx tsc -p tsconfig.json --noEmit false, bun, build) (push) Has been cancelled
CI / checks (pnpm build, node, build) (push) Has been cancelled
CI / checks (pnpm canvas:a2ui:bundle && bunx vitest run, bun, test) (push) Has been cancelled
CI / checks (pnpm canvas:a2ui:bundle && pnpm test, node, test) (push) Has been cancelled
CI / checks (pnpm format, node, format) (push) Has been cancelled
CI / checks (pnpm lint, node, lint) (push) Has been cancelled
CI / checks (pnpm protocol:check, node, protocol) (push) Has been cancelled
CI / checks (pnpm tsgo, node, tsgo) (push) Has been cancelled
CI / secrets (push) Has been cancelled
CI / checks-windows (pnpm build, node, build) (push) Has been cancelled
CI / checks-windows (pnpm canvas:a2ui:bundle && pnpm test, node, test) (push) Has been cancelled
CI / checks-windows (pnpm lint, node, lint) (push) Has been cancelled
CI / checks-windows (pnpm protocol:check, node, protocol) (push) Has been cancelled
CI / checks-macos (pnpm test, test) (push) Has been cancelled
CI / macos-app (set -euo pipefail
for attempt in 1 2 3; do
if swift build --package-path apps/macos --configuration release; then
exit 0
fi
echo "swift build failed (attempt $attempt/3). Retrying…"
sleep $((attempt * 20))
done
exit 1
, build) (push) Has been cancelled
CI / macos-app (set -euo pipefail
for attempt in 1 2 3; do
if swift test --package-path apps/macos --parallel --enable-code-coverage --show-codecov-path; then
exit 0
fi
echo "swift test failed (attempt $attempt/3). Retrying…"
sleep $((attempt *… (push) Has been cancelled
CI / macos-app (swiftlint --config .swiftlint.yml
swiftformat --lint apps/macos/Sources --config .swiftformat
, lint) (push) Has been cancelled
CI / ios (push) Has been cancelled
CI / android (./gradlew --no-daemon :app:assembleDebug, build) (push) Has been cancelled
CI / android (./gradlew --no-daemon :app:testDebugUnitTest, test) (push) Has been cancelled
Docker Release / build-arm64 (push) Has been cancelled
Docker Release / create-manifest (push) Has been cancelled
127 lines
3.2 KiB
JavaScript
127 lines
3.2 KiB
JavaScript
#!/usr/bin/env node
|
|
import { spawn, spawnSync } from "node:child_process";
|
|
import fs from "node:fs";
|
|
import { createRequire } from "node:module";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
const repoRoot = path.resolve(here, "..");
|
|
const uiDir = path.join(repoRoot, "ui");
|
|
|
|
function usage() {
|
|
// keep this tiny; it's invoked from npm scripts too
|
|
process.stderr.write("Usage: node scripts/ui.js <install|dev|build|test> [...args]\n");
|
|
}
|
|
|
|
function which(cmd) {
|
|
try {
|
|
const key = process.platform === "win32" ? "Path" : "PATH";
|
|
const paths = (process.env[key] ?? process.env.PATH ?? "")
|
|
.split(path.delimiter)
|
|
.filter(Boolean);
|
|
const extensions =
|
|
process.platform === "win32"
|
|
? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean)
|
|
: [""];
|
|
for (const entry of paths) {
|
|
for (const ext of extensions) {
|
|
const candidate = path.join(entry, process.platform === "win32" ? `${cmd}${ext}` : cmd);
|
|
try {
|
|
if (fs.existsSync(candidate)) return candidate;
|
|
} catch {
|
|
// ignore
|
|
}
|
|
}
|
|
}
|
|
} catch {
|
|
// ignore
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function resolveRunner() {
|
|
const pnpm = which("pnpm");
|
|
if (pnpm) return { cmd: pnpm, kind: "pnpm" };
|
|
return null;
|
|
}
|
|
|
|
function run(cmd, args) {
|
|
const child = spawn(cmd, args, {
|
|
cwd: uiDir,
|
|
stdio: "inherit",
|
|
env: process.env,
|
|
shell: process.platform === "win32",
|
|
});
|
|
child.on("exit", (code, signal) => {
|
|
if (signal) process.exit(1);
|
|
process.exit(code ?? 1);
|
|
});
|
|
}
|
|
|
|
function runSync(cmd, args, envOverride) {
|
|
const result = spawnSync(cmd, args, {
|
|
cwd: uiDir,
|
|
stdio: "inherit",
|
|
env: envOverride ?? process.env,
|
|
shell: process.platform === "win32",
|
|
});
|
|
if (result.signal) process.exit(1);
|
|
if ((result.status ?? 1) !== 0) process.exit(result.status ?? 1);
|
|
}
|
|
|
|
function depsInstalled(kind) {
|
|
try {
|
|
const require = createRequire(path.join(uiDir, "package.json"));
|
|
require.resolve("vite");
|
|
require.resolve("dompurify");
|
|
if (kind === "test") {
|
|
require.resolve("vitest");
|
|
require.resolve("@vitest/browser-playwright");
|
|
require.resolve("playwright");
|
|
}
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
const [, , action, ...rest] = process.argv;
|
|
if (!action) {
|
|
usage();
|
|
process.exit(2);
|
|
}
|
|
|
|
const runner = resolveRunner();
|
|
if (!runner) {
|
|
process.stderr.write("Missing UI runner: install pnpm, then retry.\n");
|
|
process.exit(1);
|
|
}
|
|
|
|
const script =
|
|
action === "install"
|
|
? null
|
|
: action === "dev"
|
|
? "dev"
|
|
: action === "build"
|
|
? "build"
|
|
: action === "test"
|
|
? "test"
|
|
: null;
|
|
|
|
if (action !== "install" && !script) {
|
|
usage();
|
|
process.exit(2);
|
|
}
|
|
|
|
if (action === "install") run(runner.cmd, ["install", ...rest]);
|
|
else {
|
|
if (!depsInstalled(action === "test" ? "test" : "build")) {
|
|
const installEnv =
|
|
action === "build" ? { ...process.env, NODE_ENV: "production" } : process.env;
|
|
const installArgs = action === "build" ? ["install", "--prod"] : ["install"];
|
|
runSync(runner.cmd, installArgs, installEnv);
|
|
}
|
|
run(runner.cmd, ["run", script, ...rest]);
|
|
}
|