From e7f15d827e5e3cf97564962cd2aab195c6239654 Mon Sep 17 00:00:00 2001 From: Ewelina Skibinska Date: Tue, 25 Jun 2024 10:20:33 +0100 Subject: [PATCH] task: no need to update file --- .github/workflows/create-tokens.yml | 3 --- package.json | 3 +-- tokens/$metadata.json | 24 +++++++++---------- update-metadata.js | 37 ----------------------------- 4 files changed, 13 insertions(+), 54 deletions(-) delete mode 100644 update-metadata.js diff --git a/.github/workflows/create-tokens.yml b/.github/workflows/create-tokens.yml index fbb4681..6154591 100644 --- a/.github/workflows/create-tokens.yml +++ b/.github/workflows/create-tokens.yml @@ -22,9 +22,6 @@ jobs: - name: Split tokens.json file run: npm run split-json - - name: Update $metadata.json file - run: npm run update-metadata - # Convert tokens according to Style Dictionary config - name: Run style-dictionary run: npm run build diff --git a/package.json b/package.json index 3972bdc..b7f805b 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,7 @@ }, "scripts": { "build": "node build.js", - "split-json": "node split-json.js", - "update-metadata": "node update-metadata.js" + "split-json": "node split-json.js" }, "author": "", "license": "MIT", diff --git a/tokens/$metadata.json b/tokens/$metadata.json index 20d9dc7..ae4fe06 100644 --- a/tokens/$metadata.json +++ b/tokens/$metadata.json @@ -1,16 +1,16 @@ { "tokenSetOrder": [ - "core", - "semantic", - "dot-org", - "funding", - "funding-search", - "insights-and-data-finder", - "trustnet", - "collection-core", - "collection-theme", - "desktop", - "tablet", - "mobile" + "GLOBAL/core", + "GLOBAL/semantic", + "PRODUCTS/dot org", + "PRODUCTS/funding", + "PRODUCTS/funding search", + "PRODUCTS/insights and data finder", + "PRODUCTS/trustnet", + "PRODUCTS/COLLECTION/core", + "PRODUCTS/COLLECTION/theme", + "BREAKPOINTS/desktop", + "BREAKPOINTS/tablet", + "BREAKPOINTS/mobile" ] } \ No newline at end of file diff --git a/update-metadata.js b/update-metadata.js deleted file mode 100644 index c5ccd16..0000000 --- a/update-metadata.js +++ /dev/null @@ -1,37 +0,0 @@ -import fs from 'node:fs'; -import path from 'path'; -import { fileURLToPath } from 'url'; - -// Get the current directory of the script -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -// Read the JSON file -const jsonFile = path.join(__dirname, 'tokens/$metadata.json'); -const rawData = fs.readFileSync(jsonFile); -const metadata = JSON.parse(rawData); - -// Process the tokenSetOrder array -const updatedTokenSetOrder = metadata.tokenSetOrder.map(key => { -// Split the key into parts -let keyParts = key.split('/'); - -// Remove the first part if there are multiple parts -if (keyParts.length > 1) { -keyParts.shift(); -} - -// Replace spaces in each part with hyphens -keyParts = keyParts.map(part => part.replace(/\s+/g, '-')); - -// Join the remaining parts with '-' and convert to lowercase -return keyParts.join('-').toLowerCase(); -}); - -// Update the metadata object -metadata.tokenSetOrder = updatedTokenSetOrder; - -// Write the updated metadata back to the JSON file -fs.writeFileSync(jsonFile, JSON.stringify(metadata, null, 2)); - -console.log('$metadata.json has been updated.'); \ No newline at end of file