Skip to content

Commit

Permalink
Extract variables and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
aweell committed Sep 13, 2024
1 parent ee3fe13 commit 50dab99
Show file tree
Hide file tree
Showing 7 changed files with 417 additions and 373 deletions.
2 changes: 1 addition & 1 deletion tokens/figma/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This project is designed to update Figma variables based on a JSON input, primar
- **Fetch Existing Figma Data**: Retrieves the existing variables and collections from Figma.
- **Process JSON Data**: Extracts theme and token data from provided JSON files for each brand.
- **Update or Create Variables**: Adds new variables or updates existing ones based on the brand's light and dark themes.
- **Handle Variable Modes**: Ensures each brand's mode (e.g., "Light", "Dark") is updated or created in the Figma "Skin" collection.
- **Handle Variable Modes**: Ensures each brand's mode (e.g., "Light", "Dark") is updated or created in the Figma "Brand" collection.
- **Support for Multiple Brands**: Processes multiple brands, mapping each brand's unique variables into Figma's collections.

## Setup
Expand Down
18 changes: 11 additions & 7 deletions tokens/figma/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { fileURLToPath } from "url";

import { updateSkinFiles } from "./update-skins.mjs";
import { updateMiddleware } from "./update-middleware.mjs";
import { BRANDS } from "./utils/constants.mjs";

import {
extractSkinJsonData,
extractMiddlewareJsonData,
} from "./extract-json-data.mjs";
} from "./utils/extract-json-data.mjs";

dotenv.config({ path: "../../.env" });
const __filename = fileURLToPath(import.meta.url);
Expand Down Expand Up @@ -39,12 +40,15 @@ const MIDDLEWARE_TOKEN =

const FILE_KEYS = {
// Remember to sync these with the workflow file
movistar: process.env.MOVISTAR_FILE_KEY,
"o2-new": process.env.O2_NEW_FILE_KEY,
"vivo-new": process.env.VIVO_NEW_FILE_KEY,
telefonica: process.env.TELEFONICA_FILE_KEY,
blau: process.env.BLAU_FILE_KEY,
tu: process.env.TU_FILE_KEY,
[BRANDS.MOVISTAR]:
process.env.MOVISTAR_FILE_KEY,
[BRANDS.O2_NEW]: process.env.O2_NEW_FILE_KEY,
[BRANDS.VIVO_NEW]:
process.env.VIVO_NEW_FILE_KEY,
[BRANDS.TELEFONICA]:
process.env.TELEFONICA_FILE_KEY,
[BRANDS.BLAU]: process.env.BLAU_FILE_KEY,
[BRANDS.TU]: process.env.TU_FILE_KEY,
};

const brands = Object.fromEntries(
Expand Down
Loading

0 comments on commit 50dab99

Please sign in to comment.