Code Monkey home page Code Monkey logo

exporter-style-dictionary's People

Contributors

artufimtcev avatar jiritrecak avatar tchief avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exporter-style-dictionary's Issues

PR to Github fails if a branch called `supernova` exists already

Describe the bug
When targeting Github for a build, target repo cannot have a branch named supernova or the PR creation will fail with the error:

Error exporting to github: Error: fatal: cannot lock ref 'refs/heads/supernova/style-dictionary': 'refs/heads/supernova' exists; cannot create 'refs/heads/supernova/style-dictionary'

I think this is because the exporter tries to create a supernova/style-dictionary branch to do its work on?

Once I removed the supernova branch on that repo, the export worked fine.

Expected behavior
There probably shouldn't be a magically prohibited branch name in the target repo, and especially not supernova. This error happened when I added a new supernova branch to my repo to test... well, Supernova :)

Maybe instead of creating a branch called supernova/style-dictionary, it could be something randomly-generated or ID-based, like supernova-exporter-{workspaceId or UUID}/style-dictionary}, to remove the possibility of an unintentional conflict?

Screenshots
image

"Other" tokens are not exported

Describe the bug
Tokens defined within "Other" category are not exported

Expected behavior
When the tokens are being exported, a corresponding file should be created for "Other" tokens.

Screenshots
Not applicable.

Additional context
Hello Supernova team! I have defined several tokens within the "Other" category, and I expect them to be exported as all the other categories are. Unfortunately, it does not work as I expect. Could you explain why? I also noticed the same behavior with all the other officially supported exporters.

Wrapper property name value breaks token reference in style-dictionary logic

I'm experiencing an issue when I reference tokens in the measures.json file.

In my solution I generate some global tokens where I reference tokens from the measures.json file.
I use the style-dictionary npm package (https://github.com/amzn/style-dictionary) to transform the tokens to CSS.

The exporter's JSON format wraps token values in a value property, which breaks the reference logic in the style-dictionary package. The logic looks for a value property in the reference path to the token (ex. {measure.dimension.space.spacing-none.value.measure.value}), and deletes the property.
Because the value property is deleted, the reference to the token breaks, so the build fails.

In the exporter code, would it be possible to change the wrapper property name here:

to maybe values?

So the output would look something like this:

{
  "measure": {
    "dimension": {
      "space": {
        "spacing-00": {
          "values": {
            "measure": {
              "type": "size",
              "value": 0
            },
            "unit": {
              "type": "string",
              "value": "pixels"
            }
          },
          "type": "measure"
        },
        "spacing-01": {
          "values": {
            "measure": {
              "type": "size",
              "value": 2
            },
            "unit": {
              "type": "string",
              "value": "pixels"
            }
          },
          "type": "measure"
        }

I hope that the explanation is clear enough.
If not, let me know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.