Skip to content

fix(platform): pick the newest Figma build on Windows (numeric version sort) - #60

Closed
UnKnownnPasta wants to merge 1 commit into
silships:mainfrom
UnKnownnPasta:fix/windows-figma-version-sort
Closed

UnKnownnPasta wants to merge 1 commit into
silships:mainfrom
UnKnownnPasta:fix/windows-figma-version-sort

Conversation

@UnKnownnPasta

Copy link
Copy Markdown
Contributor

Problem

On Windows, connect could patch one Figma build while Figma launched another, so
the debug port never opened. connect then sat on "Open a file in Figma to connect"
and every command reported "Not connected to Figma".

Figma installs each version in %LOCALAPPDATA%\Figma\app-<version>. Both
findWindowsFigmaPath and findWindowsFigmaExe choose the newest folder with
.sort().reverse(), which is a plain string sort. As text, app-126.9.16 ranks
above app-126.10.13, so the older build wins.

I hit it right after Figma auto-updated: app-126.9.16, app-126.9.13 and
app-126.10.13 were all present. The CLI patched 9.16, Figma ran 10.13, which
was unpatched, so --remote-debugging-port=9222 was passed but ignored (the flag
showed in the process list, nothing listened on 9222).

Fix

Sort the folders numerically, newest first, in both lookups:

const byVersionDesc = (a, b) => b.localeCompare(a, undefined, { numeric: true });

Testing

  • Windows 10, folders app-126.9.13, app-126.9.16, app-126.10.13:
    getAsarPath() returned app-126.9.16 before and returns app-126.10.13 after.
  • After the fix, connect patched the right build, the port opened and the CLI
    connected.
  • npm test: 548 pass, 1 fail. The failure is extract → instantiate roundtrip (gated on a connected Figma), which fails the same way without my change.
  • I did not add a unit test: the lookup lives inside the win32-only block, so
    testing it would mean exporting the comparator. Happy to do that if you want it.

Not related to #22 (macOS App Management) or #45 (port only exists when the CLI
launches Figma), although the symptom looks similar.

silships pushed a commit that referenced this pull request Nov 19, 2026
…n sort) (#60)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silships

Copy link
Copy Markdown
Owner

Thank you! This is in figma-cli 2.4.0 on npm: the numeric version sort. Commit e659ff1 keeps you as the author

@silships silships closed this Nov 19, 2026
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