Primitree
API reference

CLI config API

Typed project configuration from @primitree/cli/config.

Interfaces

PrimitreeOutputConfig

Build output settings for one token source.

Properties

directory

readonly directory: string

A separate build output folder under the config file's folder.

formats?

readonly optional formats?: readonly PrimitreeOutputFormat[]

File sets to create.

Default Value

['dtcg', 'css', 'typescript', 'tailwind']


PrimitreeLayerConfig

One layer used when checking a token source.

Properties

id

readonly id: string

Name used in findings.

roots

readonly roots: readonly string[]

Exact first path segments assigned to this layer.

values

readonly values: PolicyValueRule

Value forms allowed in this layer.

references?

readonly optional references?: readonly string[]

Layers that this layer may reference.


PrimitreeArchitectureConfig

Layer rules for one token source.

Properties

layers

readonly layers: readonly PrimitreeLayerConfig[]

One to four ordered layers.


PrimitreeDTCGSourceConfig

One local DTCG token source.

Properties

type

readonly type: "dtcg"

Identifies a DTCG token document.

file

readonly file: string

Token file path, relative to the config file.

architecture

readonly architecture: PrimitreeArchitectureConfig

Layer rules checked for this source.

ownership?

readonly optional ownership?: PolicyOwnershipInput

Default owners and owners for exact root paths.

outputs?

readonly optional outputs?: PrimitreeOutputConfig

Files created after this source passes its checks.


PrimitreeConfig

Primitree project settings.

Properties

schemaVersion

readonly schemaVersion: 1

Config format version. Primitree 1.0 accepts version 1.

sources

readonly sources: Readonly<Record<string, PrimitreeDTCGSourceConfig>>

Each object key is a source name.

Type Aliases

PrimitreeOutputFormat

PrimitreeOutputFormat = "dtcg" | "css" | "typescript" | "tailwind"

A file set that primitree build can create from one DTCG source.

Functions

defineConfig()

defineConfig(config): PrimitreeConfig

Add TypeScript checks to a Primitree project config.

Parameters

config

PrimitreeConfig

Project settings.

Returns

PrimitreeConfig

The same object.