# @telus-uds/system-tokens

> UDS design token tooling

Latest version **2.0.4** (published 2026-11-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @telus-uds/system-tokens
pnpm add @telus-uds/system-tokens
yarn add @telus-uds/system-tokens
bun add @telus-uds/system-tokens
```

Provides the commands `system-tokens-change`, `system-tokens-build-theme`, `system-tokens-build-palette`, `system-tokens-build-subtheme`, `system-tokens-build-subpalette`.

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2026-11-05 |
| First published | 2022-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 28 |
| Unpacked size | 152.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | TELUS Digital |
| Maintainers | pdufault, telusdigitaldelivery, stv-telus, shahzaibkhalid |
| Keywords | system |

## Links

- npm: https://www.npmjs.com/package/@telus-uds/system-tokens
- Repository: https://github.com/telus/universal-design-system
- Homepage: https://github.com/telus/universal-design-system#readme
- Issues: https://github.com/telus/universal-design-system/issues
- npm.io page: https://npm.io/package/@telus-uds/system-tokens

## Dependencies (28)

- [ajv](https://npm.io/package/ajv.md) ^8.18.0
- [flat](https://npm.io/package/flat.md) ^5.0.2
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [ramda](https://npm.io/package/ramda.md) ^0.27.1
- [dotenv](https://npm.io/package/dotenv.md) ^10.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.23
- [prompts](https://npm.io/package/prompts.md) ^2.4.2
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.4
- [signale](https://npm.io/package/signale.md) ^1.4.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.1.0
- [prettier](https://npm.io/package/prettier.md) ^2.7.1
- [@svgr/core](https://npm.io/package/@svgr/core.md) ^6.1.1
- [simple-git](https://npm.io/package/simple-git.md) ^4.0.2
- [tinycolor2](https://npm.io/package/tinycolor2.md) ^1.4.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.16.0
- [read-pkg-up](https://npm.io/package/read-pkg-up.md) ^7.0.1
- [deep-object-diff](https://npm.io/package/deep-object-diff.md) ^1.1.7
- [style-dictionary](https://npm.io/package/style-dictionary.md) ^3.0.0-rc.9
- [@svgr/plugin-svgo](https://npm.io/package/@svgr/plugin-svgo.md) ^6.1.0
- [@aws-sdk/client-s3](https://npm.io/package/@aws-sdk/client-s3.md) ^3.975.0
- [fluent-json-schema](https://npm.io/package/fluent-json-schema.md) ^3.0.1
- [@babel/eslint-parser](https://npm.io/package/@babel/eslint-parser.md) ^7.25.9
- [@svgr/plugin-prettier](https://npm.io/package/@svgr/plugin-prettier.md) ^6.0.0
- [@telus-uds/system-constants](https://npm.io/package/@telus-uds/system-constants.md) ^4.0.0
- [@telus-uds/system-theme-tokens](https://npm.io/package/@telus-uds/system-theme-tokens.md) ^5.3.0
- [@babel/plugin-transform-react-jsx](https://npm.io/package/@babel/plugin-transform-react-jsx.md) ^7.16.0
- [@babel/plugin-syntax-import-assertions](https://npm.io/package/@babel/plugin-syntax-import-assertions.md) ^7.26.0
- [@babel/plugin-transform-modules-commonjs](https://npm.io/package/@babel/plugin-transform-modules-commonjs.md) ^7.16.0

## Recent versions

- 2.0.4 (latest) — 2026-11-05
- 2.0.0-beta.1 (next) — 2026-05-29
- 2.0.3 — 2026-10-13
- 2.0.2 — 2026-08-10
- 2.0.1 — 2026-07-14
- 2.0.0 — 2026-06-08
- 1.4.17 — 2026-05-29
- 1.4.16 — 2026-05-22
- 2.0.0-beta.0 — 2026-05-21
- 2.0.0-alpha.2 — 2026-04-17
- 1.4.15 — 2026-04-16
- 2.0.0-alpha.1 — 2026-04-10
- 2.0.0-alpha.0 — 2026-03-20
- 1.4.14 — 2026-02-18
- 1.4.13 — 2026-01-29
- … 99 more at https://npm.io/package/@telus-uds/system-tokens/versions

## README

# System tokens

Validates and builds design token artifacts that can be consumed by various platforms (palettes and themes).

## Brand palette usage

### CLI

The easiest way to build a palette is with the CLI command:

1. Install:

   ```bash
   pnpm add -D @telus-uds/system-tokens
   ```

1. Add a run script to your `package.json` (this assumes the palette is located at `./palette.json`, if not you can set a path with the `PALETTE_PATH` env variable):

   ```javascript
   {
     // ...
     scripts: {
       "build": "system-tokens-build-palette"
     }
   }
   ```

1. Build the palette:
   ```bash
   pnpm run build
   ```

### Environment variables

The following variables are used:

| variable                | description                                                                                                                                                                                                                    |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `PALETTE_PATH`          | Path to palette JSON file to build, defaults to `palette.json`                                                                                                                                                                 |
| `AWS_ACCESS_KEY_ID`     | AWS access, see the [docs](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/loading-node-credentials-environment.html)                                                                                        |
| `AWS_SECRET_ACCESS_KEY` | AWS access, see the [docs](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/loading-node-credentials-environment.html)                                                                                        |
| `AWS_SESSION_TOKEN`     | AWS access (optional), see the [docs](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/loading-node-credentials-environment.html)                                                                             |
| `AWS_REGION`            | Storage region. Set to `auto` when targeting Cloudflare R2; otherwise an AWS region, see the [docs](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-region.html#setting-region-environment-variable) |
| `AWS_ENDPOINT_URL_S3`   | Override the S3 endpoint URL. Set to `https://<CLOUDFLARE_ACCOUNT_ID>.r2.cloudflarestorage.com` when targeting Cloudflare R2. Unset for AWS S3.                                                                                |
| `AWS_ASSET_BUCKET`      | Name of the S3-compatible bucket to upload assets to (production: `cdn-assets` on Cloudflare R2).                                                                                                                              |
| `AWS_ASSET_PREFIX`      | Object key prefix inside the bucket, such as `path/into/bucket/for/cdn`. Defaults to an empty string.                                                                                                                          |
| `CDN_ASSET_PREFIX`      | URL to the public facing assets, for example `https://my.cdn.com/path/to/assets/`. This is prepended to uploaded assets, defaults to an empty string.                                                                          |
| `CI`                    | If not set, asset uploading will be skipped                                                                                                                                                                                    |

Variables can be set by the environment or read from [`.env`](https://www.npmjs.com/package/dotenv)

## Theme usage

### Quick start

1. Install as a dev dependency into your UDS theme:

   ```bash
   pnpm add -D @telus-uds/system-tokens
   ```

1. Add a build script to the UDS theme package.json

   ```javascript
   {
     // ...
     "scripts": {
       "build": "UDS_PALETTE=@telus-uds/palette-your-palette system-tokens-build-theme"
     }
   }
   ```

   ℹ️ You will probably want to set some env vars also in the build script, see below for details

### Configuration

All configuration is done through environment variables.

- `UDS_THEME_PATH` is the input theme filename to build. Defaults to `./theme.json`.
- `UDS_THEME_SCHEMA` is the theme schema package defining the components and appearances to validate and build the theme for. Defaults to `@telus-uds/system-theme-tokens`, the schema package for the `@telus-uds/components-base`.
- `UDS_PALETTE` is the palette package for resolving theme tokens. Sensible examples are `@telus-uds/palette-allium`, `@telus-uds/palette-koodo`, or `@telus-uds/palette-public-mobile`.

Env vars can be set in the command line or via a `.env` file.

The theme is always outputted to `./build/theme.js`.

### Tokens

#### Icons

Icons are treated differently from other aliases.
Any token alias that has icon as at the second level (i.e. `*.icon.*`), will be treated as an icon.

Icon aliases are expected to resolve to a icon file that can be imported.
Icon imports are assumed to importable from an index file, ignoring the filename in the palette.

For example, if a icon alias resolves to the palette key:
`AddUser: '@telus-uds/palette-allium/build/rn/icons/add-user.icon.svg'`
the built theme will `import AddUser from '@telus-uds/palette-allium/build/rn/icons'`.

#### Fonts

Fonts are treated differently from other aliases.
Any token alias that has font at the second level (i.e. `*.font.*`), will be treated as an font.

Palette fonts are unwrapped to create virtual `fontName` and `fontWeight` palette keys.
For example, if the palette has the font keys:

```javascript
{
  font: {
    Times: {
      200: 'path/to/times-200.ttf',
      300: 'path/to/times-300.ttf'
    }
  }
}
```

The theme build will create the virtual palette keys:

```javascript
{
  fontName: {
    Times: 'Times'
  },
  fontWeight: {
    200: '200',
    300: '300'
  }
}
```

Themes should reference fonts by referencing a valid `fontName` and `fontWeight` combination.
The build will validate that these pairs reference a valid font in the original palette.

### Javascript API

A JS API can also be consumed directly.

```javascript
const buildTheme = require('@telus-uds/system-tokens/theme-build/build')

const options = {
  themeInput: {
    // Your theme input
  },
  tokens: {
    // Token aliases in the theme will be resolved to paths here
    system: {}
    palette: {}
  },
  // Appearances and component token types
  schema: {
    appearances: {},
    components: {}
  }
}

const context = builtTheme(options)

// The build theme
const {themeOutput} = context
```

## Change usage

`system-tokens` provides a wrapper around [beachball](https://microsoft.github.io/beachball/) to autogenerate change files for brand palettes and themes.
When using beachball for package release and publishing, this provides calculated semver version bumps and changelogs by diffing changes to the brand palette and theme.

### Quick start

1. Install as a dev dependency along with beachball into your repository that contains brand palettes or themes or both:

   ```bash
   pnpm add -D @telus-uds/system-tokens beachball
   ```

1. Add a change script to `package.json` (use the root `package.json` for monorepos)

   ```javascript
   {
     // ...
     "scripts": {
       "change": "system-tokens-change"
     }
   }
   ```

1. Use the change script add change files 🪄.
   For packages that don't support automatic semver bump and changes logs (packages _not_ starting with `palette-` or `theme-`), beachball will be executed to prompt the user for the change details:

   ```bash
   pnpm run change
   ```

   ℹ️ Change files will be automatically committed to the current branch inside the `change` folder.

---

Refer to the [UDS monorepo README](https://github.com/telus/universal-design-system/#readme) for details.

---
_Source: https://npm.io/package/@telus-uds/system-tokens · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
