Devesh36/bench-eight

Eight-channel 0–10 V measurement and control console: dual ADS1115 ADCs, buffered inputs, Pico controller, microSD, RTC, RS-485, four protected low-voltage outputs and a separate OLED/encoder panel in a tscircuit assembly.

Version
0.1.3
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone Devesh36/bench-eight  # download the package files into ./bench-eight
tsci add Devesh36/bench-eight    # add it to your project as @tsci/Devesh36.bench-eight

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

scripts/check.ts

export {};
let failed = false;
for (const entry of ["index", "ui"]) {
	for (const kind of [
		"netlist",
		"pin_specification",
		"placement",
		"shorts",
		"schematic-placement",
		"pcb-style",
	]) {
		const path = ["netlist", "pin_specification"].includes(kind)
			? `${entry}.circuit.tsx`
			: `dist/${entry}/circuit.json`;
		console.log(`\nChecking ${entry}: ${kind}`);
		const proc = Bun.spawn(
			["bun", "node_modules/.bin/tsci", "check", kind, path],
			{ stdout: "inherit", stderr: "inherit" },
		);
		if ((await proc.exited) !== 0) failed = true;
	}
}
for (const entry of ["index", "ui", "assembly", "exploded"]) {
	const data = await Bun.file(`dist/${entry}/circuit.json`).json();
	const errors = data.filter((x: { type: string }) =>
		x.type.endsWith("_error"),
	);
	const warnings = data.filter((x: { type: string }) =>
		x.type.endsWith("_warning"),
	);
	console.log(
		`${entry}: ${errors.length} circuit errors, ${warnings.length} warnings`,
	);
	if (errors.length) failed = true;
}
process.exit(failed ? 1 : 0);