@tscircuit/cli 0.1.136 → 0.1.138
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/main.js +18 -10
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -442169,7 +442169,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
442169
442169
|
import { execSync as execSync2 } from "node:child_process";
|
|
442170
442170
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
442171
442171
|
// package.json
|
|
442172
|
-
var version = "0.1.
|
|
442172
|
+
var version = "0.1.137";
|
|
442173
442173
|
var package_default = {
|
|
442174
442174
|
name: "@tscircuit/cli",
|
|
442175
442175
|
version,
|
|
@@ -495951,7 +495951,8 @@ var CircuitRunner = class {
|
|
|
495951
495951
|
// lib/shared/generate-circuit-json.ts
|
|
495952
495952
|
var import_make_vfs2 = __toESM2(require_dist8(), 1);
|
|
495953
495953
|
var import_debug21 = __toESM2(require_src2(), 1);
|
|
495954
|
-
import path21 from "node:path";
|
|
495954
|
+
import path21 from "node:path/posix";
|
|
495955
|
+
import { relative as relative6 } from "node:path";
|
|
495955
495956
|
import fs21 from "node:fs";
|
|
495956
495957
|
var debug14 = import_debug21.default("tsci:generate-circuit-json");
|
|
495957
495958
|
var ALLOWED_FILE_EXTENSIONS = [
|
|
@@ -495973,7 +495974,7 @@ async function generateCircuitJson({
|
|
|
495973
495974
|
const runner = new CircuitRunner;
|
|
495974
495975
|
const projectDir = path21.dirname(filePath);
|
|
495975
495976
|
const resolvedOutputDir = outputDir || projectDir;
|
|
495976
|
-
const relativeComponentPath =
|
|
495977
|
+
const relativeComponentPath = relative6(projectDir, filePath);
|
|
495977
495978
|
const baseFileName = outputFileName || path21.basename(filePath).replace(/\.[^.]+$/, "");
|
|
495978
495979
|
const outputPath = path21.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
|
|
495979
495980
|
debug14(`Project directory: ${projectDir}`);
|
|
@@ -496390,9 +496391,9 @@ var registerBuild = (program3) => {
|
|
|
496390
496391
|
hasErrors = true;
|
|
496391
496392
|
}
|
|
496392
496393
|
for (const filePath of circuitFiles) {
|
|
496393
|
-
const
|
|
496394
|
+
const relative7 = path25.relative(projectDir, filePath);
|
|
496394
496395
|
const isCircuit = filePath.endsWith(".circuit.tsx");
|
|
496395
|
-
const outputPath = isCircuit ? path25.join(distDir,
|
|
496396
|
+
const outputPath = isCircuit ? path25.join(distDir, relative7.replace(/\.circuit\.tsx$/, ""), "circuit.json") : path25.join(distDir, "circuit.json");
|
|
496396
496397
|
const ok = await buildFile(filePath, outputPath, projectDir, options);
|
|
496397
496398
|
if (!ok)
|
|
496398
496399
|
hasErrors = true;
|
|
@@ -497049,6 +497050,8 @@ var snapshotProject = async ({
|
|
|
497049
497050
|
update = false,
|
|
497050
497051
|
ignored = [],
|
|
497051
497052
|
threeD = false,
|
|
497053
|
+
pcbOnly = false,
|
|
497054
|
+
schematicOnly = false,
|
|
497052
497055
|
onExit = (code) => process.exit(code),
|
|
497053
497056
|
onError = (msg) => console.error(msg),
|
|
497054
497057
|
onSuccess = (msg) => console.log(msg)
|
|
@@ -497086,10 +497089,13 @@ var snapshotProject = async ({
|
|
|
497086
497089
|
const snapDir = path26.join(path26.dirname(file), "__snapshots__");
|
|
497087
497090
|
fs26.mkdirSync(snapDir, { recursive: true });
|
|
497088
497091
|
const base = path26.basename(file).replace(/\.tsx$/, "");
|
|
497089
|
-
const snapshotPairs = [
|
|
497090
|
-
|
|
497091
|
-
|
|
497092
|
-
|
|
497092
|
+
const snapshotPairs = [];
|
|
497093
|
+
const includePcb = pcbOnly || !schematicOnly;
|
|
497094
|
+
const includeSchematic = schematicOnly || !pcbOnly;
|
|
497095
|
+
if (includePcb)
|
|
497096
|
+
snapshotPairs.push(["pcb", pcbSvg]);
|
|
497097
|
+
if (includeSchematic)
|
|
497098
|
+
snapshotPairs.push(["schematic", schSvg]);
|
|
497093
497099
|
if (threeD && svg3d) {
|
|
497094
497100
|
snapshotPairs.push(["3d", svg3d]);
|
|
497095
497101
|
}
|
|
@@ -497121,10 +497127,12 @@ ${mismatches.join(`
|
|
|
497121
497127
|
|
|
497122
497128
|
// cli/snapshot/register.ts
|
|
497123
497129
|
var registerSnapshot = (program3) => {
|
|
497124
|
-
program3.command("snapshot").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--3d", "Generate 3d preview snapshots").action(async (options) => {
|
|
497130
|
+
program3.command("snapshot").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--3d", "Generate 3d preview snapshots").option("--pcb-only", "Generate only PCB snapshots").option("--schematic-only", "Generate only schematic snapshots").action(async (options) => {
|
|
497125
497131
|
await snapshotProject({
|
|
497126
497132
|
update: options.update ?? false,
|
|
497127
497133
|
threeD: options["3d"] ?? false,
|
|
497134
|
+
pcbOnly: options.pcbOnly ?? false,
|
|
497135
|
+
schematicOnly: options.schematicOnly ?? false,
|
|
497128
497136
|
onExit: (code) => process.exit(code),
|
|
497129
497137
|
onError: (msg) => console.error(msg),
|
|
497130
497138
|
onSuccess: (msg) => console.log(msg)
|