@tscircuit/cli 0.1.1939 → 0.1.1940

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.
@@ -13299,6 +13299,10 @@ var EMPTY_IMAGE_FORMAT_SELECTION = {
13299
13299
  simulationSvgs: false,
13300
13300
  simulationSchematicSvgs: false
13301
13301
  };
13302
+ var SITE_IMAGE_FORMAT_SELECTION = {
13303
+ ...EMPTY_IMAGE_FORMAT_SELECTION,
13304
+ threeDPngs: true
13305
+ };
13302
13306
  var hasAnyImageFormatSelected = (selection) => selection.threeDPngs || selection.pcbPngs || selection.schematicPngs || selection.pcbSvgs || selection.schematicSvgs || selection.simulationSvgs || selection.simulationSchematicSvgs;
13303
13307
  var hasNewOutputFlags = (options) => Boolean(options?.pngs || options?.pcbPng || options?.schematicPng || options?.svgs || options?.pcbSvgs || options?.simulationSvgs || options?.simulationSchematicSvgs || options?.schematicSvgs);
13304
13308
  var hasEstablishedOutputFlags = (options) => Boolean(options?.["3d"] || options?.["3dPng"] || options?.pcbOnly || options?.schematicOnly);
package/dist/cli/main.js CHANGED
@@ -136044,7 +136044,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
136044
136044
  // lib/getVersion.ts
136045
136045
  import { createRequire as createRequire2 } from "node:module";
136046
136046
  // package.json
136047
- var version = "0.1.1938";
136047
+ var version = "0.1.1939";
136048
136048
  var package_default = {
136049
136049
  name: "@tscircuit/cli",
136050
136050
  version,
@@ -151808,7 +151808,8 @@ var generatePreviewAssets = async ({
151808
151808
  outputDir,
151809
151809
  distDir,
151810
151810
  imageFormats,
151811
- pcbSnapshotSettings
151811
+ pcbSnapshotSettings,
151812
+ skipExisting
151812
151813
  }) => {
151813
151814
  const prefixRelative = path38.relative(distDir, outputDir) || ".";
151814
151815
  const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
@@ -151877,10 +151878,13 @@ var generatePreviewAssets = async ({
151877
151878
  }
151878
151879
  }
151879
151880
  if (imageFormats.threeDPngs) {
151881
+ const outputPath = path38.join(outputDir, "3d.png");
151882
+ if (skipExisting && fs35.existsSync(outputPath))
151883
+ return;
151880
151884
  try {
151881
151885
  console.log(`${prefix}Generating 3D PNG...`);
151882
151886
  const pngBuffer = await renderCircuitJsonTo3dPng(circuitJson);
151883
- fs35.writeFileSync(path38.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
151887
+ fs35.writeFileSync(outputPath, Buffer.from(pngBuffer));
151884
151888
  console.log(`${prefix}Written 3d.png`);
151885
151889
  } catch (error) {
151886
151890
  console.error(`${prefix}Failed to generate 3D PNG:`, error);
@@ -151894,7 +151898,8 @@ var buildPreviewImages = async ({
151894
151898
  previewComponentPath,
151895
151899
  allImages,
151896
151900
  imageFormats,
151897
- pcbSnapshotSettings
151901
+ pcbSnapshotSettings,
151902
+ skipExisting
151898
151903
  }) => {
151899
151904
  const successfulBuilds = builtFiles.filter((file) => file.ok);
151900
151905
  const previewEntrypoint = previewComponentPath || mainEntrypoint;
@@ -151911,7 +151916,8 @@ var buildPreviewImages = async ({
151911
151916
  outputDir,
151912
151917
  distDir,
151913
151918
  imageFormats,
151914
- pcbSnapshotSettings
151919
+ pcbSnapshotSettings,
151920
+ skipExisting
151915
151921
  });
151916
151922
  }
151917
151923
  return;
@@ -151933,7 +151939,8 @@ var buildPreviewImages = async ({
151933
151939
  outputDir: path38.dirname(previewBuild.outputPath),
151934
151940
  pcbSnapshotSettings,
151935
151941
  distDir,
151936
- imageFormats
151942
+ imageFormats,
151943
+ skipExisting
151937
151944
  });
151938
151945
  };
151939
151946
 
@@ -152306,6 +152313,10 @@ var EMPTY_IMAGE_FORMAT_SELECTION = {
152306
152313
  simulationSvgs: false,
152307
152314
  simulationSchematicSvgs: false
152308
152315
  };
152316
+ var SITE_IMAGE_FORMAT_SELECTION = {
152317
+ ...EMPTY_IMAGE_FORMAT_SELECTION,
152318
+ threeDPngs: true
152319
+ };
152309
152320
  var hasAnyImageFormatSelected = (selection) => selection.threeDPngs || selection.pcbPngs || selection.schematicPngs || selection.pcbSvgs || selection.schematicSvgs || selection.simulationSvgs || selection.simulationSchematicSvgs;
152310
152321
  var hasNewOutputFlags = (options) => Boolean(options?.pngs || options?.pcbPng || options?.schematicPng || options?.svgs || options?.pcbSvgs || options?.simulationSvgs || options?.simulationSchematicSvgs || options?.schematicSvgs);
152311
152322
  var hasEstablishedOutputFlags = (options) => Boolean(options?.["3d"] || options?.["3dPng"] || options?.pcbOnly || options?.schematicOnly);
@@ -153272,6 +153283,7 @@ var registerBuild = (program2) => {
153272
153283
  };
153273
153284
  const shouldGeneratePreviewImages = Boolean((resolvedOptions?.previewImages || resolvedOptions?.allImages || hasExplicitImageFormatSelection) && hasAnyImageFormatSelected(imageFormatSelection));
153274
153285
  const shouldGenerateAllPreviewImages = Boolean(resolvedOptions?.allImages);
153286
+ const shouldGenerateSite3dImages = Boolean(resolvedOptions?.site && !(shouldGenerateAllPreviewImages && imageFormatSelection.threeDPngs));
153275
153287
  const shouldGeneratePreviewAssetsInWorker = Boolean(resolvedOptions?.ci && concurrencyValue > 1 && shouldGeneratePreviewImages);
153276
153288
  buildOptions.generatePreviewAssets = shouldGeneratePreviewAssetsInWorker;
153277
153289
  const previewEntrypointForWorker = previewComponentPath || mainEntrypoint;
@@ -153505,6 +153517,18 @@ var registerBuild = (program2) => {
153505
153517
  });
153506
153518
  }
153507
153519
  }
153520
+ if (shouldGenerateSite3dImages) {
153521
+ console.log("Generating 3D preview images for all site builds...");
153522
+ await buildPreviewImages({
153523
+ builtFiles,
153524
+ distDir,
153525
+ mainEntrypoint,
153526
+ previewComponentPath,
153527
+ allImages: true,
153528
+ imageFormats: SITE_IMAGE_FORMAT_SELECTION,
153529
+ skipExisting: true
153530
+ });
153531
+ }
153508
153532
  if (resolvedOptions?.previewGltf) {
153509
153533
  console.log("Generating preview GLTF...");
153510
153534
  await buildPreviewGltf({
package/dist/lib/index.js CHANGED
@@ -65757,7 +65757,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65757
65757
  }));
65758
65758
  };
65759
65759
  // package.json
65760
- var version = "0.1.1938";
65760
+ var version = "0.1.1939";
65761
65761
  var package_default = {
65762
65762
  name: "@tscircuit/cli",
65763
65763
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1939",
3
+ "version": "0.1.1940",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",