easyeda 0.0.2 → 0.0.3

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.
package/bun.lockb DELETED
Binary file
package/cli/main.ts DELETED
@@ -1,67 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from "commander"
4
- import { fetchEasyEDAComponent } from "../lib/fetch-easyeda-json"
5
- import { convertEasyEdaJsonToTscircuitSoupJson } from "../lib/convert-easyeda-json-to-tscircuit-soup-json"
6
- import fs from "fs/promises"
7
- import packageJson from "../package.json"
8
-
9
- const program = new Command()
10
-
11
- program
12
- .name("easyeda-converter")
13
- .description("Convert EasyEDA JSON PCB footprints into tscircuit json soup")
14
- .version(packageJson.version)
15
-
16
- program
17
- .command("convert")
18
- .description("Convert EasyEDA JSON to various formats")
19
- .requiredOption("-i, --input <jlcpcbPartNumber>", "JLCPCB part number")
20
- .requiredOption("-o, --output <filename>", "Output filename")
21
- .action(async (options) => {
22
- try {
23
- const easyEdaJson = await fetchEasyEDAComponent(options.input)
24
- const tscircuitSoup = convertEasyEdaJsonToTscircuitSoupJson(easyEdaJson)
25
-
26
- if (options.output.endsWith(".ts")) {
27
- // TODO: Implement conversion to tscircuit component
28
- console.log("Conversion to tscircuit component not yet implemented")
29
- } else if (options.output.endsWith(".soup.json")) {
30
- await fs.writeFile(
31
- options.output,
32
- JSON.stringify(tscircuitSoup, null, 2)
33
- )
34
- console.log(`Converted to tscircuit soup JSON: ${options.output}`)
35
- } else if (options.output.endsWith(".kicad_mod")) {
36
- // TODO: Implement conversion to KiCad footprint
37
- console.log("Conversion to KiCad footprint not yet implemented")
38
- } else {
39
- console.error("Unsupported output format")
40
- }
41
- } catch (error: any) {
42
- console.error("Error:", error.message)
43
- }
44
- })
45
-
46
- program
47
- .command("download")
48
- .description("Download JSON for footprint")
49
- .requiredOption("-i, --input <jlcpcbPartNumber>", "JLCPCB part number")
50
- .option("-o, --output <filename>", "Output filename")
51
- .action(async (options) => {
52
- if (!options.output) {
53
- options.output = `${options.input}.raweasy.json`
54
- }
55
- try {
56
- const easyEdaJsonRes = await fetchEasyEDAComponent(options.input)
57
- await fs.writeFile(
58
- options.output,
59
- JSON.stringify(easyEdaJsonRes.result, null, 2)
60
- )
61
- console.log(`Downloaded JSON footprint: ${options.output}`)
62
- } catch (error: any) {
63
- console.error("Error:", error.message)
64
- }
65
- })
66
-
67
- program.parse(process.argv)