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

[WNMGDS-2746][WNMGDS-2776] Update token build scripts to use JSON source #2952

Merged
merged 49 commits into from
May 30, 2024

Commits on Feb 21, 2024

  1. This script can just be about exporting CSS/Sass now

    After the Figma changes, we have a different way of storing tokens, and they're all in one folder. We haven't needed the multiple input directories for a while, and we don't really have a big reason to run the command multiple times for different outputs either. This command has become specific to outputting what our other packages will consume, while we have a separate set of scripts for syncing with Figma.
    pwolfert committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    0408b24 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6e51206 View commit details
    Browse the repository at this point in the history
  3. Move the new token types and token-reading utils because they are mor…

    …e broadly useful
    
    We will now need them in the CSS/Sass exporters
    pwolfert committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    00a84de View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a42f391 View commit details
    Browse the repository at this point in the history
  5. In the flattened token files, keep the notation internally consistent

    Let the Figma scripts do the conversion from `.` to `/`, but let our other exporters expect the alias notation to match the flattened keys
    pwolfert committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    6380a68 View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2024

  1. Configuration menu
    Copy the full SHA
    b590cb5 View commit details
    Browse the repository at this point in the history
  2. Make it easier to test

    by breaking it into functions that are easier to test and by only converting the files it finds rather than requiring all theme files to be present
    pwolfert committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    4051b57 View commit details
    Browse the repository at this point in the history
  3. Now have the basic structure of the new exporter

    Still need to resolve values more intelligently and generate variable names in a way that matches the old ones and conveys the correct hierarchy
    pwolfert committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    80e67af View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d246d21 View commit details
    Browse the repository at this point in the history
  5. Add variable naming logic

    pwolfert committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    11082a9 View commit details
    Browse the repository at this point in the history
  6. Tests for var naming

    pwolfert committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    3e84d9c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    85fe607 View commit details
    Browse the repository at this point in the history
  8. Update other tests

    pwolfert committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    6ffc868 View commit details
    Browse the repository at this point in the history

Commits on Feb 23, 2024

  1. Configuration menu
    Copy the full SHA
    7400f46 View commit details
    Browse the repository at this point in the history
  2. More snapshot tests, but now I see that layout is empty

    The test data needs some layout tokens, but it gets complicated, because spacers are currently defined as plain numbers in Figma, whereas we'll probably want the JSON `$type` to be `dimension`. We need to intelligently convert the values between our JSON storage and Figma
    pwolfert committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    89579e5 View commit details
    Browse the repository at this point in the history
  3. Add fiddly logic for converting from and to Figma's generic number type

    Once we do our first down-sync from Figma, we could possibly start storing this translation information as meta-data inside the JSON tokens. It wouldn't get uploaded to Figma, but it could be manually maintained in our repository. Being able to store information that doesn't go to Figma, however, would require that we merge incoming data with our local JSON files instead of the current overwriting method.
    
    Actually, if we're not storing that info in Figma, it's already in our tokens...why would I have to tell a dimension token that it's a dimension? If we don't need to be able to save the JSON based on only the information stored in Figma, then this isn't a problem at all. Maybe after the first down-sync we just need to update the down-sync operation to be a merge, and we look at the local (repository) token's `$type` and `$value` properties before converting from our Figma `NUMBER` variable. If `$type` is `dimension` then look at the unit of `$value` to determine how to translate from Figma.
    pwolfert committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    2114689 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3e6b947 View commit details
    Browse the repository at this point in the history
  5. Get rid of extra quotes in CSS output and add support for percentages

    This is so fiddly. I hate it.
    pwolfert committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    8f26132 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    1f9ee7c View commit details
    Browse the repository at this point in the history

Commits on Feb 24, 2024

  1. Update tokens package README

    pwolfert committed Feb 24, 2024
    Configuration menu
    Copy the full SHA
    f1eeb7e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8a66a31 View commit details
    Browse the repository at this point in the history
  3. This list hierarchy got lost

    pwolfert committed Feb 24, 2024
    Configuration menu
    Copy the full SHA
    43d42e7 View commit details
    Browse the repository at this point in the history

