From 63811e03d5c5f0ecc3f810cba548901c710f51e6 Mon Sep 17 00:00:00 2001 From: Michael Marszalek Date: Thu, 6 Jun 2024 20:09:09 +0200 Subject: [PATCH] =?UTF-8?q?updated=20format=20names=20again=20=F0=9F=A4=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cli/src/tokens/configs.ts | 18 +++++++++--------- packages/cli/src/tokens/formats/css-classes.ts | 4 ++-- .../cli/src/tokens/formats/css-variables.ts | 4 ++-- packages/cli/src/tokens/formats/js-tokens.ts | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/tokens/configs.ts b/packages/cli/src/tokens/configs.ts index 1219231fc7..0ed05312eb 100644 --- a/packages/cli/src/tokens/configs.ts +++ b/packages/cli/src/tokens/configs.ts @@ -5,9 +5,9 @@ import * as R from 'ramda'; import type { ThemeObject } from '@tokens-studio/types'; import { nameKebab, typographyShorthand, sizeRem } from './transformers.js'; -import { storefrontFormat } from './formats/js-tokens.js'; -import { colormodeFormat } from './formats/css-variables.js'; -import { typographyFormat } from './formats/css-classes.js'; +import { jsTokens } from './formats/js-tokens.js'; +import { cssVariables } from './formats/css-variables.js'; +import { cssClasses } from './formats/css-classes.js'; import { makeEntryFile } from './actions.js'; void tokenStudio.registerTransforms(StyleDictionary); @@ -22,9 +22,9 @@ StyleDictionary.registerTransform(sizeRem); StyleDictionary.registerTransform(nameKebab); StyleDictionary.registerTransform(typographyShorthand); -StyleDictionary.registerFormat(storefrontFormat); -StyleDictionary.registerFormat(colormodeFormat); -StyleDictionary.registerFormat(typographyFormat); +StyleDictionary.registerFormat(jsTokens); +StyleDictionary.registerFormat(cssVariables); +StyleDictionary.registerFormat(cssClasses); StyleDictionary.registerAction(makeEntryFile); @@ -80,7 +80,7 @@ export const tokensConfig: GetConfig = ({ mode = 'light', outPath, theme }) => { files: [ { destination: `color-modes/${mode}.css`, - format: colormodeFormat.name, + format: cssVariables.name, }, ], options: { @@ -113,7 +113,7 @@ export const previewConfig: GetConfig = ({ mode = 'unknown', outPath, theme }) = files: [ { destination: `${mode}.ts`, - format: storefrontFormat.name, + format: jsTokens.name, filter: (token: TransformedToken) => { if ( R.test(/accent|neutral|brand1|brand2|brand3|success|danger|warning/, token.name) || @@ -148,7 +148,7 @@ export const typographyConfig: GetConfig = ({ outPath, theme, typography }) => { files: [ { destination: `typography/${typography}.css`, - format: typographyFormat.name, + format: cssClasses.name, filter: (token) => token.type === 'typography', }, ], diff --git a/packages/cli/src/tokens/formats/css-classes.ts b/packages/cli/src/tokens/formats/css-classes.ts index d4ab6f056e..8ce1f6647b 100644 --- a/packages/cli/src/tokens/formats/css-classes.ts +++ b/packages/cli/src/tokens/formats/css-classes.ts @@ -14,8 +14,8 @@ type Typgraphy = { /** * Creates CSS classes from typography tokens */ -export const typographyFormat: Format = { - name: 'ds/typography', +export const cssClasses: Format = { + name: 'ds/css-classes', format: async function ({ dictionary, file, options, platform }) { const { usesDtcg } = options; const { basePxFontSize } = platform; diff --git a/packages/cli/src/tokens/formats/css-variables.ts b/packages/cli/src/tokens/formats/css-variables.ts index 9c3288cb73..893fe075c9 100644 --- a/packages/cli/src/tokens/formats/css-variables.ts +++ b/packages/cli/src/tokens/formats/css-variables.ts @@ -6,8 +6,8 @@ type IncludeReferences = (token: TransformedToken) => boolean; /** * CSS variables format with option to include source references for matched token through `options.referencesFilter` */ -export const colormodeFormat: Format = { - name: 'ds/colormode', +export const cssVariables: Format = { + name: 'ds/css-variables', format: async function ({ dictionary, file, options, platform }) { const { allTokens, unfilteredTokens } = dictionary; const { usesDtcg, outputReferences } = options; diff --git a/packages/cli/src/tokens/formats/js-tokens.ts b/packages/cli/src/tokens/formats/js-tokens.ts index 6aea9b11c0..519b0a9db5 100644 --- a/packages/cli/src/tokens/formats/js-tokens.ts +++ b/packages/cli/src/tokens/formats/js-tokens.ts @@ -14,8 +14,8 @@ const toCssVarName = R.pipe(R.split(':'), R.head, R.trim); /** * Format for displaying tokens in storefront */ -export const storefrontFormat: Format = { - name: 'ds/storefront', +export const jsTokens: Format = { + name: 'ds/js-tokens', format: async function ({ dictionary, file }) { const format = createPropertyFormatter({ dictionary,