easyeda 0.0.3 → 0.0.4

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/dist/cli/main.cjs CHANGED
@@ -28751,7 +28751,7 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber) {
28751
28751
  throw new Error("Failed to fetch the component details");
28752
28752
  }
28753
28753
  const componentResult = await componentResponse.json();
28754
- return componentResult;
28754
+ return componentResult.result;
28755
28755
  }
28756
28756
 
28757
28757
  // lib/schemas/package-detail-shape-schema.ts
@@ -29168,10 +29168,14 @@ var import_promises = __toESM(require("fs/promises"), 1);
29168
29168
  var package_default = {
29169
29169
  name: "easyeda",
29170
29170
  type: "module",
29171
- version: "0.0.3",
29171
+ version: "0.0.4",
29172
29172
  files: [
29173
29173
  "dist"
29174
29174
  ],
29175
+ repository: {
29176
+ type: "git",
29177
+ url: "https://github.com/tscircuit/easyeda-converter"
29178
+ },
29175
29179
  scripts: {
29176
29180
  test: "bun test",
29177
29181
  build: "tsup lib/index.ts cli/main.ts --dts --sourcemap",
@@ -29204,8 +29208,13 @@ var package_default = {
29204
29208
  var program = new import_commander.Command();
29205
29209
  program.name("easyeda-converter").description("Convert EasyEDA JSON PCB footprints into tscircuit json soup").version(package_default.version);
29206
29210
  program.command("convert").description("Convert EasyEDA JSON to various formats").requiredOption("-i, --input <jlcpcbPartNumber>", "JLCPCB part number").requiredOption("-o, --output <filename>", "Output filename").action(async (options) => {
29211
+ let easyEdaJson;
29212
+ if (options.input.includes(".") || options.input.includes("/")) {
29213
+ easyEdaJson = JSON.parse(await import_promises.default.readFile(options.input, "utf-8"));
29214
+ } else {
29215
+ easyEdaJson = await fetchEasyEDAComponent(options.input);
29216
+ }
29207
29217
  try {
29208
- const easyEdaJson = await fetchEasyEDAComponent(options.input);
29209
29218
  const tscircuitSoup = convertEasyEdaJsonToTscircuitSoupJson(easyEdaJson);
29210
29219
  if (options.output.endsWith(".ts")) {
29211
29220
  console.log("Conversion to tscircuit component not yet implemented");