ShiboSoftwareDev/mspm0g3507-usb-c-dev-board

The circuit assembles a USB-C port with integrated ESD protection, power regulation, UART interface, and microcontroller (MSPM0G3507) with supporting components for USB data lines, CC termination, I2C, SPI, reset circuitry, and indicator LEDs.

Version
1.4.1
License
unset
Stars
0

scripts/sync-gerber-assembly.mjs

import { copyFileSync, mkdtempSync, rmSync } from "node:fs"
import { tmpdir } from "node:os"
import { basename, join, resolve } from "node:path"
import { execFileSync } from "node:child_process"

const zipPath = resolve("outputs/MSPM0G3507_USB_C_JLCPCB_Gerbers.zip")
const bomPath = resolve("outputs/MSPM0G3507_USB_C_JLCPCB_BOM.csv")
const cplPath = resolve("outputs/MSPM0G3507_USB_C_JLCPCB_CPL.csv")
const stagingDirectory = mkdtempSync(join(tmpdir(), "mspm0-gerber-assembly-"))

try {
  const stagedBom = join(stagingDirectory, "bom.csv")
  const stagedCpl = join(stagingDirectory, "pick_and_place.csv")
  copyFileSync(bomPath, stagedBom)
  copyFileSync(cplPath, stagedCpl)
  execFileSync("zip", ["-d", zipPath, basename(stagedBom), basename(stagedCpl)], {
    stdio: "ignore",
  })
  execFileSync("zip", ["-j", zipPath, stagedBom, stagedCpl], { stdio: "ignore" })
  console.log("Synchronized manufacturer-rich BOM and CPL into the Gerber ZIP")
} finally {
  rmSync(stagingDirectory, { recursive: true, force: true })
}