rushabhcodes/wireless-split-keyboard

Wireless Split Keyboard — custom routed nRF52840 split PCBs with a printable enclosure

Version
0.4.5
License
unset
Stars
0

Use with the tscircuit CLI

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

tsci clone rushabhcodes/wireless-split-keyboard  # download the package files into ./wireless-split-keyboard
tsci add rushabhcodes/wireless-split-keyboard    # add it to your project as @tsci/rushabhcodes.wireless-split-keyboard

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/input-hash.ts

import { createHash } from 'node:crypto'
import { readdirSync, readFileSync } from 'node:fs'
function sources(dir: string): string[] {
  return readdirSync(dir, { withFileTypes: true }).flatMap(entry => {
    const path = `${dir}/${entry.name}`
    return entry.isDirectory() ? sources(path) : /\.(tsx?|json|patch)$/.test(path) ? [path] : []
  })
}
export function inputHash() {
  const files = [...sources('src'), ...sources('imports'), ...sources('patches'), 'index.tsx', 'left.circuit.tsx', 'right.circuit.tsx', 'stand.circuit.tsx', 'tsconfig.json', 'tscircuit.config.json', 'package.json', 'bun.lock'].sort()
  const hash = createHash('sha256')
  for (const path of files) hash.update(path).update('\0').update(readFileSync(path)).update('\0')
  return { sha256: hash.digest('hex'), files }
}