Convert EasyEDA JSON PCB footprints into [Circuit JSON](https://github.com/tscircuit/circuit-json) or TypeScript React components.
npm install easyedaConvert EasyEDA JSON PCB footprints into Circuit JSON or TypeScript React components.

``bash`
npm install -g easyeda
`ts
import { fetchEasyEDAComponent } from "easyeda"
// Get raw EasyEDA JSON for a component
const rawEasyJson = await fetchEasyEDAComponent("C46749")
`
`ts
import { convertEasyEdaJsonToCircuitJson } from "easyeda"
// Convert to tscircuit soup
const soupJson = convertEasyEdaJsonToCircuitJson(rawEasyJson)
`
`ts
import { convertRawEasyEdaToTs } from "easyeda"
// Convert to TypeScript React component
const tsxComponent = await convertRawEasyEdaToTs(rawEasyJson)
`
`ts
import { fetchEasyEDAComponent, convertRawEasyEdaToTs } from "easyeda"
async function convertPartNumberToTsx(partNumber: string) {
const rawEasyJson = await fetchEasyEDAComponent(partNumber)
const tsxComponent = await convertRawEasyEdaToTs(rawEasyJson)
return tsxComponent
}
// Usage
const ne555TsxComponent = await convertPartNumberToTsx("C46749")
console.log(ne555TsxComponent)
`
Install the CLI with npm install -g easyeda, you can then calleasyeda
the cli with either or easyeda-converter.
`shConvert a schematic and footprint for JLCPCB part number C46749 (NE555) to tscircuit component
easyeda convert -i C46749 -o C46749.tsx
easyeda convert -i C46749 -t tsx
File Formats
| Format | Description |
| ------------------- | ------------------------------------------------------------------------------------------- |
|
*.raweasy.json | The raw JSON from the EasyEDA API |
| *.bettereasy.json | The raw JSON from the EasyEDA API, but with the footprint and schematic data decoded |
| *.circuit.json | The tscircuit's easy-to-use JSON format (docs) |
| *.kicad_mod | A KiCad footprint file |
| *.tsx | A TypeScript React component file |Advanced Usage
$3
When converting EasyEDA JSON to tscircuit soup, you can pass additional options:
`ts
import { convertEasyEdaJsonToCircuitJson } from "easyeda"const soupJson = convertEasyEdaJsonToCircuitJson(rawEasyJson, {
useModelCdn: true, // Use CDN for 3D models
shouldRecenter: false, // Don't recenter the component
})
`$3
The generated TypeScript React components can be imported and used in your tscircuit projects:
`tsx
import { NE555 } from "./NE555"const MyCircuit = () => {
return (
{/ Other components /}
)
}
`These components include proper typing for props and integrate seamlessly with the tscircuit ecosystem.
Development
$3
Just run the following command. Use
git status to see the files it introduces.`bash
bun run add-test-for-part C46749
`You can then run the test with
bun test path/to/file.test.ts` until you can