easyeda 0.0.21 → 0.0.23

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
@@ -29176,7 +29176,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
29176
29176
  var package_default = {
29177
29177
  name: "easyeda",
29178
29178
  type: "module",
29179
- version: "0.0.19",
29179
+ version: "0.0.22",
29180
29180
  files: ["dist"],
29181
29181
  repository: {
29182
29182
  type: "git",
@@ -29629,7 +29629,9 @@ var convertToTypescriptComponent = ({
29629
29629
  const hole = (0, import_soup_util2.su)(soup).pcb_hole.list();
29630
29630
  const pinLabels = {};
29631
29631
  easyEdaJson.dataStr.shape.filter((shape) => shape.type === "PIN").forEach((pin) => {
29632
- pinLabels[pin.pinNumber.toString()] = pin.label;
29632
+ const isPinLabelNumeric = /^\d+$/.test(pin.label);
29633
+ const label = isPinLabelNumeric ? `pin${pin.label}` : pin.label;
29634
+ pinLabels[pin.pinNumber.toString()] = label;
29633
29635
  });
29634
29636
  const pins = easyEdaJson.dataStr.shape.filter((shape) => shape.type === "PIN");
29635
29637
  const leftPins = pins.filter((pin) => pin.rotation === 180);
@@ -29667,9 +29669,21 @@ program.command("convert").description("Convert EasyEDA JSON to various formats"
29667
29669
  } else {
29668
29670
  rawEasyEdaJson = await fetchEasyEDAComponent(options.input);
29669
29671
  }
29670
- if (options.type === "ts") options.type = "tsx";
29672
+ const tsxExtension = "tsx";
29673
+ if (options.type === "ts") options.type = tsxExtension;
29671
29674
  if (!options.output && options.type) {
29672
- options.output = `${path.basename(options.input).split(".")[0]}.${options.type}`;
29675
+ let filename = path.basename(options.input).split(".")[0];
29676
+ if (options.type === tsxExtension) {
29677
+ const {
29678
+ dataStr: {
29679
+ head: {
29680
+ c_para: { "Manufacturer Part": manufacturerPartNumber }
29681
+ }
29682
+ }
29683
+ } = rawEasyEdaJson;
29684
+ filename = normalizeManufacturerPartNumber(manufacturerPartNumber);
29685
+ }
29686
+ options.output = `${filename}.${options.type}`;
29673
29687
  }
29674
29688
  if (!options.output) {
29675
29689
  console.log("specify --output file (-o) or --type (-t)");