Devesh36/clear-mouse

A transparent, right-handed wireless mouse assembly with a 44×58 mm control PCB, LiPo battery, optical sensor, click buttons, scroll encoder, DPI/middle buttons, USB‑C charging, and 3D‑printed housing/mechanical hardware.

Version
0.1.5
License
unset
Stars
0

Use with the tscircuit CLI

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

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

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/build.ts

import { rm } from "node:fs/promises";
let failed = false;
for (const entry of [
	"controls",
	"index",
	"assembly",
	"exploded",
	"system-overview",
]) {
	await rm(`dist/${entry}`, { recursive: true, force: true });
	const args = [
		"bun",
		"node_modules/.bin/tsci",
		"build",
		`${entry}.circuit.tsx`,
		"--ignore-config",
		"--svgs",
	];
	if (entry !== "system-overview") args.push("--pcb-png", "--3d-png", "--glbs");
	const p = Bun.spawn(args, { stdout: "inherit", stderr: "inherit" });
	if ((await p.exited) !== 0) failed = true;
	if (entry === "controls") {
		const model = Bun.spawn(["bun", "scripts/prepare-controls-model.ts"], {
			stdout: "inherit",
			stderr: "inherit",
		});
		if ((await model.exited) !== 0)
			throw Error("Control PCB model export failed");
	}
	if (!(await Bun.file(`dist/${entry}/circuit.json`).exists()))
		throw Error(`No circuit output for ${entry}`);
}
const bom = Bun.spawn(["bun", "scripts/bom.ts"], {
	stdout: "inherit",
	stderr: "inherit",
});
if ((await bom.exited) !== 0) failed = true;
const sheets = Bun.spawn(["bun", "scripts/export-schematics.ts"], {
	stdout: "inherit",
	stderr: "inherit",
});
if ((await sheets.exited) !== 0) failed = true;
process.exit(failed ? 1 : 0);