Skip to content

Commit

Permalink
updated format names again 🤣
Browse files Browse the repository at this point in the history
  • Loading branch information
mimarz committed Jun 6, 2024
1 parent a1b402c commit 63811e0
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 { 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);
Expand All @@ -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);

Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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) ||
Expand Down Expand Up @@ -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',
},
],
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/tokens/formats/css-classes.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 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;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/tokens/formats/css-variables.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 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;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/tokens/formats/js-tokens.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 storefrontFormat: Format = {
name: 'ds/storefront',
export const jsTokens: Format = {
name: 'ds/js-tokens',
format: async function ({ dictionary, file }) {
const format = createPropertyFormatter({
dictionary,
Expand Down

0 comments on commit 63811e0

Please sign in to comment.