@tscircuit/cli 0.1.1957 → 0.1.1958
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 +97 -13
- package/dist/lib/index.js +2 -2
- package/package.json +2 -2
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.
|
|
136047
|
+
var version = "0.1.1957";
|
|
136048
136048
|
var package_default = {
|
|
136049
136049
|
name: "@tscircuit/cli",
|
|
136050
136050
|
version,
|
|
@@ -136105,7 +136105,7 @@ var package_default = {
|
|
|
136105
136105
|
debug: "^4.4.0",
|
|
136106
136106
|
delay: "^6.0.0",
|
|
136107
136107
|
"dsn-converter": "^0.0.90",
|
|
136108
|
-
easyeda: "^0.0.
|
|
136108
|
+
easyeda: "^0.0.315",
|
|
136109
136109
|
"fuse.js": "^7.1.0",
|
|
136110
136110
|
"get-port": "^7.1.0",
|
|
136111
136111
|
globby: "^14.1.0",
|
|
@@ -327227,7 +327227,7 @@ var handleSilkscreenPath = (track, index) => {
|
|
|
327227
327227
|
type: "pcb_silkscreen_path",
|
|
327228
327228
|
pcb_silkscreen_path_id: `pcb_silkscreen_path_${index + 1}`,
|
|
327229
327229
|
pcb_component_id: "pcb_component_1",
|
|
327230
|
-
layer:
|
|
327230
|
+
layer: getSideFromLayer(track.layer),
|
|
327231
327231
|
route: track.points.map((point22) => ({
|
|
327232
327232
|
x: milx10(point22.x),
|
|
327233
327233
|
y: milx10(point22.y)
|
|
@@ -327237,6 +327237,18 @@ var handleSilkscreenPath = (track, index) => {
|
|
|
327237
327237
|
};
|
|
327238
327238
|
var isCourtyardLayer = (layer) => layer === 13 || layer === 14 || layer === 15;
|
|
327239
327239
|
var isSilkscreenLayer = (layer) => layer === 3 || layer === 4;
|
|
327240
|
+
var isDocumentLayer = (layer) => layer === 12;
|
|
327241
|
+
var handleFabricationNotePath = (track, index) => pcb_fabrication_note_path.parse({
|
|
327242
|
+
type: "pcb_fabrication_note_path",
|
|
327243
|
+
pcb_fabrication_note_path_id: `pcb_fabrication_note_path_${index + 1}`,
|
|
327244
|
+
pcb_component_id: "pcb_component_1",
|
|
327245
|
+
layer: "top",
|
|
327246
|
+
route: track.points.map((point22) => ({
|
|
327247
|
+
x: mil10ToMm(point22.x),
|
|
327248
|
+
y: mil10ToMm(point22.y)
|
|
327249
|
+
})),
|
|
327250
|
+
stroke_width: mil10ToMm(track.width)
|
|
327251
|
+
});
|
|
327240
327252
|
var getSideFromLayer = (layer) => {
|
|
327241
327253
|
if (layer === 4 || layer === 14)
|
|
327242
327254
|
return "bottom";
|
|
@@ -327434,7 +327446,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
327434
327446
|
pcb_plated_hole_id: platedHoleId,
|
|
327435
327447
|
x: mil2mm(pad2.center.x),
|
|
327436
327448
|
y: mil2mm(pad2.center.y),
|
|
327437
|
-
layers: ["top"],
|
|
327449
|
+
layers: ["top", "bottom"],
|
|
327438
327450
|
port_hints: pcbPortHints,
|
|
327439
327451
|
pcb_component_id: "pcb_component_1",
|
|
327440
327452
|
pcb_port_id: `pcb_port_${index + 1}`
|
|
@@ -327559,8 +327571,10 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
327559
327571
|
let hasFoundDesignator = false;
|
|
327560
327572
|
easyEdaJson.packageDetail.dataStr.shape.forEach((shape, index) => {
|
|
327561
327573
|
if (shape.type === "TRACK") {
|
|
327562
|
-
if (
|
|
327574
|
+
if (isSilkscreenLayer(shape.layer)) {
|
|
327563
327575
|
circuitElements.push(handleSilkscreenPath(shape, index));
|
|
327576
|
+
} else if (isDocumentLayer(shape.layer)) {
|
|
327577
|
+
circuitElements.push(handleFabricationNotePath(shape, index));
|
|
327564
327578
|
}
|
|
327565
327579
|
} else if (shape.type === "CIRCLE") {
|
|
327566
327580
|
if (isSilkscreenLayer(shape.layer)) {
|
|
@@ -328697,6 +328711,7 @@ var generateFootprintTsx2 = (circuitJson, options = {}) => {
|
|
|
328697
328711
|
const vias = su17(circuitJson).pcb_via.list();
|
|
328698
328712
|
const silkscreenPaths = su17(circuitJson).pcb_silkscreen_path.list();
|
|
328699
328713
|
const silkscreenTexts = su17(circuitJson).pcb_silkscreen_text.list();
|
|
328714
|
+
const fabricationNotePaths = su17(circuitJson).pcb_fabrication_note_path.list();
|
|
328700
328715
|
const courtyardOutlines = su17(circuitJson).pcb_courtyard_outline.list();
|
|
328701
328716
|
const elementStrings = [];
|
|
328702
328717
|
for (const hole of holes) {
|
|
@@ -328747,6 +328762,9 @@ var generateFootprintTsx2 = (circuitJson, options = {}) => {
|
|
|
328747
328762
|
const rotationAttr = rotation23 ? ` pcbRotation="${rotation23}deg"` : "";
|
|
328748
328763
|
elementStrings.push(`<silkscreentext text=${textValue} pcbX="${mmStr2(silkscreenText.anchor_position.x)}" pcbY="${mmStr2(silkscreenText.anchor_position.y)}" anchorAlignment="${silkscreenText.anchor_alignment}"${rotationAttr}${silkscreenText.font_size ? ` fontSize="${mmStr2(silkscreenText.font_size)}"` : ""} />`);
|
|
328749
328764
|
}
|
|
328765
|
+
for (const fabricationNotePath of fabricationNotePaths) {
|
|
328766
|
+
elementStrings.push(`<fabricationnotepath route={${JSON.stringify(fabricationNotePath.route)}} strokeWidth="${mmStr2(fabricationNotePath.stroke_width)}" />`);
|
|
328767
|
+
}
|
|
328750
328768
|
for (const courtyardOutline of courtyardOutlines) {
|
|
328751
328769
|
elementStrings.push(`<courtyardoutline outline={${JSON.stringify(courtyardOutline.outline)}} />`);
|
|
328752
328770
|
}
|
|
@@ -328757,6 +328775,40 @@ var generateFootprintTsx2 = (circuitJson, options = {}) => {
|
|
|
328757
328775
|
</footprint>
|
|
328758
328776
|
`.trim();
|
|
328759
328777
|
};
|
|
328778
|
+
var POWER_PIN_LABEL = /^(?:VCC|VDD|VIN|VDDA)\d*$/;
|
|
328779
|
+
var GROUND_PIN_LABEL = /^(?:GND|VSS|PGND|AGND)\d*$/;
|
|
328780
|
+
var NO_CONNECT_PIN_LABEL = /^NC\d*$/;
|
|
328781
|
+
var getAttributeKind = (label) => {
|
|
328782
|
+
const normalizedLabel = label.trim().toUpperCase();
|
|
328783
|
+
if (POWER_PIN_LABEL.test(normalizedLabel))
|
|
328784
|
+
return "power";
|
|
328785
|
+
if (GROUND_PIN_LABEL.test(normalizedLabel))
|
|
328786
|
+
return "ground";
|
|
328787
|
+
if (NO_CONNECT_PIN_LABEL.test(normalizedLabel))
|
|
328788
|
+
return "no-connect";
|
|
328789
|
+
return;
|
|
328790
|
+
};
|
|
328791
|
+
var inferPinAttributes = (pinLabels) => {
|
|
328792
|
+
const pinAttributes = {};
|
|
328793
|
+
for (const [pinName, labels] of Object.entries(pinLabels)) {
|
|
328794
|
+
const labelList = typeof labels === "string" ? [labels] : labels;
|
|
328795
|
+
const inferredKinds = labelList.map(getAttributeKind);
|
|
328796
|
+
if (inferredKinds.some((kind) => kind === undefined))
|
|
328797
|
+
continue;
|
|
328798
|
+
const attributeKinds = new Set(inferredKinds);
|
|
328799
|
+
if (attributeKinds.size !== 1)
|
|
328800
|
+
continue;
|
|
328801
|
+
const [attributeKind] = attributeKinds;
|
|
328802
|
+
if (attributeKind === "power") {
|
|
328803
|
+
pinAttributes[pinName] = { requiresPower: true };
|
|
328804
|
+
} else if (attributeKind === "ground") {
|
|
328805
|
+
pinAttributes[pinName] = { requiresGround: true };
|
|
328806
|
+
} else if (attributeKind === "no-connect") {
|
|
328807
|
+
pinAttributes[pinName] = { doNotConnect: true };
|
|
328808
|
+
}
|
|
328809
|
+
}
|
|
328810
|
+
return pinAttributes;
|
|
328811
|
+
};
|
|
328760
328812
|
var generateTypescriptComponent = ({
|
|
328761
328813
|
pinLabels,
|
|
328762
328814
|
componentName,
|
|
@@ -328787,6 +328839,19 @@ var generateTypescriptComponent = ({
|
|
|
328787
328839
|
}));
|
|
328788
328840
|
const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(`,
|
|
328789
328841
|
`);
|
|
328842
|
+
const inferredPinAttributes = componentType === "chip" ? inferPinAttributes(simplifiedPinLabels) : {};
|
|
328843
|
+
const pinAttributesString = Object.entries(inferredPinAttributes).map(([pin, attributes2]) => {
|
|
328844
|
+
const attributesString = Object.entries(attributes2).map(([attributeName, value]) => `${attributeName}: ${JSON.stringify(value)}`).join(", ");
|
|
328845
|
+
return ` ${pin}: {${attributesString}}`;
|
|
328846
|
+
}).join(`,
|
|
328847
|
+
`);
|
|
328848
|
+
const pinAttributesBlock = pinAttributesString ? `const pinAttributes = {
|
|
328849
|
+
${pinAttributesString}
|
|
328850
|
+
} as const
|
|
328851
|
+
|
|
328852
|
+
` : "";
|
|
328853
|
+
const pinAttributesProp = pinAttributesString ? ` pinAttributes={pinAttributes}
|
|
328854
|
+
` : "";
|
|
328790
328855
|
const polarizedPinLabelsString = Object.entries(polarizedPinLabels ?? {}).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(`,
|
|
328791
328856
|
`);
|
|
328792
328857
|
const polarizedPinLabelsBlock = polarizedPinLabels ? `const pinLabels = {
|
|
@@ -329042,11 +329107,11 @@ const pinLabels = {
|
|
|
329042
329107
|
${pinLabelsString}
|
|
329043
329108
|
} as const
|
|
329044
329109
|
|
|
329045
|
-
export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
|
|
329110
|
+
${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
|
|
329046
329111
|
return (
|
|
329047
329112
|
<chip
|
|
329048
329113
|
pinLabels={pinLabels}
|
|
329049
|
-
${symbolProp2} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
329114
|
+
${pinAttributesProp}${symbolProp2} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
329050
329115
|
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
329051
329116
|
footprint={${footprintTsx}}
|
|
329052
329117
|
${objUrl || stepUrl ? `cadModel={{
|
|
@@ -329097,7 +329162,7 @@ var categoryValueContainsPushbutton = (value) => {
|
|
|
329097
329162
|
if (/analog\s+switch/.test(normalized) || /multiplex/.test(normalized) || /switching\s+diodes?/.test(normalized) || /\bics?\b/.test(normalized)) {
|
|
329098
329163
|
return false;
|
|
329099
329164
|
}
|
|
329100
|
-
return /push\s*buttons?/.test(normalized) || /pushbuttons?/.test(normalized) || /tact(?:ile)?\s+switch(?:es)?/.test(normalized) || /keyboard\s+(?:switch(?:es)?|shaft)/.test(normalized) || /mechanical\s+keyboard\s+shaft/.test(normalized);
|
|
329165
|
+
return /push\s*buttons?/.test(normalized) || /pushbuttons?/.test(normalized) || /tact(?:ile)?\s+switch(?:es)?/.test(normalized) || /keyboard\s+(?:switch(?:es)?|shaft)/.test(normalized) || /mechanical\s+keyboard\s+shaft/.test(normalized) || /\bkey[-_\s]+(?:th|smd)(?:\b|[_-])/.test(normalized);
|
|
329101
329166
|
}
|
|
329102
329167
|
if (Array.isArray(value)) {
|
|
329103
329168
|
return value.some(categoryValueContainsPushbutton);
|
|
@@ -329111,10 +329176,14 @@ var isPushbuttonCategoryComponent = (betterEasy) => {
|
|
|
329111
329176
|
const cPara = betterEasy.dataStr.head.c_para;
|
|
329112
329177
|
return [
|
|
329113
329178
|
betterEasy.tags,
|
|
329179
|
+
betterEasy.title,
|
|
329180
|
+
betterEasy.description,
|
|
329114
329181
|
cPara.category,
|
|
329115
329182
|
cPara.Category,
|
|
329116
329183
|
cPara["LCSC Category"],
|
|
329117
329184
|
cPara["JLCPCB Category"],
|
|
329185
|
+
cPara.package,
|
|
329186
|
+
cPara.pre,
|
|
329118
329187
|
betterEasy.category
|
|
329119
329188
|
].some(categoryValueContainsPushbutton);
|
|
329120
329189
|
};
|
|
@@ -329525,7 +329594,7 @@ var getGeneratedComponentType = (betterEasy, pinCount) => {
|
|
|
329525
329594
|
return "capacitor";
|
|
329526
329595
|
if (isResistorComponent(betterEasy) && pinCount === 2)
|
|
329527
329596
|
return "resistor";
|
|
329528
|
-
if (isInductorComponent(betterEasy))
|
|
329597
|
+
if (isInductorComponent(betterEasy) && pinCount === 2)
|
|
329529
329598
|
return "inductor";
|
|
329530
329599
|
if (isCrystalComponent(betterEasy))
|
|
329531
329600
|
return "crystal";
|
|
@@ -329598,8 +329667,9 @@ var convertBetterEasyToTsx = async ({
|
|
|
329598
329667
|
const crystalFrequency = componentType === "crystal" ? betterEasy.dataStr.head.c_para.Value?.trim() : undefined;
|
|
329599
329668
|
const crystalPinVariant = componentType !== "crystal" ? undefined : sourcePorts.length === 4 ? "four_pin" : sourcePorts.length === 2 ? "two_pin" : undefined;
|
|
329600
329669
|
const isMultiPinDiode = isDiodeCategoryComponent(betterEasy) && sourcePorts.length !== 2;
|
|
329670
|
+
const isMultiPinInductor = isInductorComponent(betterEasy) && sourcePorts.length !== 2;
|
|
329601
329671
|
const isPassiveWithCustomSymbol = componentType === "capacitor" || componentType === "resistor";
|
|
329602
|
-
const symbolTsx = isPassiveWithCustomSymbol || componentType === "chip" && !isMultiPinDiode && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx2(betterEasy, circuitJson, {
|
|
329672
|
+
const symbolTsx = isPassiveWithCustomSymbol || componentType === "chip" && !isMultiPinDiode && !isMultiPinInductor && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx2(betterEasy, circuitJson, {
|
|
329603
329673
|
alignPortsToDrawing: isPassiveWithCustomSymbol
|
|
329604
329674
|
}) : undefined;
|
|
329605
329675
|
return generateTypescriptComponent({
|
|
@@ -335376,7 +335446,7 @@ var handleSilkscreenPath2 = (track, index) => {
|
|
|
335376
335446
|
type: "pcb_silkscreen_path",
|
|
335377
335447
|
pcb_silkscreen_path_id: `pcb_silkscreen_path_${index + 1}`,
|
|
335378
335448
|
pcb_component_id: "pcb_component_1",
|
|
335379
|
-
layer:
|
|
335449
|
+
layer: getSideFromLayer2(track.layer),
|
|
335380
335450
|
route: track.points.map((point22) => ({
|
|
335381
335451
|
x: milx102(point22.x),
|
|
335382
335452
|
y: milx102(point22.y)
|
|
@@ -335386,6 +335456,18 @@ var handleSilkscreenPath2 = (track, index) => {
|
|
|
335386
335456
|
};
|
|
335387
335457
|
var isCourtyardLayer2 = (layer) => layer === 13 || layer === 14 || layer === 15;
|
|
335388
335458
|
var isSilkscreenLayer2 = (layer) => layer === 3 || layer === 4;
|
|
335459
|
+
var isDocumentLayer2 = (layer) => layer === 12;
|
|
335460
|
+
var handleFabricationNotePath2 = (track, index) => pcb_fabrication_note_path2.parse({
|
|
335461
|
+
type: "pcb_fabrication_note_path",
|
|
335462
|
+
pcb_fabrication_note_path_id: `pcb_fabrication_note_path_${index + 1}`,
|
|
335463
|
+
pcb_component_id: "pcb_component_1",
|
|
335464
|
+
layer: "top",
|
|
335465
|
+
route: track.points.map((point22) => ({
|
|
335466
|
+
x: mil10ToMm2(point22.x),
|
|
335467
|
+
y: mil10ToMm2(point22.y)
|
|
335468
|
+
})),
|
|
335469
|
+
stroke_width: mil10ToMm2(track.width)
|
|
335470
|
+
});
|
|
335389
335471
|
var getSideFromLayer2 = (layer) => {
|
|
335390
335472
|
if (layer === 4 || layer === 14)
|
|
335391
335473
|
return "bottom";
|
|
@@ -335583,7 +335665,7 @@ var convertEasyEdaJsonToCircuitJson2 = (easyEdaJson, {
|
|
|
335583
335665
|
pcb_plated_hole_id: platedHoleId,
|
|
335584
335666
|
x: mil2mm2(pad2.center.x),
|
|
335585
335667
|
y: mil2mm2(pad2.center.y),
|
|
335586
|
-
layers: ["top"],
|
|
335668
|
+
layers: ["top", "bottom"],
|
|
335587
335669
|
port_hints: pcbPortHints,
|
|
335588
335670
|
pcb_component_id: "pcb_component_1",
|
|
335589
335671
|
pcb_port_id: `pcb_port_${index + 1}`
|
|
@@ -335708,8 +335790,10 @@ var convertEasyEdaJsonToCircuitJson2 = (easyEdaJson, {
|
|
|
335708
335790
|
let hasFoundDesignator = false;
|
|
335709
335791
|
easyEdaJson.packageDetail.dataStr.shape.forEach((shape, index) => {
|
|
335710
335792
|
if (shape.type === "TRACK") {
|
|
335711
|
-
if (
|
|
335793
|
+
if (isSilkscreenLayer2(shape.layer)) {
|
|
335712
335794
|
circuitElements.push(handleSilkscreenPath2(shape, index));
|
|
335795
|
+
} else if (isDocumentLayer2(shape.layer)) {
|
|
335796
|
+
circuitElements.push(handleFabricationNotePath2(shape, index));
|
|
335713
335797
|
}
|
|
335714
335798
|
} else if (shape.type === "CIRCLE") {
|
|
335715
335799
|
if (isSilkscreenLayer2(shape.layer)) {
|
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.
|
|
65760
|
+
var version = "0.1.1957";
|
|
65761
65761
|
var package_default = {
|
|
65762
65762
|
name: "@tscircuit/cli",
|
|
65763
65763
|
version,
|
|
@@ -65818,7 +65818,7 @@ var package_default = {
|
|
|
65818
65818
|
debug: "^4.4.0",
|
|
65819
65819
|
delay: "^6.0.0",
|
|
65820
65820
|
"dsn-converter": "^0.0.90",
|
|
65821
|
-
easyeda: "^0.0.
|
|
65821
|
+
easyeda: "^0.0.315",
|
|
65822
65822
|
"fuse.js": "^7.1.0",
|
|
65823
65823
|
"get-port": "^7.1.0",
|
|
65824
65824
|
globby: "^14.1.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1958",
|
|
4
4
|
"main": "dist/cli/main.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/cli/main.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"debug": "^4.4.0",
|
|
59
59
|
"delay": "^6.0.0",
|
|
60
60
|
"dsn-converter": "^0.0.90",
|
|
61
|
-
"easyeda": "^0.0.
|
|
61
|
+
"easyeda": "^0.0.315",
|
|
62
62
|
"fuse.js": "^7.1.0",
|
|
63
63
|
"get-port": "^7.1.0",
|
|
64
64
|
"globby": "^14.1.0",
|