@tscircuit/cli 0.1.2353 → 0.1.2354

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.js CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/cli/main.js
3
- size: 46947940 bytes
4
- sha256: c628204ed243b2c185f021f5202c0dbee9a1788ed504a69224fa69dd9812bf3e
3
+ size: 46949037 bytes
4
+ sha256: 1022f32d9b7b523ec782bbc5c2530f251e2092bf0e32f7c19f6532aae2c1e3b1
package/dist/lib/index.js CHANGED
@@ -69121,7 +69121,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
69121
69121
  }));
69122
69122
  };
69123
69123
  // package.json
69124
- var version = "0.1.2352";
69124
+ var version = "0.1.2353";
69125
69125
  var package_default = {
69126
69126
  name: "@tscircuit/cli",
69127
69127
  version,
@@ -69175,7 +69175,7 @@ var package_default = {
69175
69175
  "circuit-json-to-fdm-component-box": "^0.0.2",
69176
69176
  "circuit-json-to-footprinter": "^0.0.59",
69177
69177
  "circuit-json-to-gerber": "^0.0.112",
69178
- "circuit-json-to-kicad": "0.0.235",
69178
+ "circuit-json-to-kicad": "0.0.236",
69179
69179
  "circuit-json-to-pnp-csv": "^0.0.18",
69180
69180
  "circuit-json-to-readable-netlist": "^0.0.15",
69181
69181
  "circuit-json-to-spice": "^0.0.45",
@@ -72793,7 +72793,13 @@ function toFileBaseName(sheetName, fallbackIndex) {
72793
72793
  const baseName = sheetName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
72794
72794
  return baseName.length > 0 ? baseName : `sheet_${fallbackIndex + 1}`;
72795
72795
  }
72796
- function buildSchematicSheetPlan(circuitJson) {
72796
+ function getReservedRootFileBaseName(rootFilename) {
72797
+ const normalizedFilename = rootFilename.replaceAll("\\", "/");
72798
+ const filename = normalizedFilename.split("/").pop() ?? normalizedFilename;
72799
+ const filenameWithoutExtension = filename.replace(/\.kicad_sch$/i, "");
72800
+ return toFileBaseName(filenameWithoutExtension, 0);
72801
+ }
72802
+ function buildSchematicSheetPlan(circuitJson, options = {}) {
72797
72803
  const rootUuid = crypto.randomUUID();
72798
72804
  const root = {
72799
72805
  schematicSheetId: null,
@@ -72805,6 +72811,9 @@ function buildSchematicSheetPlan(circuitJson) {
72805
72811
  };
72806
72812
  const schematicSheets = circuitJson.filter((el) => el.type === "schematic_sheet").slice().sort((a, b) => (a.sheet_index ?? 0) - (b.sheet_index ?? 0));
72807
72813
  const usedFileBaseNames = /* @__PURE__ */ new Set(["root"]);
72814
+ if (options.reservedRootFilename) {
72815
+ usedFileBaseNames.add(getReservedRootFileBaseName(options.reservedRootFilename));
72816
+ }
72808
72817
  const children = [];
72809
72818
  for (let index = 0;index < schematicSheets.length; index++) {
72810
72819
  const sheet = schematicSheets[index];
@@ -75356,6 +75365,22 @@ var CircuitJsonToKicadSchConverter = class {
75356
75365
  }
75357
75366
  ];
75358
75367
  }
75368
+ const filenameSafePlan = buildSchematicSheetPlan(this.circuitJson, {
75369
+ reservedRootFilename: options.schematicFilename
75370
+ });
75371
+ let childFilenameChanged = false;
75372
+ for (const [index, child] of this.schematicSheetPlan.children.entries()) {
75373
+ const filenameSafeChild = filenameSafePlan.children[index];
75374
+ if (child.filename !== filenameSafeChild.filename) {
75375
+ child.fileBaseName = filenameSafeChild.fileBaseName;
75376
+ child.filename = filenameSafeChild.filename;
75377
+ childFilenameChanged = true;
75378
+ }
75379
+ }
75380
+ if (childFilenameChanged) {
75381
+ this.files = [];
75382
+ this.built = false;
75383
+ }
75359
75384
  this.buildAll();
75360
75385
  return this.files.map((file, index) => ({
75361
75386
  filename: index === 0 ? options.schematicFilename : file.entry.filename,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.2353",
3
+ "version": "0.1.2354",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/cli"
@@ -51,7 +51,7 @@
51
51
  "circuit-json-to-fdm-component-box": "^0.0.2",
52
52
  "circuit-json-to-footprinter": "^0.0.59",
53
53
  "circuit-json-to-gerber": "^0.0.112",
54
- "circuit-json-to-kicad": "0.0.235",
54
+ "circuit-json-to-kicad": "0.0.236",
55
55
  "circuit-json-to-pnp-csv": "^0.0.18",
56
56
  "circuit-json-to-readable-netlist": "^0.0.15",
57
57
  "circuit-json-to-spice": "^0.0.45",