0.0.123 • Published 12 months ago

easyeda v0.0.123

Weekly downloads
-
License
-
Repository
github
Last release
12 months ago

easyeda-converter

Convert EasyEDA JSON PCB footprints into Circuit JSON or TypeScript React components.

npm install -g easyeda

Library Usage

Fetching EasyEDA Component Data

import { fetchEasyEDAComponent } from "easyeda"

// Get raw EasyEDA JSON for a component
const rawEasyJson = await fetchEasyEDAComponent("C46749")

Converting to Circuit JSON

import { convertEasyEdaJsonToCircuitJson } from "easyeda"

// Convert to tscircuit soup
const soupJson = convertEasyEdaJsonToCircuitJson(rawEasyJson)

Converting to TypeScript React Component

import { convertRawEasyEdaToTs } from "easyeda"

// Convert to TypeScript React component
const tsxComponent = await convertRawEasyEdaToTs(rawEasyJson)

Full Example: Fetching and Converting to TSX

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)

CLI

Install the CLI with npm install -g easyeda, you can then call the cli with either easyeda or easyeda-converter.

# Convert 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

# Convert a footprint and schematic for JLCPCB part number C46749 (NE555) to tscircuit soup JSON
# More info: https://docs.tscircuit.com/api-reference/advanced/soup
easyeda convert -i C46749 -o C46749.soup.json

# Convert a footprint for JLCPCB part number C46749 (NE555) to KiCad footprint
easyeda convert -i C46749 -o C46749.kicad_mod

# Download the C46749 footprint and schematic and convert to readable JSON
easyeda convert -i C46749 -o C46749.bettereasy.json

# Can also convert from files!
easyeda convert -i ./C46749.raweasy.json -o C46749.soup.json

# Get exactly what is returned from the JLC API
# The footprint, schematic and some other data is encoded in strings, you
# probably want to convert to *.bettereasy.json
easyeda download -i C46749 -o C46749.raweasy.json

File Formats

FormatDescription
*.raweasy.jsonThe raw JSON from the EasyEDA API
*.bettereasy.jsonThe raw JSON from the EasyEDA API, but with the footprint and schematic data decoded
*.circuit.jsonThe tscircuit's easy-to-use JSON format (docs)
*.kicad_modA KiCad footprint file
*.tsxA TypeScript React component file

Advanced Usage

Customizing Conversion Options

When converting EasyEDA JSON to tscircuit soup, you can pass additional options:

import { convertEasyEdaJsonToCircuitJson } from "easyeda"

const soupJson = convertEasyEdaJsonToCircuitJson(rawEasyJson, {
  useModelCdn: true, // Use CDN for 3D models
  shouldRecenter: false, // Don't recenter the component
})

Working with Generated TypeScript Components

The generated TypeScript React components can be imported and used in your tscircuit projects:

import { NE555 } from "./NE555"

const MyCircuit = () => {
  return (
    <circuit>
      <NE555 name="U1" />
      {/* Other components */}
    </circuit>
  )
}

These components include proper typing for props and integrate seamlessly with the tscircuit ecosystem.

Development

Adding a test for a new part

Just run the following command. Use git status to see the files it introduces.

bun run add-test-for-part C46749

You can then run the test with bun test path/to/file.test.ts until you can successfully get the part working!

0.0.123

12 months ago

0.0.122

12 months ago

0.0.121

12 months ago

0.0.120

12 months ago

0.0.119

1 year ago

0.0.117

1 year ago

0.0.116

1 year ago

0.0.118

1 year ago

0.0.115

1 year ago

0.0.114

1 year ago

0.0.113

1 year ago

0.0.112

1 year ago

0.0.111

1 year ago

0.0.110

1 year ago

0.0.109

1 year ago

0.0.108

1 year ago

0.0.107

1 year ago

0.0.106

1 year ago

0.0.105

1 year ago

0.0.104

1 year ago

0.0.103

1 year ago

0.0.102

1 year ago

0.0.101

1 year ago

0.0.100

1 year ago

0.0.95

1 year ago

0.0.96

1 year ago

0.0.97

1 year ago

0.0.98

1 year ago

0.0.99

1 year ago

0.0.88

1 year ago

0.0.89

1 year ago

0.0.90

1 year ago

0.0.91

1 year ago

0.0.92

1 year ago

0.0.93

1 year ago

0.0.94

1 year ago

0.0.87

1 year ago

0.0.84

1 year ago

0.0.85

1 year ago

0.0.86

1 year ago

0.0.82

1 year ago

0.0.83

1 year ago

0.0.80

1 year ago

0.0.81

1 year ago

0.0.75

1 year ago

0.0.76

1 year ago

0.0.77

1 year ago

0.0.78

1 year ago

0.0.79

1 year ago

0.0.73

1 year ago

0.0.74

1 year ago

0.0.70

1 year ago

0.0.71

1 year ago

0.0.72

1 year ago

0.0.67

1 year ago

0.0.68

1 year ago

0.0.69

1 year ago

0.0.62

1 year ago

0.0.63

1 year ago

0.0.64

1 year ago

0.0.65

1 year ago

0.0.66

1 year ago

0.0.60

1 year ago

0.0.61

1 year ago

0.0.59

1 year ago

0.0.58

1 year ago

0.0.55

1 year ago

0.0.56

1 year ago

0.0.57

1 year ago

0.0.51

1 year ago

0.0.52

1 year ago

0.0.53

1 year ago

0.0.54

1 year ago

0.0.50

1 year ago

0.0.49

1 year ago

0.0.40

1 year ago

0.0.41

1 year ago

0.0.42

1 year ago

0.0.43

1 year ago

0.0.44

1 year ago

0.0.45

1 year ago

0.0.46

1 year ago

0.0.47

1 year ago

0.0.37

1 year ago

0.0.38

1 year ago

0.0.39

1 year ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.33

1 year ago

0.0.34

1 year ago

0.0.35

1 year ago

0.0.36

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.48

1 year ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago