@tscircuit/cli 0.1.2290 → 0.1.2291

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.
@@ -37840,6 +37840,13 @@ var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
37840
37840
  var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
37841
37841
  const { outputDir, imageFormats, pcbSnapshotSettings } = options;
37842
37842
  fs14.mkdirSync(outputDir, { recursive: true });
37843
+ const hasSchematic = circuitJson.some((e) => e.type.startsWith("schematic_"));
37844
+ if (!hasSchematic) {
37845
+ if (imageFormats.schematicSvgs)
37846
+ fs14.rmSync(path18.join(outputDir, "schematic.svg"), { force: true });
37847
+ if (imageFormats.schematicPngs)
37848
+ fs14.rmSync(path18.join(outputDir, "schematic.png"), { force: true });
37849
+ }
37843
37850
  if (imageFormats.pcbSvgs) {
37844
37851
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
37845
37852
  fs14.writeFileSync(path18.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
@@ -37848,11 +37855,11 @@ var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
37848
37855
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
37849
37856
  fs14.writeFileSync(path18.join(outputDir, "pcb.png"), await convertSvgToPngBuffer(pcbSvg));
37850
37857
  }
37851
- if (imageFormats.schematicSvgs) {
37858
+ if (imageFormats.schematicSvgs && hasSchematic) {
37852
37859
  const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
37853
37860
  fs14.writeFileSync(path18.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
37854
37861
  }
37855
- if (imageFormats.schematicPngs) {
37862
+ if (imageFormats.schematicPngs && hasSchematic) {
37856
37863
  const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
37857
37864
  fs14.writeFileSync(path18.join(outputDir, "schematic.png"), await convertSvgToPngBuffer(schematicSvg));
37858
37865
  }
package/dist/cli/main.js CHANGED
@@ -176009,7 +176009,7 @@ var import_perfect_cli = __toESM3(require_dist3(), 1);
176009
176009
  // lib/getVersion.ts
176010
176010
  import { createRequire as createRequire2 } from "node:module";
176011
176011
  // package.json
176012
- var version = "0.1.2289";
176012
+ var version = "0.1.2290";
176013
176013
  var package_default = {
176014
176014
  name: "@tscircuit/cli",
176015
176015
  version,
@@ -192905,6 +192905,13 @@ var writeStepFromCircuitJson = async (circuitJson, stepOutputPath) => {
192905
192905
  var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
192906
192906
  const { outputDir, imageFormats, pcbSnapshotSettings } = options;
192907
192907
  fs33.mkdirSync(outputDir, { recursive: true });
192908
+ const hasSchematic = circuitJson.some((e) => e.type.startsWith("schematic_"));
192909
+ if (!hasSchematic) {
192910
+ if (imageFormats.schematicSvgs)
192911
+ fs33.rmSync(path37.join(outputDir, "schematic.svg"), { force: true });
192912
+ if (imageFormats.schematicPngs)
192913
+ fs33.rmSync(path37.join(outputDir, "schematic.png"), { force: true });
192914
+ }
192908
192915
  if (imageFormats.pcbSvgs) {
192909
192916
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
192910
192917
  fs33.writeFileSync(path37.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
@@ -192913,11 +192920,11 @@ var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
192913
192920
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson, pcbSnapshotSettings);
192914
192921
  fs33.writeFileSync(path37.join(outputDir, "pcb.png"), await convertSvgToPngBuffer(pcbSvg));
192915
192922
  }
192916
- if (imageFormats.schematicSvgs) {
192923
+ if (imageFormats.schematicSvgs && hasSchematic) {
192917
192924
  const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
192918
192925
  fs33.writeFileSync(path37.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
192919
192926
  }
192920
- if (imageFormats.schematicPngs) {
192927
+ if (imageFormats.schematicPngs && hasSchematic) {
192921
192928
  const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson);
192922
192929
  fs33.writeFileSync(path37.join(outputDir, "schematic.png"), await convertSvgToPngBuffer(schematicSvg));
192923
192930
  }
@@ -193032,6 +193039,13 @@ var generatePreviewAssets = async ({
193032
193039
  return;
193033
193040
  }
193034
193041
  fs36.mkdirSync(outputDir, { recursive: true });
193042
+ const hasSchematic = circuitJson.some((e) => e.type.startsWith("schematic_"));
193043
+ if (!hasSchematic) {
193044
+ if (imageFormats.schematicSvgs)
193045
+ fs36.rmSync(path40.join(outputDir, "schematic.svg"), { force: true });
193046
+ if (imageFormats.schematicPngs)
193047
+ fs36.rmSync(path40.join(outputDir, "schematic.png"), { force: true });
193048
+ }
193035
193049
  if (imageFormats.pcbSvgs) {
193036
193050
  try {
193037
193051
  console.log(`${prefix}Generating PCB SVG...`);
@@ -193052,7 +193066,7 @@ var generatePreviewAssets = async ({
193052
193066
  console.error(`${prefix}Failed to generate PCB PNG:`, error);
193053
193067
  }
193054
193068
  }
193055
- if (imageFormats.schematicSvgs) {
193069
+ if (imageFormats.schematicSvgs && hasSchematic) {
193056
193070
  try {
193057
193071
  console.log(`${prefix}Generating schematic SVG...`);
193058
193072
  const schematicSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
@@ -193062,7 +193076,7 @@ var generatePreviewAssets = async ({
193062
193076
  console.error(`${prefix}Failed to generate schematic SVG:`, error);
193063
193077
  }
193064
193078
  }
193065
- if (imageFormats.schematicPngs) {
193079
+ if (imageFormats.schematicPngs && hasSchematic) {
193066
193080
  try {
193067
193081
  console.log(`${prefix}Generating schematic PNG...`);
193068
193082
  const schematicSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
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.2289";
69124
+ var version = "0.1.2290";
69125
69125
  var package_default = {
69126
69126
  name: "@tscircuit/cli",
69127
69127
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.2290",
3
+ "version": "0.1.2291",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/cli"