Skip to content

Implement "files/:file_id/versions" API #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

alessioarsuffi
Copy link

@alessioarsuffi alessioarsuffi commented May 26, 2025

This MR introduces a new function shouldUpdateFigmaVersion that compares the remote Figma file version date with the locally stored date for a specific asset type (e.g., images, icons, typography, colors). If the remote version is more recent, it updates the local version and fetch the specified assets.

There is a new file called figma-versions.json. Which will have the following structure:

{
  "icons" : "2025-05-26T08:06:03Z",
  "images" : "2025-05-26T08:06:03Z",
  "colors" : "2025-05-26T08:06:03Z",
  "typography" : "2025-05-26T08:06:03Z"
}

This is due to the fact that we want to download one of the following asset type based on the latest figma file version.

Scenario:

  • user has never invoked figma-export colors:
    The script will produce the following log before fetching the colors:
-------------------------------------------------------------------------------------
New version available for file: LlSdmGO32234CCTjkSYhBH... downloading updates now...
-------------------------------------------------------------------------------------
  • user retries to download colors right after the above:
----------------------------------------------------------------------------
You are on the latest file version, nothing to download.
----------------------------------------------------------------------------

If the designer releases a new file version, the subsequent commands will fetch the selected assets.

✅ Changes:

  • Added shouldUpdateFigmaVersion to detect and sync the latest Figma version per asset key.
  • Implement files/:file_id/versions Figma API

Possible enhancements:

  • Possibility to set "figma-versions.json" file via terminal command;
  • Save the fileId (light and dark) to "figma-versions.json" to better track the versions ?

If you have any further comment, idea, question etc I'm open for feedbacks :)
Thank you

@alessioarsuffi
Copy link
Author

alessioarsuffi commented May 26, 2025

Don't know who to tag, suggestions are more than welcome, many thanks 💪

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.

1 participant