Skip to content

Commit

Permalink
renamed configs
Browse files Browse the repository at this point in the history
  • Loading branch information
mimarz committed Jun 6, 2024
1 parent 3ddc435 commit 5bd02c3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions packages/cli/src/tokens/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import * as R from 'ramda';
import type { ThemeObject } from '@tokens-studio/types';

import { nameKebab, typographyShorthand, sizeRem } from './transformers.js';
import { groupedTokens } from './formats/groupedTokens.js';
import { scopedReferenceVariables } from './formats/scopedReferenceVariables.js';
import { typographyClasses } from './formats/typographyClasses.js';
import { storefrontFormat } from './formats/groupedTokens.js';
import { colormodeFormat } from './formats/scopedReferenceVariables.js';
import { typographyFormat } from './formats/typographyClasses.js';
import { makeEntryFile } from './actions.js';

void tokenStudio.registerTransforms(StyleDictionary);
Expand All @@ -22,9 +22,9 @@ StyleDictionary.registerTransform(sizeRem);
StyleDictionary.registerTransform(nameKebab);
StyleDictionary.registerTransform(typographyShorthand);

StyleDictionary.registerFormat(groupedTokens);
StyleDictionary.registerFormat(scopedReferenceVariables);
StyleDictionary.registerFormat(typographyClasses);
StyleDictionary.registerFormat(storefrontFormat);
StyleDictionary.registerFormat(colormodeFormat);
StyleDictionary.registerFormat(typographyFormat);

StyleDictionary.registerAction(makeEntryFile);

Expand Down Expand Up @@ -80,7 +80,7 @@ export const tokensConfig: GetConfig = ({ mode = 'light', outPath, theme }) => {
files: [
{
destination: `color-modes/${mode}.css`,
format: scopedReferenceVariables.name,
format: colormodeFormat.name,
},
],
options: {
Expand Down Expand Up @@ -113,7 +113,7 @@ export const previewConfig: GetConfig = ({ mode = 'unknown', outPath, theme }) =
files: [
{
destination: `${mode}.ts`,
format: groupedTokens.name,
format: storefrontFormat.name,
filter: (token: TransformedToken) => {
if (
R.test(/accent|neutral|brand1|brand2|brand3|success|danger|warning/, token.name) ||
Expand Down Expand Up @@ -148,7 +148,7 @@ export const typographyConfig: GetConfig = ({ outPath, theme, typography }) => {
files: [
{
destination: `typography/${typography}.css`,
format: typographyClasses.name,
format: typographyFormat.name,
filter: (token) => token.type === 'typography',
},
],
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/tokens/formats/groupedTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const toCssVarName = R.pipe(R.split(':'), R.head, R.trim);
/**
* Format for displaying tokens in storefront
*/
export const groupedTokens: Format = {
name: 'groupedTokens',
export const storefrontFormat: Format = {
name: 'ds/storefront',
format: async function ({ dictionary, file }) {
const format = createPropertyFormatter({
dictionary,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/tokens/formats/scopedReferenceVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 scopedReferenceVariables: Format = {
name: 'css/variables-scoped-references',
export const colormodeFormat: Format = {
name: 'ds/colormode',
format: async function ({ dictionary, file, options, platform }) {
const { allTokens, unfilteredTokens } = dictionary;
const { usesDtcg, outputReferences } = options;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/tokens/formats/typographyClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type Typgraphy = {
/**
* Creates CSS classes from typography tokens
*/
export const typographyClasses: Format = {
name: 'typographyClasses',
export const typographyFormat: Format = {
name: 'ds/typography',
format: async function ({ dictionary, file, options, platform }) {
const { usesDtcg } = options;
const { basePxFontSize } = platform;
Expand Down

0 comments on commit 5bd02c3

Please sign in to comment.