@tscircuit/cli 0.1.1521 → 0.1.1522
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 +41 -9
- package/dist/cli/snapshot/snapshot.worker.js +17 -4
- package/dist/lib/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -100767,7 +100767,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
100767
100767
|
// lib/getVersion.ts
|
|
100768
100768
|
import { createRequire as createRequire2 } from "node:module";
|
|
100769
100769
|
// package.json
|
|
100770
|
-
var version = "0.1.
|
|
100770
|
+
var version = "0.1.1521";
|
|
100771
100771
|
var package_default = {
|
|
100772
100772
|
name: "@tscircuit/cli",
|
|
100773
100773
|
version,
|
|
@@ -278218,7 +278218,8 @@ var snapshotFilesWithWorkerPool = async (options) => {
|
|
|
278218
278218
|
platformConfig: job.options.platformConfig,
|
|
278219
278219
|
pcbSnapshotSettings: job.options.pcbSnapshotSettings,
|
|
278220
278220
|
createDiff: job.options.createDiff,
|
|
278221
|
-
cameraPreset: job.options.cameraPreset
|
|
278221
|
+
cameraPreset: job.options.cameraPreset,
|
|
278222
|
+
pcbLayer: job.options.pcbLayer
|
|
278222
278223
|
}
|
|
278223
278224
|
}),
|
|
278224
278225
|
isLogMessage: (message) => message.message_type === "worker_log",
|
|
@@ -281008,7 +281009,8 @@ var processSnapshotFile = async ({
|
|
|
281008
281009
|
platformConfig: platformConfig2,
|
|
281009
281010
|
pcbSnapshotSettings,
|
|
281010
281011
|
createDiff: createDiff2,
|
|
281011
|
-
cameraPreset
|
|
281012
|
+
cameraPreset,
|
|
281013
|
+
pcbLayer
|
|
281012
281014
|
}) => {
|
|
281013
281015
|
const relativeFilePath = path69.relative(projectDir, file);
|
|
281014
281016
|
const successPaths = [];
|
|
@@ -281045,7 +281047,10 @@ var processSnapshotFile = async ({
|
|
|
281045
281047
|
};
|
|
281046
281048
|
}
|
|
281047
281049
|
try {
|
|
281048
|
-
pcbSvg = convertCircuitJsonToPcbSvg5(circuitJson,
|
|
281050
|
+
pcbSvg = convertCircuitJsonToPcbSvg5(circuitJson, {
|
|
281051
|
+
...pcbSnapshotSettings,
|
|
281052
|
+
layer: pcbLayer
|
|
281053
|
+
});
|
|
281049
281054
|
} catch (error) {
|
|
281050
281055
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
281051
281056
|
return {
|
|
@@ -281133,7 +281138,15 @@ var processSnapshotFile = async ({
|
|
|
281133
281138
|
const base = path69.basename(file).replace(/\.[^.]+$/, "");
|
|
281134
281139
|
const snapshots = [];
|
|
281135
281140
|
if (pcbOnly || !schematicOnly) {
|
|
281136
|
-
|
|
281141
|
+
let pcbSnapshotType = "pcb";
|
|
281142
|
+
if (pcbLayer) {
|
|
281143
|
+
pcbSnapshotType = pcbLayer;
|
|
281144
|
+
}
|
|
281145
|
+
snapshots.push({
|
|
281146
|
+
type: pcbSnapshotType,
|
|
281147
|
+
content: pcbSvg,
|
|
281148
|
+
isBinary: false
|
|
281149
|
+
});
|
|
281137
281150
|
}
|
|
281138
281151
|
if (schematicOnly || !pcbOnly) {
|
|
281139
281152
|
snapshots.push({ type: "schematic", content: schSvg, isBinary: false });
|
|
@@ -281207,6 +281220,7 @@ var snapshotProject = async ({
|
|
|
281207
281220
|
pcbSnapshotSettingsOverride,
|
|
281208
281221
|
createDiff: createDiff2 = false,
|
|
281209
281222
|
cameraPreset,
|
|
281223
|
+
pcbLayer,
|
|
281210
281224
|
concurrency = 1
|
|
281211
281225
|
} = {}) => {
|
|
281212
281226
|
if (cameraPreset) {
|
|
@@ -281280,7 +281294,8 @@ var snapshotProject = async ({
|
|
|
281280
281294
|
platformConfig: platformConfig2,
|
|
281281
281295
|
pcbSnapshotSettings,
|
|
281282
281296
|
createDiff: createDiff2,
|
|
281283
|
-
cameraPreset
|
|
281297
|
+
cameraPreset,
|
|
281298
|
+
pcbLayer
|
|
281284
281299
|
},
|
|
281285
281300
|
stopOnFailure: true,
|
|
281286
281301
|
onLog: (lines) => {
|
|
@@ -281319,7 +281334,8 @@ var snapshotProject = async ({
|
|
|
281319
281334
|
platformConfig: mergedPlatformConfig,
|
|
281320
281335
|
pcbSnapshotSettings,
|
|
281321
281336
|
createDiff: createDiff2,
|
|
281322
|
-
cameraPreset
|
|
281337
|
+
cameraPreset,
|
|
281338
|
+
pcbLayer
|
|
281323
281339
|
});
|
|
281324
281340
|
processResult(result);
|
|
281325
281341
|
if (!result.ok) {
|
|
@@ -281346,17 +281362,33 @@ Run with --update to fix.`);
|
|
|
281346
281362
|
|
|
281347
281363
|
// cli/snapshot/register.ts
|
|
281348
281364
|
var registerSnapshot = (program3) => {
|
|
281349
|
-
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) => {
|
|
281365
|
+
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("--layer <layer>", "Generate a PCB snapshot for one layer: top or bottom (implies --pcb-only)").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) => {
|
|
281350
281366
|
if (options.cameraPreset && !CAMERA_PRESET_NAMES.includes(options.cameraPreset)) {
|
|
281351
281367
|
console.error(`Unknown camera preset "${options.cameraPreset}". Valid presets: ${CAMERA_PRESET_NAMES.join(", ")}`);
|
|
281352
281368
|
process.exit(1);
|
|
281353
281369
|
}
|
|
281370
|
+
let pcbLayer;
|
|
281371
|
+
if (options.layer === "top" || options.layer === "bottom") {
|
|
281372
|
+
pcbLayer = options.layer;
|
|
281373
|
+
} else if (options.layer) {
|
|
281374
|
+
console.error(`Unknown PCB layer "${options.layer}". Valid layers: top, bottom`);
|
|
281375
|
+
process.exit(1);
|
|
281376
|
+
}
|
|
281377
|
+
if (pcbLayer && options.schematicOnly) {
|
|
281378
|
+
console.error("A PCB layer snapshot cannot be combined with --schematic-only.");
|
|
281379
|
+
process.exit(1);
|
|
281380
|
+
}
|
|
281381
|
+
let pcbOnly = options.pcbOnly ?? false;
|
|
281382
|
+
if (pcbLayer) {
|
|
281383
|
+
pcbOnly = true;
|
|
281384
|
+
}
|
|
281354
281385
|
await snapshotProject({
|
|
281355
281386
|
concurrency: Math.max(1, Number.parseInt(options.concurrency || "1", 10)),
|
|
281356
281387
|
update: options.update ?? false,
|
|
281357
281388
|
threeD: options["3d"] ?? false,
|
|
281358
|
-
pcbOnly
|
|
281389
|
+
pcbOnly,
|
|
281359
281390
|
schematicOnly: options.schematicOnly ?? false,
|
|
281391
|
+
pcbLayer,
|
|
281360
281392
|
forceUpdate: options.forceUpdate ?? false,
|
|
281361
281393
|
filePaths: target ? [target] : [],
|
|
281362
281394
|
platformConfig: options.disablePartsEngine ? { partsEngineDisabled: true } : undefined,
|
|
@@ -16268,7 +16268,8 @@ var processSnapshotFile = async ({
|
|
|
16268
16268
|
platformConfig,
|
|
16269
16269
|
pcbSnapshotSettings,
|
|
16270
16270
|
createDiff: createDiff2,
|
|
16271
|
-
cameraPreset
|
|
16271
|
+
cameraPreset,
|
|
16272
|
+
pcbLayer
|
|
16272
16273
|
}) => {
|
|
16273
16274
|
const relativeFilePath = path11.relative(projectDir, file);
|
|
16274
16275
|
const successPaths = [];
|
|
@@ -16305,7 +16306,10 @@ var processSnapshotFile = async ({
|
|
|
16305
16306
|
};
|
|
16306
16307
|
}
|
|
16307
16308
|
try {
|
|
16308
|
-
pcbSvg = convertCircuitJsonToPcbSvg(circuitJson,
|
|
16309
|
+
pcbSvg = convertCircuitJsonToPcbSvg(circuitJson, {
|
|
16310
|
+
...pcbSnapshotSettings,
|
|
16311
|
+
layer: pcbLayer
|
|
16312
|
+
});
|
|
16309
16313
|
} catch (error) {
|
|
16310
16314
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
16311
16315
|
return {
|
|
@@ -16393,7 +16397,15 @@ var processSnapshotFile = async ({
|
|
|
16393
16397
|
const base = path11.basename(file).replace(/\.[^.]+$/, "");
|
|
16394
16398
|
const snapshots = [];
|
|
16395
16399
|
if (pcbOnly || !schematicOnly) {
|
|
16396
|
-
|
|
16400
|
+
let pcbSnapshotType = "pcb";
|
|
16401
|
+
if (pcbLayer) {
|
|
16402
|
+
pcbSnapshotType = pcbLayer;
|
|
16403
|
+
}
|
|
16404
|
+
snapshots.push({
|
|
16405
|
+
type: pcbSnapshotType,
|
|
16406
|
+
content: pcbSvg,
|
|
16407
|
+
isBinary: false
|
|
16408
|
+
});
|
|
16397
16409
|
}
|
|
16398
16410
|
if (schematicOnly || !pcbOnly) {
|
|
16399
16411
|
snapshots.push({ type: "schematic", content: schSvg, isBinary: false });
|
|
@@ -16679,7 +16691,8 @@ var handleSnapshotFile = async (filePath, projectDir, snapshotsDirName, options)
|
|
|
16679
16691
|
platformConfig,
|
|
16680
16692
|
pcbSnapshotSettings: options.pcbSnapshotSettings,
|
|
16681
16693
|
createDiff: options.createDiff,
|
|
16682
|
-
cameraPreset: options.cameraPreset
|
|
16694
|
+
cameraPreset: options.cameraPreset,
|
|
16695
|
+
pcbLayer: options.pcbLayer
|
|
16683
16696
|
});
|
|
16684
16697
|
return {
|
|
16685
16698
|
message_type: "snapshot_completed",
|
package/dist/lib/index.js
CHANGED
|
@@ -65364,7 +65364,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
65364
65364
|
}));
|
|
65365
65365
|
};
|
|
65366
65366
|
// package.json
|
|
65367
|
-
var version = "0.1.
|
|
65367
|
+
var version = "0.1.1521";
|
|
65368
65368
|
var package_default = {
|
|
65369
65369
|
name: "@tscircuit/cli",
|
|
65370
65370
|
version,
|