@tscircuit/cli 0.1.1191 → 0.1.1192
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 +16 -8
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -111034,7 +111034,7 @@ var getOutputDirName = (relativePath) => {
|
|
|
111034
111034
|
return relativePath.replace(/(\.board|\.circuit)?\.tsx$/, "").replace(/\.circuit\.json$/, "");
|
|
111035
111035
|
};
|
|
111036
111036
|
var registerBuild = (program2) => {
|
|
111037
|
-
program2.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--ignore-netlist-drc", "Ignore netlist DRC errors/warnings").option("--ignore-pin-specification-drc", "Ignore pin-specification DRC errors/warnings").option("--ignore-placement-drc", "Ignore placement DRC errors/warnings").option("--ignore-routing-drc", "Ignore routing DRC errors/warnings").option("--ignore-config", "Ignore options from tscircuit.config.json").option("--disable-pcb", "Disable PCB outputs").option("--routing-disabled", "Disable routing during circuit generation").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--pngs", "Generate PNG outputs during build generation").option("--pcb-png", "Generate PCB PNG outputs during build generation").option("--svgs", "Generate SVG outputs during build generation").option("--pcb-svgs", "Generate PCB SVG outputs during build generation").option("--schematic-svgs", "Generate schematic SVG outputs during build generation").option("--3d-png", "Generate 3D PNG outputs during build generation").option("--3d", "Generate 3D PNG outputs during build generation").option("--pcb-only", "Generate only PCB SVG outputs during build generation").option("--schematic-only", "Generate only schematic SVG outputs during build generation").option("--kicad-project", "Generate KiCad project directories for each successful build output").option("--kicad-project-zip", "Generate a zipped KiCad project for each successful build output").option("--kicad-library", "Generate KiCad library in dist/kicad-library").option("--kicad-library-name <name>", "Specify the name of the KiCad library").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--glbs", "Generate GLB 3D model files for every successful build").option("--profile", "Log per-circuit circuit.json generation time during build").option("--kicad-pcm", "Generate KiCad PCM (Plugin and Content Manager) assets in dist/pcm").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").option("--concurrency <number>", "Number of files to build in parallel (default: 1)", "1").option("--inject-props <json>", "Inject JSON props into the built file's default export").option("--inject-props-file <path>", "Inject JSON props from a file into the built file's default export").action(async (file, options) => {
|
|
111037
|
+
program2.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--ignore-netlist-drc", "Ignore netlist DRC errors/warnings").option("--ignore-pin-specification-drc", "Ignore pin-specification DRC errors/warnings").option("--ignore-placement-drc", "Ignore placement DRC errors/warnings").option("--ignore-routing-drc", "Ignore routing DRC errors/warnings").option("--ignore-config", "Ignore options from tscircuit.config.json").option("--disable-pcb", "Disable PCB outputs").option("--routing-disabled", "Disable routing during circuit generation").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--pngs", "Generate PNG outputs during build generation").option("--pcb-png", "Generate PCB PNG outputs during build generation").option("--svgs", "Generate SVG outputs during build generation").option("--pcb-svgs", "Generate PCB SVG outputs during build generation").option("--schematic-svgs", "Generate schematic SVG outputs during build generation").option("--3d-png", "Generate 3D PNG outputs during build generation").option("--3d", "Generate 3D PNG outputs during build generation").option("--pcb-only", "Generate only PCB SVG outputs during build generation").option("--schematic-only", "Generate only schematic SVG outputs during build generation").option("--kicad-project", "Generate KiCad project directories for each successful build output").option("--kicad-project-zip", "Generate a zipped KiCad project for each successful build output").option("--kicad-library", "Generate KiCad library in dist/kicad-library").option("--kicad-library-name <name>", "Specify the name of the KiCad library").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--show-courtyards", "Show courtyard outlines in PCB SVG outputs").option("--glbs", "Generate GLB 3D model files for every successful build").option("--profile", "Log per-circuit circuit.json generation time during build").option("--kicad-pcm", "Generate KiCad PCM (Plugin and Content Manager) assets in dist/pcm").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").option("--concurrency <number>", "Number of files to build in parallel (default: 1)", "1").option("--inject-props <json>", "Inject JSON props into the built file's default export").option("--inject-props-file <path>", "Inject JSON props from a file into the built file's default export").action(async (file, options) => {
|
|
111038
111038
|
try {
|
|
111039
111039
|
const transpileExplicitlyRequested = options?.transpile === true;
|
|
111040
111040
|
const resolvedRoot = path39.resolve(process.cwd());
|
|
@@ -111139,7 +111139,7 @@ var registerBuild = (program2) => {
|
|
|
111139
111139
|
injectedProps,
|
|
111140
111140
|
generatePreviewAssets: false,
|
|
111141
111141
|
imageFormats: imageFormatSelection,
|
|
111142
|
-
pcbSnapshotSettings: projectConfig?.pcbSnapshotSettings
|
|
111142
|
+
pcbSnapshotSettings: resolvedOptions?.showCourtyards ? { ...projectConfig?.pcbSnapshotSettings, showCourtyards: true } : projectConfig?.pcbSnapshotSettings
|
|
111143
111143
|
};
|
|
111144
111144
|
const shouldGeneratePreviewImages = Boolean((resolvedOptions?.previewImages || resolvedOptions?.allImages || hasExplicitImageFormatSelection) && hasAnyImageFormatSelected(imageFormatSelection));
|
|
111145
111145
|
const shouldGenerateAllPreviewImages = Boolean(resolvedOptions?.allImages);
|
|
@@ -111339,7 +111339,10 @@ var registerBuild = (program2) => {
|
|
|
111339
111339
|
previewComponentPath,
|
|
111340
111340
|
allImages: shouldGenerateAllPreviewImages,
|
|
111341
111341
|
imageFormats: imageFormatSelection,
|
|
111342
|
-
pcbSnapshotSettings:
|
|
111342
|
+
pcbSnapshotSettings: resolvedOptions?.showCourtyards ? {
|
|
111343
|
+
...projectConfig?.pcbSnapshotSettings,
|
|
111344
|
+
showCourtyards: true
|
|
111345
|
+
} : projectConfig?.pcbSnapshotSettings
|
|
111343
111346
|
});
|
|
111344
111347
|
}
|
|
111345
111348
|
}
|
|
@@ -250389,6 +250392,7 @@ var exportSnippet = async ({
|
|
|
250389
250392
|
format,
|
|
250390
250393
|
outputPath,
|
|
250391
250394
|
platformConfig: platformConfig2,
|
|
250395
|
+
pcbSnapshotSettings,
|
|
250392
250396
|
writeFile = true,
|
|
250393
250397
|
onExit = (code) => process.exit(code),
|
|
250394
250398
|
onError = (message) => console.error(message),
|
|
@@ -250456,7 +250460,7 @@ var exportSnippet = async ({
|
|
|
250456
250460
|
outputContent = convertCircuitJsonToSchematicSvg3(circuitJson);
|
|
250457
250461
|
break;
|
|
250458
250462
|
case "pcb-svg":
|
|
250459
|
-
outputContent = convertCircuitJsonToPcbSvg3(circuitJson);
|
|
250463
|
+
outputContent = convertCircuitJsonToPcbSvg3(circuitJson, pcbSnapshotSettings);
|
|
250460
250464
|
break;
|
|
250461
250465
|
case "specctra-dsn":
|
|
250462
250466
|
outputContent = convertCircuitJsonToDsnString(circuitJson);
|
|
@@ -250804,7 +250808,7 @@ var resultToCsv = (result) => {
|
|
|
250804
250808
|
import path57 from "node:path";
|
|
250805
250809
|
import { promises as fs55 } from "node:fs";
|
|
250806
250810
|
var registerExport = (program2) => {
|
|
250807
|
-
program2.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", `Output format (${ALLOWED_EXPORT_FORMATS.join(", ")})`).option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").action(async (file, options) => {
|
|
250811
|
+
program2.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", `Output format (${ALLOWED_EXPORT_FORMATS.join(", ")})`).option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").option("--show-courtyards", "Show courtyard outlines in PCB SVG output").action(async (file, options) => {
|
|
250808
250812
|
const formatOption = options.format ?? "json";
|
|
250809
250813
|
const platformConfig2 = options.disablePartsEngine === true ? { partsEngineDisabled: true } : undefined;
|
|
250810
250814
|
if (formatOption === "spice") {
|
|
@@ -250830,6 +250834,7 @@ var registerExport = (program2) => {
|
|
|
250830
250834
|
format,
|
|
250831
250835
|
outputPath: options.output,
|
|
250832
250836
|
platformConfig: platformConfig2,
|
|
250837
|
+
pcbSnapshotSettings: options.showCourtyards ? { showCourtyards: true } : undefined,
|
|
250833
250838
|
onExit: (code) => process.exit(code),
|
|
250834
250839
|
onError: (message) => console.error(message),
|
|
250835
250840
|
onSuccess: ({ outputDestination }) => console.log(`Exported to ${outputDestination}!`)
|
|
@@ -273698,6 +273703,7 @@ var snapshotProject = async ({
|
|
|
273698
273703
|
onError = (msg) => console.error(msg),
|
|
273699
273704
|
onSuccess = (msg) => console.log(msg),
|
|
273700
273705
|
platformConfig: platformConfig2,
|
|
273706
|
+
pcbSnapshotSettingsOverride,
|
|
273701
273707
|
createDiff: createDiff2 = false,
|
|
273702
273708
|
cameraPreset,
|
|
273703
273709
|
concurrency = 1
|
|
@@ -273739,6 +273745,7 @@ var snapshotProject = async ({
|
|
|
273739
273745
|
return onExit2(0);
|
|
273740
273746
|
}
|
|
273741
273747
|
const snapshotsDirName = getSnapshotsDir(projectDir);
|
|
273748
|
+
const pcbSnapshotSettings = pcbSnapshotSettingsOverride ? { ...projectConfig2?.pcbSnapshotSettings, ...pcbSnapshotSettingsOverride } : projectConfig2?.pcbSnapshotSettings;
|
|
273742
273749
|
const mismatches = [];
|
|
273743
273750
|
let didUpdate = false;
|
|
273744
273751
|
const concurrencyValue = Math.max(1, concurrency);
|
|
@@ -273768,7 +273775,7 @@ var snapshotProject = async ({
|
|
|
273768
273775
|
schematicOnly,
|
|
273769
273776
|
forceUpdate,
|
|
273770
273777
|
platformConfig: platformConfig2,
|
|
273771
|
-
pcbSnapshotSettings
|
|
273778
|
+
pcbSnapshotSettings,
|
|
273772
273779
|
createDiff: createDiff2,
|
|
273773
273780
|
cameraPreset
|
|
273774
273781
|
},
|
|
@@ -273807,7 +273814,7 @@ var snapshotProject = async ({
|
|
|
273807
273814
|
schematicOnly,
|
|
273808
273815
|
forceUpdate,
|
|
273809
273816
|
platformConfig: platformConfig2,
|
|
273810
|
-
pcbSnapshotSettings
|
|
273817
|
+
pcbSnapshotSettings,
|
|
273811
273818
|
createDiff: createDiff2,
|
|
273812
273819
|
cameraPreset
|
|
273813
273820
|
});
|
|
@@ -273836,7 +273843,7 @@ Run with --update to fix.`);
|
|
|
273836
273843
|
|
|
273837
273844
|
// cli/snapshot/register.ts
|
|
273838
273845
|
var registerSnapshot = (program3) => {
|
|
273839
|
-
program3.command("snapshot").argument("[path]", "Path to file, directory, or glob pattern (e.g., 'examples/**/*.tsx')").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--force-update", "Force update snapshots even if they match").option("--3d", "Generate 3d preview snapshots").option("--pcb-only", "Generate only PCB snapshots").option("--schematic-only", "Generate only schematic snapshots").option("--disable-parts-engine", "Disable the parts engine").option("--camera-preset <preset>", `Camera angle preset for 3D snapshots (implies --3d). Valid presets: ${CAMERA_PRESET_NAMES.join(", ")}`).option("--ci", "Enable CI mode with snapshot diff artifacts").option("--test", "Enable test mode with snapshot diff artifacts").option("--concurrency <number>", "Number of files to snapshot in parallel (default: 1)", "1").action(async (target, options) => {
|
|
273846
|
+
program3.command("snapshot").argument("[path]", "Path to file, directory, or glob pattern (e.g., 'examples/**/*.tsx')").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--force-update", "Force update snapshots even if they match").option("--3d", "Generate 3d preview snapshots").option("--pcb-only", "Generate only PCB snapshots").option("--schematic-only", "Generate only schematic snapshots").option("--disable-parts-engine", "Disable the parts engine").option("--show-courtyards", "Show courtyard outlines in PCB snapshots").option("--camera-preset <preset>", `Camera angle preset for 3D snapshots (implies --3d). Valid presets: ${CAMERA_PRESET_NAMES.join(", ")}`).option("--ci", "Enable CI mode with snapshot diff artifacts").option("--test", "Enable test mode with snapshot diff artifacts").option("--concurrency <number>", "Number of files to snapshot in parallel (default: 1)", "1").action(async (target, options) => {
|
|
273840
273847
|
if (options.cameraPreset && !CAMERA_PRESET_NAMES.includes(options.cameraPreset)) {
|
|
273841
273848
|
console.error(`Unknown camera preset "${options.cameraPreset}". Valid presets: ${CAMERA_PRESET_NAMES.join(", ")}`);
|
|
273842
273849
|
process.exit(1);
|
|
@@ -273850,6 +273857,7 @@ var registerSnapshot = (program3) => {
|
|
|
273850
273857
|
forceUpdate: options.forceUpdate ?? false,
|
|
273851
273858
|
filePaths: target ? [target] : [],
|
|
273852
273859
|
platformConfig: options.disablePartsEngine ? { partsEngineDisabled: true } : undefined,
|
|
273860
|
+
pcbSnapshotSettingsOverride: options.showCourtyards ? { showCourtyards: true } : undefined,
|
|
273853
273861
|
cameraPreset: options.cameraPreset,
|
|
273854
273862
|
createDiff: (options.ci ?? false) || (options.test ?? false),
|
|
273855
273863
|
onExit: (code) => process.exit(code),
|