Skip to content
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

Support JSON5 import #283

Closed
lukasoppermann opened this issue Oct 18, 2021 · 3 comments · Fixed by #226
Closed

Support JSON5 import #283

lukasoppermann opened this issue Oct 18, 2021 · 3 comments · Fixed by #226
Labels
enhancement Internal new feature or functionality

Comments

@lukasoppermann
Copy link

Is your feature request related to a problem? Please describe.
Using json5 can be very helpful for design tokens as it allows more flexible comments and other convenient features for a file that may be edited by hand.

Supporting json5 would be a really neat.

Describe the solution you'd like
If users paste json5 into the plugin it should work.
I have not investigated this a lot, but it seems to be relatively easy to convert to json: https://gist.github.com/iddan/3d34b12f6b22c30a8a07c149b3175e2f

I think converting to json and import is enough. No need to interpret the comments.

@six7
Copy link
Collaborator

six7 commented Oct 18, 2021

Would you expect it to just work when pasting into the JSON field or could this live in a dedicated area?

I'm thinking of a dedicated 'Import' option where users could paste their json/css/etc, maybe specify what type this is (maybe we'd allow importing something like a tailwindcss config, JSON5, css file, etc).

@six7 six7 added the enhancement Internal new feature or functionality label Oct 18, 2021
@lukasoppermann
Copy link
Author

Yes, for json5 I would expect it to be just for pasting in the field. I would also not expect it to "understand" additional json5 commets but simply treat it like Json and "ignore" any additional syntax.

I feel Json5 is very helpful for design token files specifically which is why supporting it would be neat.

Otherwise one has to sanitize it before.

@six7
Copy link
Collaborator

six7 commented Oct 18, 2021

Sounds good. Figma Tokens actually had JSON5 support in the early versions so this should be easily done.

six7 added a commit that referenced this issue Oct 23, 2021
@six7 six7 mentioned this issue Oct 23, 2021
7 tasks
@six7 six7 closed this as completed in #226 Oct 31, 2021
six7 added a commit that referenced this issue Oct 31, 2021
* add initial url sync

* add new provider type

* add form

* add basic functionality

* add working pull

* add push dialog, working state

* added checks for commit message

* add tests

* rework confirm message

* add dirty state

* add test

* fix jsonbin

* remove legacy code

* wip

* fix pullTokens

* add tests

* add first draft of cli script

* fix tests

* add pkg

* working cli tool with github actions

* remove console log

* Add robustness

* bump token-transformer

* prettify ui

* bump release

* add custom branch input to pushDialog

* added loading screen, fixed jsonbin add

* add excludes to token transformer

* add readme to token-transformer

* fix transformer when no excludes are present

* remove token context

* add url sync

* allow users to resize window by dragging corner

* fix url sync

* ignore tokens from style creation that start with _

* fix tooltip render error

* fix tooltip in list mode

* fix resize pointer

* fix #266

* fix colors button row

* fixes #274

* fix / replacement

* fixes #142

* add check for alias

* add token preview in edit

* fix undefined pr state if no file existed

* add editProhibited based on user role

* fix alias value of 0

* add new defaults

* remove spellcheck from inputs

* adds json5 support, fixes #270, fixes #283

* add unique check to names

* fix color opacity values not matching when using 0.5

* fixes #166, fixes #209

* add type to new token creation

* fixes #276

* fixes unique name check

* fix unique name check

* capitalize description in edit form

* introduce new merging function

* fix aliasing of rgba colors

* add new resize icon

* fix capitalization of input labels

* fix name of form

* fix async fn

* correctly saves whole context obj except secret

* add placeholder for value

* fix spec

* fix test

* remove console.log

* fix when no tokens file was present

* integrate style name ignore for updating nodes

* fix ignore part when applying

* fix modal padding except for edit token form

* fix token-transformer

* bump token transformer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Internal new feature or functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants