Skip to content

Commit a42930d

Browse files
authored
chore: generate TypeScript tokens in the Tokens Studio release workflow (#5166)
* chore: generate TypeScript tokens in the Tokens Studio release workflow * chore: address review — proper TS literal serializer and lint cleanups
1 parent ace9192 commit a42930d

3 files changed

Lines changed: 410 additions & 7 deletions

File tree

.github/workflows/tokens_studio_release.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,29 @@ jobs:
7070
run: pnpm install --force
7171
- name: Pull tokens from Tokens Studio
7272
run: pnpm --filter @equinor/eds-tokens exec studio tokens pull --ci --verbose
73-
# Runs the saved "EDS" export configuration (CSS Variables) on the
74-
# platform and writes the generated CSS files. This output will
75-
# replace the local Style Dictionary build in the new pipeline —
76-
# it is not yet wired into the package exports map.
73+
# Runs the saved export configurations on the platform and writes
74+
# the generated files. This output will replace the local Style
75+
# Dictionary build in the new pipeline — it is not yet wired into
76+
# the package exports map.
77+
# The exports are referenced by ID, not name — a rename in Tokens
78+
# Studio must not break the pipeline (it already happened once).
7779
# --verbose because the run is unattended and the resulting PR gets
7880
# no CI — the Actions log is the only place to diagnose a bad export
79-
- name: Run CSS export from Tokens Studio
80-
run: pnpm --filter @equinor/eds-tokens exec studio exports run EDS --ci --verbose --out src/tokens/css
81+
- name: Run CSS export from Tokens Studio (EDS-CSS)
82+
run: pnpm --filter @equinor/eds-tokens exec studio exports run 39d37416-632b-4f04-b49b-cfaec63e3baa --ci --verbose --out src/tokens/css
83+
- name: Run DTCG export from Tokens Studio (EDS-DTCG)
84+
run: pnpm --filter @equinor/eds-tokens exec studio exports run 019463d4-9bef-4e37-9425-6de80eec87c8 --ci --verbose --out src/tokens/dtcg
85+
# TypeScript token modules are generated locally from the DTCG
86+
# export (structure) + CSS export (evaluated values) — the platform
87+
# has no TS export format. See the script header for details.
88+
- name: Generate TypeScript tokens
89+
run: pnpm --filter @equinor/eds-tokens run generate:ts-tokens
8190
- name: Create Pull Request
8291
uses: peter-evans/create-pull-request@v8
8392
with:
8493
commit-message: 'chore: update tokens from Tokens Studio release'
8594
title: 'chore: update tokens from Tokens Studio release'
86-
body: 'Automated pull of the token state after a Tokens Studio release: raw token sets via `studio tokens pull` (sources in `packages/eds-tokens/.studio.json`) and generated CSS via `studio exports run EDS` into `packages/eds-tokens/src/tokens/css/`.'
95+
body: 'Automated pull of the token state after a Tokens Studio release: raw token sets via `studio tokens pull` (sources in `packages/eds-tokens/.studio.json`), generated CSS (EDS-CSS export) into `packages/eds-tokens/src/tokens/css/`, DTCG (EDS-DTCG export) into `src/tokens/dtcg/`, and TypeScript modules generated from the two into `src/tokens/ts/`.'
8796
branch: tokens-studio-release
8897
# This workflow runs unattended (release-triggered) and the PR it
8998
# creates gets no CI runs, so a failed pull must not be silent

packages/eds-tokens/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"types": "tsc",
5353
"test": "vitest run",
5454
"test:watch": "vitest",
55+
"generate:ts-tokens": "node scripts/generate-ts-tokens.mjs",
5556
"prettier:check": "prettier --check src/",
5657
"build:variables:color-scheme": "build-color-scheme-variables",
5758
"build:variables:semantic:static": "build-semantic-static-variables",

0 commit comments

Comments
 (0)