npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

easyeda

v0.0.94

Published

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

Downloads

5,789

Readme

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

| 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

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.