@tscircuit/cli 0.1.154 → 0.1.156
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 +39 -36
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -240539,7 +240539,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
240539
240539
|
import { execSync as execSync2 } from "node:child_process";
|
|
240540
240540
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
240541
240541
|
// package.json
|
|
240542
|
-
var version = "0.1.
|
|
240542
|
+
var version = "0.1.155";
|
|
240543
240543
|
var package_default = {
|
|
240544
240544
|
name: "@tscircuit/cli",
|
|
240545
240545
|
version,
|
|
@@ -240567,7 +240567,7 @@ var package_default = {
|
|
|
240567
240567
|
chokidar: "4.0.1",
|
|
240568
240568
|
"circuit-json-to-readable-netlist": "^0.0.9",
|
|
240569
240569
|
"circuit-json-to-simple-3d": "^0.0.3",
|
|
240570
|
-
"circuit-to-svg": "^0.0.
|
|
240570
|
+
"circuit-to-svg": "^0.0.164",
|
|
240571
240571
|
commander: "^14.0.0",
|
|
240572
240572
|
conf: "^13.1.0",
|
|
240573
240573
|
configstore: "^7.0.0",
|
|
@@ -276743,8 +276743,16 @@ function createSvgObjectFromPcbBoundary(transform2, minX, minY, maxX, maxY) {
|
|
|
276743
276743
|
}
|
|
276744
276744
|
};
|
|
276745
276745
|
}
|
|
276746
|
+
var fontSizeMap = {
|
|
276747
|
+
pin_number: 0.15,
|
|
276748
|
+
negated_pin_number: 0.15 * 0.8,
|
|
276749
|
+
reference_designator: 0.18,
|
|
276750
|
+
manufacturer_number: 0.18,
|
|
276751
|
+
net_label: 0.18,
|
|
276752
|
+
error: 0.05
|
|
276753
|
+
};
|
|
276746
276754
|
var getSchMmFontSize = (textType, fontSize) => {
|
|
276747
|
-
return
|
|
276755
|
+
return fontSize ?? fontSizeMap[textType];
|
|
276748
276756
|
};
|
|
276749
276757
|
var getSchScreenFontSize = (transform2, textType, fontSize) => {
|
|
276750
276758
|
return Math.abs(transform2.a) * getSchMmFontSize(textType, fontSize);
|
|
@@ -278487,6 +278495,7 @@ var createSvgObjectsForSchPortPinLabel = (params2) => {
|
|
|
278487
278495
|
return [];
|
|
278488
278496
|
const isNegated = label.startsWith("N_");
|
|
278489
278497
|
const displayLabel = isNegated ? label.slice(2) : label;
|
|
278498
|
+
let fontSizePx = getSchScreenFontSize(transform2, isNegated ? "negated_pin_number" : "pin_number");
|
|
278490
278499
|
svgObjects.push({
|
|
278491
278500
|
name: "text",
|
|
278492
278501
|
type: "element",
|
|
@@ -278498,7 +278507,7 @@ var createSvgObjectsForSchPortPinLabel = (params2) => {
|
|
|
278498
278507
|
fill: colorMap.schematic.pin_number,
|
|
278499
278508
|
"text-anchor": schPort.side_of_component === "left" || schPort.side_of_component === "bottom" ? "start" : "end",
|
|
278500
278509
|
"dominant-baseline": "middle",
|
|
278501
|
-
"font-size": `${
|
|
278510
|
+
"font-size": `${fontSizePx}px`,
|
|
278502
278511
|
transform: schPort.side_of_component === "top" || schPort.side_of_component === "bottom" ? `rotate(-90 ${screenPinNumberTextPos.x} ${screenPinNumberTextPos.y})` : ""
|
|
278503
278512
|
},
|
|
278504
278513
|
children: [
|
|
@@ -279186,8 +279195,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
279186
279195
|
}) => {
|
|
279187
279196
|
if (!schNetLabel.text)
|
|
279188
279197
|
return [];
|
|
279189
|
-
const
|
|
279190
|
-
const labelText = isNegated ? schNetLabel.text.slice(2) : schNetLabel.text;
|
|
279198
|
+
const labelText = schNetLabel.text;
|
|
279191
279199
|
if (schNetLabel.symbol_name) {
|
|
279192
279200
|
return createSvgObjectsForSchNetLabelWithSymbol({
|
|
279193
279201
|
schNetLabel,
|
|
@@ -279290,8 +279298,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
279290
279298
|
"font-family": "sans-serif",
|
|
279291
279299
|
"font-variant-numeric": "tabular-nums",
|
|
279292
279300
|
"font-size": `${fontSizePx}px`,
|
|
279293
|
-
transform: textTransformString
|
|
279294
|
-
...isNegated ? { style: "text-decoration: overline;" } : {}
|
|
279301
|
+
transform: textTransformString
|
|
279295
279302
|
},
|
|
279296
279303
|
children: [
|
|
279297
279304
|
{
|
|
@@ -281052,39 +281059,34 @@ async function getBuildEntrypoints({
|
|
|
281052
281059
|
const resolved = path24.resolve(resolvedRoot, fileOrDir);
|
|
281053
281060
|
if (fs24.existsSync(resolved) && fs24.statSync(resolved).isDirectory()) {
|
|
281054
281061
|
const projectDir2 = resolved;
|
|
281055
|
-
const
|
|
281056
|
-
const mainEntrypoint2 = await getEntrypoint({
|
|
281057
|
-
projectDir: projectDir2,
|
|
281058
|
-
onError: () => {}
|
|
281059
|
-
});
|
|
281060
|
-
const files2 = globbySync("**/*.circuit.tsx", {
|
|
281062
|
+
const files2 = globbySync(["**/*.circuit.tsx", "**/*.board.tsx"], {
|
|
281061
281063
|
cwd: projectDir2,
|
|
281062
281064
|
ignore: DEFAULT_IGNORED_PATTERNS
|
|
281063
281065
|
});
|
|
281064
|
-
for (const f of files2) {
|
|
281065
|
-
circuitFiles2.push(path24.join(projectDir2, f));
|
|
281066
|
-
}
|
|
281067
281066
|
return {
|
|
281068
281067
|
projectDir: projectDir2,
|
|
281069
|
-
|
|
281070
|
-
circuitFiles: circuitFiles2
|
|
281068
|
+
circuitFiles: files2.map((f) => path24.join(projectDir2, f))
|
|
281071
281069
|
};
|
|
281072
281070
|
}
|
|
281073
281071
|
return { projectDir: path24.dirname(resolved), circuitFiles: [resolved] };
|
|
281074
281072
|
}
|
|
281075
281073
|
const projectDir = resolvedRoot;
|
|
281076
|
-
const
|
|
281077
|
-
const mainEntrypoint = await getEntrypoint({ projectDir, onError: () => {} });
|
|
281078
|
-
const files = globbySync("**/*.circuit.tsx", {
|
|
281074
|
+
const files = globbySync(["**/*.circuit.tsx", "**/*.board.tsx"], {
|
|
281079
281075
|
cwd: projectDir,
|
|
281080
281076
|
ignore: DEFAULT_IGNORED_PATTERNS
|
|
281081
281077
|
});
|
|
281082
|
-
|
|
281083
|
-
|
|
281078
|
+
const circuitFiles = files.map((f) => path24.join(projectDir, f));
|
|
281079
|
+
if (circuitFiles.length === 0) {
|
|
281080
|
+
const mainEntrypoint = await getEntrypoint({
|
|
281081
|
+
projectDir,
|
|
281082
|
+
onError: () => {}
|
|
281083
|
+
});
|
|
281084
|
+
if (mainEntrypoint) {
|
|
281085
|
+
circuitFiles.push(mainEntrypoint);
|
|
281086
|
+
}
|
|
281084
281087
|
}
|
|
281085
281088
|
return {
|
|
281086
281089
|
projectDir,
|
|
281087
|
-
mainEntrypoint: mainEntrypoint || undefined,
|
|
281088
281090
|
circuitFiles
|
|
281089
281091
|
};
|
|
281090
281092
|
}
|
|
@@ -281092,26 +281094,27 @@ async function getBuildEntrypoints({
|
|
|
281092
281094
|
// cli/build/register.ts
|
|
281093
281095
|
var registerBuild = (program3) => {
|
|
281094
281096
|
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").action(async (file, options) => {
|
|
281095
|
-
const { projectDir,
|
|
281097
|
+
const { projectDir, circuitFiles } = await getBuildEntrypoints({
|
|
281098
|
+
fileOrDir: file
|
|
281099
|
+
});
|
|
281096
281100
|
const platformConfig = {
|
|
281097
281101
|
pcbDisabled: options?.disablePcb
|
|
281098
281102
|
};
|
|
281099
281103
|
const distDir = path25.join(projectDir, "dist");
|
|
281100
281104
|
fs25.mkdirSync(distDir, { recursive: true });
|
|
281101
281105
|
let hasErrors = false;
|
|
281102
|
-
if (mainEntrypoint) {
|
|
281103
|
-
const outputPath = path25.join(distDir, "circuit.json");
|
|
281104
|
-
const ok = await buildFile(mainEntrypoint, outputPath, projectDir, {
|
|
281105
|
-
...options,
|
|
281106
|
-
platformConfig
|
|
281107
|
-
});
|
|
281108
|
-
if (!ok)
|
|
281109
|
-
hasErrors = true;
|
|
281110
|
-
}
|
|
281111
281106
|
for (const filePath of circuitFiles) {
|
|
281112
281107
|
const relative7 = path25.relative(projectDir, filePath);
|
|
281113
281108
|
const isCircuit = filePath.endsWith(".circuit.tsx");
|
|
281114
|
-
const
|
|
281109
|
+
const isBoard = filePath.endsWith(".board.tsx");
|
|
281110
|
+
let outputPath;
|
|
281111
|
+
if (isCircuit) {
|
|
281112
|
+
outputPath = path25.join(distDir, relative7.replace(/\.circuit\.tsx$/, ""), "circuit.json");
|
|
281113
|
+
} else if (isBoard) {
|
|
281114
|
+
outputPath = path25.join(distDir, relative7.replace(/\.board\.tsx$/, ""), "circuit.json");
|
|
281115
|
+
} else {
|
|
281116
|
+
outputPath = path25.join(distDir, "circuit.json");
|
|
281117
|
+
}
|
|
281115
281118
|
const ok = await buildFile(filePath, outputPath, projectDir, options);
|
|
281116
281119
|
if (!ok)
|
|
281117
281120
|
hasErrors = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.156",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@babel/standalone": "^7.26.9",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"chokidar": "4.0.1",
|
|
26
26
|
"circuit-json-to-readable-netlist": "^0.0.9",
|
|
27
27
|
"circuit-json-to-simple-3d": "^0.0.3",
|
|
28
|
-
"circuit-to-svg": "^0.0.
|
|
28
|
+
"circuit-to-svg": "^0.0.164",
|
|
29
29
|
"commander": "^14.0.0",
|
|
30
30
|
"conf": "^13.1.0",
|
|
31
31
|
"configstore": "^7.0.0",
|