easyeda 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +59 -0
  2. package/ai-assist-docs/soup-reference.md +1325 -0
  3. package/bun.lockb +0 -0
  4. package/cli/main.ts +67 -0
  5. package/dist/cli/main.cjs +29264 -0
  6. package/dist/cli/main.cjs.map +1 -0
  7. package/dist/cli/main.d.cts +1 -0
  8. package/dist/index.cjs +29196 -0
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.cts +1553 -0
  11. package/dist/lib/index.cjs +29196 -0
  12. package/dist/lib/index.cjs.map +1 -0
  13. package/dist/lib/index.d.cts +1553 -0
  14. package/lib/convert-easyeda-json-to-tscircuit-soup-json.ts +204 -0
  15. package/lib/fetch-easyeda-json.ts +66 -0
  16. package/lib/index.ts +2 -0
  17. package/lib/math/arc-utils.ts +170 -0
  18. package/lib/schemas/easy-eda-json-schema.ts +158 -0
  19. package/lib/schemas/package-detail-shape-schema.ts +251 -0
  20. package/lib/schemas/single-letter-shape-schema.ts +201 -0
  21. package/package.json +31 -0
  22. package/renovate.json +6 -0
  23. package/scripts/get-easyeda-json.ts +12 -0
  24. package/tests/assets/a555-timer-dip.raweasy.json +244 -0
  25. package/tests/assets/a555-timer-smd.raweasy.json +226 -0
  26. package/tests/assets/esp32.raweasy.json +333 -0
  27. package/tests/assets/usb-c.raweasy.json +263 -0
  28. package/tests/convert-to-soup-tests/a555timer-smd.test.ts +18 -0
  29. package/tests/convert-to-soup-tests/convert-easyeda-to-tscircuit-soup.test.ts +49 -0
  30. package/tests/convert-to-soup-tests/convert-usb-c-to-soup.test.ts +18 -0
  31. package/tests/convert-to-soup-tests/esp32-to-soup.test.ts +13 -0
  32. package/tests/parse-tests/parse-555-timer-json.test.ts +9 -0
  33. package/tests/parse-tests/parse-esp32.test.ts +9 -0
  34. package/tests/parse-tests/parse-usb-c.test.ts +9 -0
  35. package/tests/parse-tests/single-letter-shape-schema.test.ts +30 -0
  36. package/tsconfig.json +28 -0
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # easyeda-converter
2
+
3
+ > [!WARNING]
4
+ > This library is a work in progress! Not everything works yet!
5
+
6
+ Convert easyeda JSON PCB footprints into [tscircuit json soup](https://docs.tscircuit.com/api-reference/advanced/soup)
7
+
8
+ ## Library Usage
9
+
10
+ ```ts
11
+ import {
12
+ fetchEasyEDAComponent,
13
+ convertEasyEdaJsonToTscircuitSoupJson,
14
+ } from "easyeda-converter"
15
+
16
+ // get raweasy json
17
+ const rawEasyJson = await fetchEasyEDAComponent("C46749")
18
+
19
+ // convert to tscircuit soup
20
+ const soupJson = convertEasyEdaJsonToTscircuitSoupJson(rawEasyJson)
21
+ ```
22
+
23
+ ## CLI
24
+
25
+ Install the CLI with `npm install -g easyeda`, you can then call
26
+ the cli with either `easyeda` or `easyeda-converter`.
27
+
28
+ ```sh
29
+ # Convert a schematic and footprint for JLCPCB part number C46749 (NE555) to tscircuit component
30
+ easyeda convert -i C46749 -o C46749.ts
31
+
32
+ # Convert a footprint and schematic for JLCPCB part number C46749 (NE555) to tscircuit soup JSON
33
+ # More info: https://docs.tscircuit.com/api-reference/advanced/soup
34
+ easyeda convert -i C46749 -o C46749.soup.json
35
+
36
+ # Convert a footprint for JLCPCB part number C46749 (NE555) to KiCad footprint
37
+ easyeda convert -i C46749 -o C46749.kicad_mod
38
+
39
+ # Download the C46749 footprint and schematic and convert to readable JSON
40
+ easyeda convert -i C46749 -o C46749.bettereasy.json
41
+
42
+ # Can also convert from files!
43
+ easyeda convert -i ./C46749.raweasy.json -o C46749.soup.json
44
+
45
+ # Get exactly what is returned from the JLC API
46
+ # The footprint, schematic and some other data is encoded in strings, you
47
+ # probably want to convert to *.bettereasy.json
48
+ easyeda download -i C46749 -o C46749.raweasy.json
49
+ ```
50
+
51
+ ## File Formats
52
+
53
+ | Format | Description |
54
+ | ------------------- | -------------------------------------------------------------------------------------------------------- |
55
+ | `*.raweasy.json` | The raw JSON from the EasyEDA API |
56
+ | `*.bettereasy.json` | The raw JSON from the EasyEDA API, but with the footprint and schematic data decoded |
57
+ | `*.soup.json` | The tscircuit's easy-to-use JSON format [(docs)](https://docs.tscircuit.com/api-reference/advanced/soup) |
58
+ | `*.kicad_mod` | A KiCad footprint file |
59
+ | `*.ts` | A tscircuit component file |