Skip to content

Commit 21cc8a2

Browse files
committed
docs: add ADR for temporary next subpaths during eds-tokens beta
1 parent f1bfc56 commit 21cc8a2

3 files changed

Lines changed: 97 additions & 4 deletions

File tree

.github/workflows/publish_tokens.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ jobs:
106106
# The Tokens Studio pipeline output (src/tokens/{css,dtcg,ts}) is only
107107
# published on the beta line, additively under ./next/* subpaths. The
108108
# stable specifiers (./css/variables etc.) keep serving the legacy
109-
# build until the new output replaces it at graduation.
109+
# build while /next components migrate to the new variable names;
110+
# once that migration completes, a beta release drops the legacy build
111+
# and moves this output to the final specifiers — before graduation,
112+
# so the 3.0.0 export surface is tested in beta. See
113+
# documentation/adr/0009-temporary-next-subpaths-for-eds-tokens-beta.md.
110114
# Ordering dependency: these package.json edits (and the version bump
111115
# above) happen before `pnpm publish` runs prepublishOnly (the build) —
112116
# if a build step ever starts generating package.json, it would
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Publish Tokens Studio output under temporary `next/*` subpaths during the eds-tokens beta
2+
3+
- **Status:** Accepted
4+
- **Date:** 2026-07-20
5+
- **Decision makers:** Frida Erdal, EDS Core Team
6+
7+
## Context
8+
9+
The whole `@equinor/eds-tokens` package is in beta while the Tokens Studio pipeline replaces the legacy Figma-REST + Style Dictionary build (every release is a pinned `3.0.0-beta.N` on the npm `beta` dist-tag; `latest` stays on 2.x). The new pipeline produces a different output shape — granular, attribute-scoped CSS files (`css/{colors,color-scheme,semantic,primitives,font,density}/*.css`) instead of one bundled `variables.min.css` — and an entirely different variable vocabulary (`--eds-background-container-*`, `--eds-density-spacing-*`, `--eds-family-ui`, …) replacing the legacy names (`--eds-color-*`, `--eds-typography-*`, `--eds-spacing-*`, …).
10+
11+
The new variables are tested together with `eds-core-react-next` (the `/next` beta line), whose component CSS will be rewritten to the new variable names. That migration happens **component by component** so the team can collaborate on it. During the migration window, an app running the betas has some components resolving legacy names and some resolving new names — both variable sets must be importable from a single installed version of the tokens package.
12+
13+
The question this ADR answers: which export specifiers should the new output occupy during the beta — the final ones (`./css/*` etc., replacing the legacy build immediately) or temporary ones alongside it?
14+
15+
## Decision Drivers
16+
17+
- Unmigrated `/next` components reference only legacy variable names — they render unstyled without the legacy bundle
18+
- Component migration is gradual and collaborative; a mixed period is unavoidable
19+
- The beta line should validate the exact 3.0.0 export surface before graduation
20+
- Every variable name changes between 2.x and 3.0 regardless of paths, so keeping import specifiers identical offers no real drop-in compatibility
21+
- Stable 2.x consumers must stay unaffected (they are: `latest` never moves during the beta)
22+
23+
## Options Considered
24+
25+
### Option 1: Ship the new output on the final specifiers immediately
26+
27+
Drop the legacy `build/` output from beta publishes and point `./css/*` (and a bundled `./css/variables` equivalent) at the Tokens Studio output from the first beta.
28+
29+
**Pros:**
30+
31+
- Beta testers exercise the exact 3.0.0 import surface from day one
32+
- No later path migration for testers
33+
34+
**Cons:**
35+
36+
- Breaks every unmigrated `/next` component the moment a tester installs `@beta` — the legacy variables they reference no longer ship
37+
- The path continuity is misleading: the import line survives the upgrade but every `var()` reference behind it breaks, since the variable names change wholesale
38+
- The new pipeline produces no single-bundle equivalent for `./css/variables`; a concat step would have to be built up front
39+
40+
### Option 2: Temporary additive `next/*` subpaths (chosen)
41+
42+
Keep the legacy build on its current specifiers and add the new output under `./next/{css,dtcg,ts}/*`, injected into `files`/`exports` at publish time by `publish_tokens.yaml` (the `exports` map in git stays legacy-only).
43+
44+
**Pros:**
45+
46+
- Both variable sets resolve from one installed version — required during the component-by-component migration
47+
- Legacy specifiers keep working for anything not yet migrated
48+
- The injection is beta-only and additive, so nothing about the stable package definition changes in git
49+
50+
**Cons:**
51+
52+
- Testers adopt `next/*` paths that will not survive to 3.0.0 stable (mitigated: the later change is a mechanical find-and-replace of the path prefix, trivial next to the unavoidable variable-name migration)
53+
54+
### Option 3: Two installed versions via npm alias
55+
56+
Let test apps install the stable package and the beta side by side (`npm install eds-tokens-beta@npm:@equinor/eds-tokens@beta`).
57+
58+
**Pros:**
59+
60+
- No export-map changes at all
61+
62+
**Cons:**
63+
64+
- Every tester manages two installs and two package names in imports
65+
- Version skew between the pair is easy to get wrong and hard to support
66+
67+
## Decision
68+
69+
**Option 2.** The Tokens Studio output ships additively under temporary `./next/{css,dtcg,ts}/*` subpaths for as long as the `/next` component migration is in progress.
70+
71+
**Exit plan:** when the last `/next` component has migrated to the new variable names, a beta release drops the legacy `build/` output and moves the Tokens Studio output onto the final specifiers. That flip happens **inside the beta line**, not at graduation, so at least one beta release exposes the exact 3.0.0 export surface for testing. Graduating to `3.0.0` stable then changes nothing about imports.
72+
73+
### Consequences
74+
75+
- Good, because the tokens beta and eds-core-react-next beta can be tested together at every point of the migration, in any mixed state
76+
- Good, because the 3.0.0 API is still validated in beta before it ships stable — just at the end of the migration instead of the start
77+
- Bad, because beta testers migrate import paths once (`/next/css/…``/css/…`) before graduation; announcements and docs for the beta must state up front that the `next/*` paths are temporary
78+
- Bad, because the final specifier layout (granular `./css/*` only, or also a bundled convenience entry) remains an open decision that must be made before the flip
79+
80+
## Related
81+
82+
- [ADR-0008](./0008-generate-ts-tokens-from-studio-exports.md) — how the TS output under `next/ts/*` is generated
83+
- [`documentation/agent-instructions/TOKENS_STUDIO.md`](../agent-instructions/TOKENS_STUDIO.md) — pipeline documentation
84+
- `.github/workflows/publish_tokens.yaml` — the beta-only publish-time injection
85+
- `packages/eds-tokens/src/tokens/README.md` — the generated output this applies to
86+
- Issue [#5108](https://github.com/equinor/design-system/issues/5108); PR [#5180](https://github.com/equinor/design-system/pull/5180)

packages/eds-tokens/src/tokens/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ The generated output is published on the beta line
1717
(`@equinor/eds-tokens@beta`, injected at publish time by
1818
`.github/workflows/publish_tokens.yaml` under temporary additive
1919
`./next/{css,dtcg,ts}/*` subpaths) — the `exports` map in git still serves
20-
the legacy Style Dictionary build in `build/`. Note that `./next/ts/*`
21-
ships raw `.ts` modules (no compiled `.js`/`.d.ts`), so it requires a
22-
TypeScript-aware consumer.
20+
the legacy Style Dictionary build in `build/`. The `next/*` subpaths last
21+
only until the `/next` components finish migrating to the new variable
22+
names; the output then moves to the final specifiers within the beta line —
23+
see [ADR-0009](../../../../documentation/adr/0009-temporary-next-subpaths-for-eds-tokens-beta.md)
24+
for the full lifecycle. Note that `./next/ts/*` ships raw `.ts` modules
25+
(no compiled `.js`/`.d.ts`), so it requires a TypeScript-aware consumer.
2326

2427
Pipeline documentation: [`documentation/agent-instructions/TOKENS_STUDIO.md`](../../../../documentation/agent-instructions/TOKENS_STUDIO.md).

0 commit comments

Comments
 (0)