hpe-design-tokens
v2.5.0
Published
Design tokens for use with the HPE Design System.
Keywords
Readme
hpe-design-tokens
Design tokens for use with the HPE Design System.
Documentation Index
- Consumer usage: HPE Design System design tokens documentation
- Contributor workflow: CONTRIBUTING.md
- Maintainer operations and runbooks: docs/OPERATIONS.md
- Environment-isolated sync implementation context: docs/FIGMA_ENVIRONMENT_SYNC_PLAN.md
- Sync data model and flow details: docs/DOCUMENTATION.md
- Semantic color path structures and normalization contract: docs/SEMANTIC_COLOR_PATH_CONTRACT.md
- Sync contracts: contracts/README.md
Install
With pnpm:
pnpm i hpe-design-tokensWith yarn:
yarn add hpe-design-tokensWith npm:
npm i hpe-design-tokensUsage
For usage instructions, see HPE Design System design tokens documentation.
Quick Start (Maintainers)
From repository root:
pnpm --filter hpe-design-tokens test
pnpm --filter hpe-design-tokens test:contracts
pnpm --filter hpe-design-tokens sync-tokens-to-figma -- --env=test --dry-runSee docs/OPERATIONS.md for full sync runbooks, troubleshooting, and script coverage.
Semantic Color Parity Contract
Semantic color import/export behavior is protected by parity tests and golden fixtures.
Terminology note: in this monorepo, treat these parity artifacts as
snapshot files (referred to here as golden fixtures). They are contract
snapshots and should be updated only for intentional behavior changes, with
review of the resulting diff.
Semantic role metadata note:
role: nullmeans the token path does not include a semantic role segment.role.familyidentifies the role family grouping (e.g.accent); it isnullfor single-slot roles such asdisabled.role.nameis the canonical role name within its target (e.g.primary,disabled,purple).Parity scope:
- Legacy-vs-new adapter equivalence tests (
semantic_color_figma_adapter_parity.test.ts). - Golden output verification for export token output and import payload output (
semantic_color_payload_golden.test.ts). - Boundary vectors for non-canonical accent naming in both directions:
- Export fixture coverage for incoming Figma names such as
color/background/accent/purple-custom. - Import fixture coverage for aliases such as
color/background/accent/purple/custom/RESTthat must resolve to canonical variable IDs.
- Export fixture coverage for incoming Figma names such as
- Legacy-vs-new adapter equivalence tests (
Golden fixtures:
src/tests/fixtures/semantic-color-parity/export-output.golden.jsonsrc/tests/fixtures/semantic-color-parity/import-output.golden.json
When Golden Fixtures Should Change
Update golden fixtures only when semantic color normalization or payload behavior intentionally changes.
Examples:
- Introducing a deliberate naming contract change in import/export.
- Adjusting canonical mapping behavior for accent, focus, transparent, or interaction/scale handling.
Do not update fixtures to bypass a failing test without understanding the behavior delta.
Required Workflow Before PR
From repository root:
Always run:
pnpm --filter hpe-design-tokens run test:parity
pnpm --filter hpe-design-tokens test -- src/tests/token_export.test.ts src/tests/token_import.test.ts src/tests/token_import_alias_resolution.test.ts src/tests/semantic_color_parser.test.tsRun this only when you intentionally changed semantic color import/export behavior and expect golden fixture output updates:
pnpm --filter hpe-design-tokens run test:parity:updateIf fixture files change, include them in the same commit as the code change that caused the intentional behavior delta.
