-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'production' into aweell-add-barTrackInverse
- Loading branch information
Showing
20 changed files
with
2,271 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Sync tokens to Figma | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- production | ||
paths: | ||
- "tokens/movistar.json" | ||
- "tokens/vivo-new.json" | ||
- "tokens/o2-new.json" | ||
- "tokens/telefonica.json" | ||
- "tokens/blau.json" | ||
- "tokens/tu.json" | ||
|
||
jobs: | ||
sync-figma-brand: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Run sync for the brand(s) | ||
working-directory: tokens/figma | ||
run: node index.mjs |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,6 @@ Temporary Items | |
|
||
|
||
**/node_modules | ||
**/build | ||
**/build | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 🐞 Bugs fixed | ||
|
||
- Qualitative rating inverted icon order [#1914](https://github.com/Telefonica/mistica-design/issues/1914) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"dependencies": { | ||
"dotenv": "^16.4.5", | ||
"node-fetch": "^3.3.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Project overview | ||
|
||
This project is designed to update Figma variables based on a JSON input, primarily focused on managing brand themes, colors, and other design tokens. The project retrieves existing variables from Figma, processes the provided JSON data, and updates or creates new variables in collections "Mode" and "Brand". | ||
|
||
## Features | ||
|
||
- **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 "Brand" collection. | ||
- **Support for multiple brands**: Processes multiple brands, mapping each brand's unique variables into Figma's collections. | ||
|
||
## Setup | ||
|
||
### Environment variables: | ||
|
||
- `FIGMA_TOKEN`: The API token to authenticate with Figma. | ||
|
||
### Dependencies: | ||
|
||
- Node.js and packages such as `node-fetch`, `dotenv`, and `fs` are used to manage API requests, read local files, and load environment variables. | ||
|
||
## Key functions | ||
|
||
### `updateModeCollection(jsonData, brand)` | ||
|
||
This function updates the color-scheme variables in Figma for a specific brand. It: | ||
|
||
- Fetches the current variables from Figma. | ||
- Updates modes and variables for `"Light"` and `"Dark"` color-schemes. | ||
- Sends a POST request to update Figma with the new data. | ||
|
||
### `updateBrandCollection(jsonData)` | ||
|
||
This function focuses on updating color variables in the "Brand" collection. It: | ||
|
||
- Maps color variables from the "Mode" collection to the "Brand" collection. | ||
- Adds non-color variables for each brand. | ||
- Creates or updates modes for each brand. | ||
- Ensures proper aliasing of variables between collections. | ||
|
||
## Usage | ||
|
||
1. Navigate to the `tokens/figma` directory: | ||
|
||
```bash | ||
cd tokens/figma | ||
|
||
``` | ||
|
||
2. Run the script | ||
```bash | ||
node index.mjs | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import dotenv from "dotenv"; | ||
|
||
dotenv.config({ path: "../../.env" }); | ||
|
||
import { BRANDS } from "./utils/constants.mjs"; | ||
|
||
export const BRAND_KEY = { | ||
[BRANDS.MOVISTAR]: "ObNHOLPtrIytjy9BH7M9jW", | ||
[BRANDS.O2_NEW]: "CjvgrHEIycSQ6exznxnFXT", | ||
[BRANDS.VIVO_NEW]: "EApRpjaTyUOwW5VQU2ZqgP", | ||
[BRANDS.TELEFONICA]: "m8srmP3eedfvDaqYnbM6PI", | ||
[BRANDS.BLAU]: "czemeClWRGBI8oF7caNa5m", | ||
[BRANDS.TU]: "19IXMaFqdYeC1IIdTwXBgY", | ||
}; | ||
|
||
export const MIDDLEWARE_KEY = | ||
"w7fBxCsEb8WrMVVuxDnCQd"; | ||
|
||
export const FIGMA_TOKEN = | ||
process.env.FIGMA_TOKEN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
|
||
import { updateSkinFiles } from "./update-skins.mjs"; | ||
import { updateMiddleware } from "./update-middleware.mjs"; | ||
|
||
import { | ||
extractSkinJsonData, | ||
extractMiddlewareJsonData, | ||
} from "./utils/extract-json-data.mjs"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
const tokensPath = path.resolve(__dirname, "../"); | ||
|
||
const files = fs.readdirSync(tokensPath); | ||
|
||
const jsonFiles = files.filter((file) => | ||
file.endsWith(".json") | ||
); | ||
|
||
const jsonDataForSkin = extractSkinJsonData( | ||
jsonFiles, | ||
tokensPath | ||
); | ||
|
||
const jsonDataForMiddleware = | ||
extractMiddlewareJsonData( | ||
jsonFiles, | ||
tokensPath | ||
); | ||
|
||
async function processAll() { | ||
await updateSkinFiles(jsonDataForSkin); | ||
await updateMiddleware(jsonDataForMiddleware); | ||
} | ||
|
||
processAll(); |
Oops, something went wrong.