Updated on 2026-08-14
This commit is contained in:
commit
81bf4b5296
128 changed files with 4244 additions and 477 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 0be9b5e9f7fe13c483f9d037617e36c8848f2842
|
||||
Subproject commit 76d6a50dc3161cfc6cc7055afc8ce4ba619ac5c6
|
||||
|
|
@ -1 +1 @@
|
|||
058e1ecd83440d5fda33512248f67176db593029c9b398e4a2692816703e451c
|
||||
7a974320353cf7ea1e0a25ca074f8e200ce44506044cc5b2bdcb00aee2c6dc85
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# token-gen
|
||||
|
||||
Generates Kotlin (Jetpack Compose) source files from design tokens defined in the `ds-tokens` git submodule.
|
||||
Generates Kotlin (Jetpack Compose) source files from design tokens and icons defined in the `ds-tokens` git submodule.
|
||||
|
||||
## Updating tokens
|
||||
|
||||
|
|
@ -23,10 +23,18 @@ Generates Kotlin (Jetpack Compose) source files from design tokens defined in th
|
|||
```bash
|
||||
cd core/ui/token-gen && npm run build
|
||||
```
|
||||
`npm run build` generates both tokens and icons. To regenerate only one of them:
|
||||
```bash
|
||||
npm run build:tokens # node build-tokens.mjs
|
||||
npm run build:icons # node build-icons.mjs
|
||||
```
|
||||
3. Commit the generated files (and the submodule pointer too, only if you ran step 1).
|
||||
|
||||
## How it works
|
||||
|
||||
The script uses [Style Dictionary v5](https://styledictionary.com/) with [@tokens-studio/sd-transforms](https://github.com/tokens-studio/sd-transforms) to read JSON token files from `core/ui/ds-tokens/tokens/` and generate Kotlin files into `core/ui/src/main/java/com/tangem/core/ui/res/generated/`.
|
||||
The build runs two scripts:
|
||||
|
||||
- **`build-tokens.mjs`** uses [Style Dictionary v5](https://styledictionary.com/) with [@tokens-studio/sd-transforms](https://github.com/tokens-studio/sd-transforms) to read JSON token files from `core/ui/ds-tokens/tokens/` and generate Kotlin files into `core/ui/src/main/java/com/tangem/core/ui/res/generated/`.
|
||||
- **`build-icons.mjs`** generates Kotlin icon source files into `core/ui/src/main/java/com/tangem/core/ui/res/generated/icons/`.
|
||||
|
||||
All generated files are written to `com.tangem.core.ui.res.generated` and should not be edited manually.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@
|
|||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "node build-tokens.mjs"
|
||||
"build": "node build-tokens.mjs && node build-icons.mjs",
|
||||
"build:tokens": "node build-tokens.mjs",
|
||||
"build:icons": "node build-icons.mjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"style-dictionary": "^5.4.0",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue