ShiboSoftwareDev/linux-gameboy-advance

Restores PCB assembly metadata by assigning part numbers and 3D CAD models, removing test-point bodies, and validating top-side SMT solder-paste features without altering copper or pads.

Version
1.0.17
License
unset
Stars
0

scripts/cloud-build.mjs

import { spawn } from "node:child_process"

const buildArgs = [
  "build",
  "index.circuit.tsx",
  "--site",
  "--preview-images",
  "--use-cdn-javascript",
  "--disable-parts-engine",
  // Preserve the generated site when the cloud-only geometry reporter emits
  // its synthetic DRC exception. Real validation is performed by the explicit
  // source, netlist, via, and Gerber-shorts checks before publishing.
  "--ignore-errors",
  // The CLI's routing-DRC geometry pass currently crashes on this four-layer
  // board (`relate(shape1, shape2).covered`) after circuit generation.  The
  // project runs its source/netlist/Gerber-shorts verification separately, so
  // skip only that broken reporting pass for the website artifact build.
  "--ignore-routing-drc",
  "--autorouter-timeout",
  "15m",
  "--concurrency",
  "1",
]

const startedAt = Date.now()
const child = spawn(process.platform === "win32" ? "tsci.cmd" : "tsci", buildArgs, {
  env: process.env,
  stdio: "inherit",
})

const heartbeat = setInterval(() => {
  const elapsedSeconds = Math.round((Date.now() - startedAt) / 1000)
  console.log(`[cloud-build] tscircuit is still running (${elapsedSeconds}s elapsed)`)
}, 30_000)

const forwardSignal = (signal) => {
  if (!child.killed) child.kill(signal)
}

process.once("SIGINT", () => forwardSignal("SIGINT"))
process.once("SIGTERM", () => forwardSignal("SIGTERM"))

const exitCode = await new Promise((resolve) => {
  child.once("error", (error) => {
    console.error(`[cloud-build] failed to start tscircuit: ${error.message}`)
    resolve(1)
  })
  child.once("exit", (code, signal) => {
    if (signal) console.error(`[cloud-build] tscircuit stopped by ${signal}`)
    resolve(code ?? 1)
  })
})

clearInterval(heartbeat)
process.exitCode = exitCode