digdir / designsystemet

Designsystemet
https://designsystemet.no
MIT License
76 stars 37 forks source link

Make a Figma plugin that allows you to recive updates from the Figma Community file #289

Open mrosvik opened 1 year ago

mrosvik commented 1 year ago

Since it is not possible to “get latest updates” or “subscribe to changes” from a published community file, we need a plugin to do this.

Aksel has created a plugin to handle this for the Icon set: https://www.figma.com/community/plugin/1221057403873975172 Could we do something simular for Felles designsystem with the core components?

Image

mrosvik commented 6 months ago

En utvikler fra Brønnøysundregistrene ser på dette. @Camulos

ohatland commented 6 months ago

I have looked into this, by using the REST API to read the content of a community file, I'm able to automatically generate some of the resources from the community file into the canvas where the plugin is running. I can copy the element type, position and metadata about what parent and child each component have, and other metadata values. The problem is that the Figma REST API does not allow you to get the shape, color and other visual properties, from the Figma file.

There is an promising Variables API, currently in beta, where I think we can get the required data from. Sadly there is a bug in the Variables API, where it only accepts access tokens with an old scope schema file_read, all new generated tokens are created with the new schema files:read

While writing this post, I discovered this in the documentation:

To use this API, you must have a full seat in an Enterprise org; guests cannot use the API.

I believe we only have Professional @Camulos ?

Aksel have solved this by generate svg files from their Figma file, and added the svg files to the plugin code. This is not an ideal solution in my perspective, because the need (from my understanding) is to completely copy the whole content of the community file a new file. Thereby we need all graphical elements, not only svg files.

mrosvik commented 5 months ago

Thank you so much for looking into this @ohatland, and thanks for sharing your discoveries! 🙏🏻

Febakke commented 5 months ago

Summary from meeting 19.04 @mimarz @Camulos @ohatland With our current Figma subscription (Organization) we do not have access to the REST-api. This makes it impossible to create a plug-in that can do this. At this point and at our size we do not need enough of the enterprise features to upgrade.

Possible ways forward

This was not discussed in the meeting, but is another way forward.

mrosvik commented 1 week ago

Latest reply from Figma (19.09.24)

I've synced with our Designer Advocate team on your Community File Update request, her response is as follows:

"Yes, updating from community libraries has been a known pain point. Her point about material UI kits etc is true, and that is why we have them as native "kits" in design files now - and when folks use assets directly from there (as opposed to a copy from the community), they recieve updates. This is specific for those kits though. I don't believe there is anything on the immediate h2 roadmap for community file updates, this is a unique case as not many teams manage their design systems through a community file rather than workspaces."

The discussion would be around Enterprise and an API, which of course, comes with many additional benefits. Would it make sense to set up time to discuss Enterprise?