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

DO NOT MERGE: Automated tokens #268

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"request": "launch",
"name": "Scripts Update Debugger",
"skipFiles": ["<node_internals>/**"],
"args": ["command=update"],
"args": ["command=update", "format=design"],
"program": "${workspaceFolder}/scripts/index.js"
}
]
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build:android": "npm run build:clean && node theme_generator.js --target=targets/android.json",
"publishNpm": "./publishNpm.sh",
"scripts": "node ./scripts/index.js",
"scripts:update": "node ./scripts/index.js --command=update --format=automated",
"scripts:update": "node ./scripts/index.js --command=update --format=design",
"test": "npm run test:scripts && npm run build:web && npm run build:windows && npm run build:macos && npm run build:ios && npm run build:android",
"test:scripts": "jest ./scripts",
"prepare": "husky install"
Expand All @@ -52,6 +52,7 @@
"**/*": "npx prettier --write --ignore-unknown"
},
"dependencies": {
"momentum-abstract": "^1.0.28"
"momentum-abstract": "^1.0.28",
"@momentum-design/tokens": "^0.0.7"
}
}
10 changes: 5 additions & 5 deletions scripts/commands/update/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ const update = (format) => {
};
next = automated;
} else if (format === ColorToken.CONSTANTS.TOKEN_FORMATS.DESIGN) {
nextTokens.design = require("@momentum-design/tokens/dist/webex/json/core.json");
nextTokens.design = require("@momentum-design/tokens/dist/json/core/complete.json");
const design = {
functional: new ColorToken({
format: ColorToken.CONSTANTS.TOKEN_FORMATS.DESIGN,
data: nextTokens.core.color.core,
data: nextTokens.design.color.core,
}).normalize(),
decorative: new ColorToken({
format: ColorToken.CONSTANTS.TOKEN_FORMATS.DESIGN,
data: nextTokens.core.color.decorative,
data: nextTokens.design.color.decorative,
}).normalize(),
gradation: new GradientToken({
format: ColorToken.CONSTANTS.TOKEN_FORMATS.DESIGN,
data: { gradation: nextTokens.core.color.gradient },
data: { gradation: nextTokens.design.color.gradient },
}).normalize(),
solids: new SolidToken({
format: ColorToken.CONSTANTS.TOKEN_FORMATS.DESIGN,
data: nextTokens.core.color.mobile,
data: nextTokens.design.color.mobile,
}).normalize(),
};
next = design;
Expand Down
4 changes: 3 additions & 1 deletion scripts/models/solid-token/solid-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ class SolidToken extends Token {
break;

case SolidToken.CONSTANTS.TOKEN_FORMATS.DESIGN:
normalized = Object.entries(colors).reduce((mutated, [key, value]) => {
const values = Object.entries(colors).reduce((mutated, [key, value]) => {
const normalized = SolidToken.normalizeTokens({ format, tokens: value });
return { ...mutated, [key]: { ...normalized } };
}, {});
normalized = {};
normalized.solid = { ...values };
break;

default:
Expand Down
Loading