Skip to content

feat: support {props.name} in silkscreen text for component name - #366

Open
techmannih wants to merge 16 commits into
tscircuit:mainfrom
techmannih:aa
Open

feat: support {props.name} in silkscreen text for component name#366
techmannih wants to merge 16 commits into
tscircuit:mainfrom
techmannih:aa

Conversation

@techmannih

@techmannih techmannih commented Mar 20, 2026

Copy link
Copy Markdown
Member

This PR improves the EasyEDA to TSX conversion by correctly identifying and standardizing reference designators (like "U1", "R1").

Changes:

  • Introduced a REFERENCE_DESIGNATOR constant ({{NAME}}).
  • Updated logic to detect text shapes that look like designators and replace them with the REFERENCE_DESIGNATOR constant. Added a fallback mechanism for when no designator is explicitly present in the EasyEDA JSON.
  • [lib/websafe/convert-to-typescript-component/index.tsx] Pass manufacturer part number as a default name during conversion.
  • [lib/websafe/generate-footprint-tsx.ts]Updated silkscreentext generation to use {props.name} when the text matches the REFERENCE_DESIGNATOR. This makes the generated footprint's reference designator dynamic and tied to the component's name prop.
  • Tests: Added a new test case [tests/convert-to-ts/C2652953-to-ts.test.ts]for component C2652953, including snapshots, to verify the correct conversion and dynamic designator.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba94f9954e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/convert-easyeda-json-to-tscircuit-soup-json.ts Outdated
Comment thread lib/convert-easyeda-json-to-tscircuit-soup-json.ts Outdated

@seveibar seveibar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't you just implement {NAME} support, but instead you add U1 which will break things?

Comment thread tests/convert-to-ts/C105419-to-ts.test.ts
Comment thread lib/constants.ts Outdated
Comment thread lib/convert-easyeda-json-to-tscircuit-soup-json.ts Outdated
Comment thread lib/websafe/convert-to-typescript-component/index.tsx Outdated
@techmannih
techmannih requested a review from seveibar March 24, 2026 02:04
@techmannih

Copy link
Copy Markdown
Member Author

@seveibar

Comment thread lib/websafe/generate-footprint-tsx.ts Outdated
const text =
silkscreenText.text === "{NAME}"
? "{props.name}"
: JSON.stringify(silkscreenText.text)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???? very unclear

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using this ternary to handle the name/ref placeholder — when the silkscreen text represents the component name, it’s replaced with {props.name}. For any other silkscreen text defined in the component, I keep it unchanged

@seveibar seveibar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment. What are you giving this ternary for constructing the name? Keep it simple and understandable

@seveibar

Copy link
Copy Markdown
Contributor

@techmannih make sure to fix your PR title- i almost requested changes because your title is so inaccurate!!!!

@techmannih techmannih changed the title feat: Implement dynamic silkscreen reference designators using manufacturer part numbers as component names feat: support {props.name} in silkscreen text for component name Mar 24, 2026
useModelCdn,
shouldRecenter = true,
cadPositionZMm,
showDesignator = false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

@seveibar seveibar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to start over. Keep it simple. This code is extremely, extremely unclear.

name things MUCH BETTER- this is seriously unacceptably bad naming!!!

image

you need to name the variables better. What is text? Is that the circuitJsonText? What isReferenceDesignator? Are you refer to the jlcpcbTextIsRefDes? NAME THINGS BETTER!!!! TERRIBLE NAMING!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants