Skip to content

Commit

Permalink
chore: Make base type tokens tokens.
Browse files Browse the repository at this point in the history
We do not want to export our typography scale in Figma for end users, as we have specific usecases now. It is a bit of a pain to exclude the generated Figma variables or styles from publihsing. To support migration efforts we want it to still be available in the engineering token set.
  • Loading branch information
notlee committed Jan 7, 2025
1 parent f917fed commit f202d72
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
13 changes: 12 additions & 1 deletion apps/dictionary/src/transforms/private-prefix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import {tokenStudioThemeToBrand, getTokenStudioThemes} from '../utils.js';

const privatePrefix = token => {
return isTokenStudioSource(token) ? `_${token.name}` : token.name;
const isSourceExceptionForEngineering = token => {
// We do not want to export our typography scale in Figma for end users.
// However to support migration efforts we want it to still be available in the engineering token set.
if (token.filePath.includes('base/typography')) {
return true;
}
return false;
};

return isTokenStudioSource(token) && !isSourceExceptionForEngineering(token)
? `_${token.name}`
: token.name;
};

/*Get token theme from brand in token set file path.*/
Expand Down
14 changes: 7 additions & 7 deletions apps/dictionary/tokens/$themes.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"core/base/border-radius": "enabled",
"sustainable-views/base/border-radius": "disabled",
"internal/base/border-radius": "disabled",
"core/base/typography": "enabled",
"core/base/typography": "source",
"core/use-case/focus": "enabled"
},
"$figmaStyleReferences": {
Expand Down Expand Up @@ -230,7 +230,7 @@
"core/professional/components/o3-form": "source",
"sustainable-views/base/border-radius": "disabled",
"internal/base/border-radius": "disabled",
"core/base/typography": "enabled",
"core/base/typography": "source",
"core/use-case/focus": "enabled"
},
"$figmaStyleReferences": {
Expand Down Expand Up @@ -434,7 +434,7 @@
"internal/use-case/typography": "enabled",
"internal/components/o3-form": "source",
"internal/components/o3-form/use-case": "source",
"internal/base/typography": "enabled",
"internal/base/typography": "source",
"internal/use-case/focus": "enabled",
"internal/base/border-radius": "enabled"
},
Expand Down Expand Up @@ -589,9 +589,9 @@
"whitelabel/base/border-radius": "enabled",
"sustainable-views/base/border-radius": "disabled",
"internal/base/border-radius": "disabled",
"core/base/typography": "enabled",
"core/base/typography": "source",
"core/use-case/focus": "source",
"whitelabel/base/typography": "enabled",
"whitelabel/base/typography": "source",
"whitelabel/use-case/focus": "enabled"
},
"$figmaCollectionId": "VariableCollectionId:9567:451",
Expand Down Expand Up @@ -666,7 +666,7 @@
"sustainable-views/use-case/typography": "enabled",
"sustainable-views/components/o3-form": "source",
"sustainable-views/components/o3-form/use-case": "source",
"sustainable-views/base/typography": "enabled",
"sustainable-views/base/typography": "source",
"sustainable-views/use-case/focus": "enabled",
"sustainable-views/base/border-radius": "enabled",
"internal/base/border-radius": "disabled"
Expand Down Expand Up @@ -711,4 +711,4 @@
},
"group": "sustainable-views"
}
]
]

0 comments on commit f202d72

Please sign in to comment.