figma / code-connect

A tool for connecting your design system components in code with your design system in Figma
MIT License
486 stars 44 forks source link

Copied links need to be in quotes in the CLI #7

Open sekeidesign opened 1 month ago

sekeidesign commented 1 month ago

I had originally started writing this issue because I kept getting errors when trying to scaffold a new component. Although this is a minor issue, I can see some people getting hung up on it. The solution is simply to wrap the copied link in quotes to make sure the command doesn't break.

I think the instructions should reflect this, saying something like

npx figma connect create "https://..." --token <auth token>

CleanShot 2024-04-16 at 16 19 42@2x

tomduncalf-figma commented 1 month ago

Hey @sekeidesign, interesting that you have this issue! On my Mac, in both iTerm 2 and Apple Terminal, pasting a URL with ? or = characters automatically escapes it, see this video:

https://github.com/figma/code-connect/assets/117714347/bbb4642f-66b0-4743-92ed-8f5466be91ca

What terminal software are you using?

We'll look to add a note about this in any case!

devindoming0 commented 1 month ago

I too also encountered the put the Copy Link to Selection URL of the component set into "" issue. I am using VS Code's built-in terminal

There seems to be a fxn on line 41 in helpers.js that validates if the URL is a string that is showing this error

Screenshot 2024-04-17 at 10 26 09 AM
tomduncalf-figma commented 1 month ago

Interesting, it seems that some terminals must not escape special characters when you paste. It's strange because when I try the same on the VS Code terminal, it correctly changes ? to \? and = to \=. Maybe there is some configuration settings which controls this.

In any case, the solution @devindoming0 is to wrap the URL in quotes if your terminal doesn't escape it. We'll update the README to reflect this.

Thanks for the report!

Julian-B90 commented 4 weeks ago

Same issue her with Windows PowerShell in VS-Code:

PowerShell: image

WSL: image

sekeidesign commented 4 weeks ago

Hey @sekeidesign, interesting that you have this issue! On my Mac, in both iTerm 2 and Apple Terminal, pasting a URL with ? or = characters automatically escapes it, see this video:

Untitled.mov What terminal software are you using?

We'll look to add a note about this in any case!

I use Warp as my terminal!

michal-szymczak-ui-developer commented 4 weeks ago

Hey everyone In my case (Windows VSCode - default terminal / powershell) passing url in "" doesn't helped. I was getting:

'node-id' is not recognized as an internal or external command, operable program or batch file. Invalid parameter - =dev

In my case the "Git Bash" terminal was the one that worked!

ptomas-figma commented 3 weeks ago

@michal-szymczak-ui-developer could you share the command that failed in Windows VS Code?