Commits on May 14, 2024

  1. Configuration menu
    Copy the full SHA
    022c35c View commit details
    Browse the repository at this point in the history
  2. Fix minor TS errors

    pwolfert committed May 14, 2024
    Configuration menu
    Copy the full SHA
    199165a View commit details
    Browse the repository at this point in the history

Commits on May 23, 2024

  1. Replace our old tokens with some test ones synced from Figma

    We don't have the full set of tokens in Figma yet because we're in the process of trying to transfer the library file from one account to another, but we've got all the `System` variables, and I manually created a few variables in the `Theme` collection.
    pwolfert committed May 23, 2024
    Configuration menu
    Copy the full SHA
    0c34171 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f72a516 View commit details
    Browse the repository at this point in the history
  3. Fix "{spacer.4}px" as a $value in the JSON

    If a variable is an alias, we don't need to send it through our logic for converting pixel values to other units
    pwolfert committed May 23, 2024
    Configuration menu
    Copy the full SHA
    18cd414 View commit details
    Browse the repository at this point in the history
  4. Add checks in the unit tests for that functionality and fix it again

    My previous solution wasn't perfect because it didn't account for inheriting the token type from the aliased variable
    pwolfert committed May 23, 2024
    Configuration menu
    Copy the full SHA
    9f7f9da View commit details
    Browse the repository at this point in the history
  5. Round ex units

    pwolfert committed May 23, 2024
    Configuration menu
    Copy the full SHA
    51dbd90 View commit details
    Browse the repository at this point in the history
  6. More type refinement

    pwolfert committed May 23, 2024
    Configuration menu
    Copy the full SHA
    256ebda View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1097525 View commit details
    Browse the repository at this point in the history
  8. Create an example .env file

    pwolfert committed May 23, 2024
    Configuration menu
    Copy the full SHA
    6edf182 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2024

  1. Configuration menu
    Copy the full SHA
    368558d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0c3014c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0565cd0 View commit details
    Browse the repository at this point in the history
  4. WIP: Add guessing back in. It works!

    I now that I think about it again, I don't really think it's necessary to store the number type information in the `$extensions` when we can later infer from the `$type` and the converted `$value` string that it wrote, which should contain the unit. The only weird one would be `0` values that are also `dimensions`, but I say we always pretend those are pixel values.
    pwolfert committed May 24, 2024
    Configuration menu
    Copy the full SHA
    e3c12b3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    905bc5c View commit details
    Browse the repository at this point in the history
  6. Update unit tests and make sure we can get types for Figma from aliases

    Now that we don't duplicate the type information on alias tokens, we have to resolve the aliases until we get to a real token with a type in order to send that information to Figma.
    pwolfert committed May 24, 2024
    Configuration menu
    Copy the full SHA
    60d8ce5 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    70e6c0c View commit details
    Browse the repository at this point in the history

Commits on May 25, 2024

  1. Configuration menu
    Copy the full SHA
    b8f1ad8 View commit details
    Browse the repository at this point in the history

Commits on May 28, 2024

  1. Temporarily revert var printing and add some snapshot tests that will…

    … fail
    
    They will fail because I've manually created the snapshots by copying the old CSS files so we can see the changes from this branch
    pwolfert committed May 28, 2024
    Configuration menu
    Copy the full SHA
    fd7dd9c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0885284 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b8b3597 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a063114 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5dcfdf8 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2024

  1. Add some comments

    pwolfert committed May 29, 2024
    Configuration menu
    Copy the full SHA
    2ab241a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f9be14f View commit details
    Browse the repository at this point in the history
  3. Some more doc comments

    pwolfert committed May 29, 2024
    Configuration menu
    Copy the full SHA
    c84f8b4 View commit details
    Browse the repository at this point in the history

Commits on May 30, 2024

  1. Configuration menu
    Copy the full SHA
    349b57e View commit details
    Browse the repository at this point in the history