easyeda 0.0.22 → 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.20",
29179
+ version: "0.0.22",
29180
29180
  files: ["dist"],
29181
29181
  repository: {
29182
29182
  type: "git",
@@ -29669,9 +29669,21 @@ program.command("convert").description("Convert EasyEDA JSON to various formats"
29669
29669
  } else {
29670
29670
  rawEasyEdaJson = await fetchEasyEDAComponent(options.input);
29671
29671
  }
29672
- if (options.type === "ts") options.type = "tsx";
29672
+ const tsxExtension = "tsx";
29673
+ if (options.type === "ts") options.type = tsxExtension;
29673
29674
  if (!options.output && options.type) {
29674
- 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}`;
29675
29687
  }
29676
29688
  if (!options.output) {
29677
29689
  console.log("specify --output file (-o) or --type (-t)");