Skip to content

Commit

Permalink
chore: change themeable analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema committed May 2, 2024
1 parent dc4b6a1 commit da7c4ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion build-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ const components = ["button"];

async function run() {
const $themes = JSON.parse(await promises.readFile("tokens/$themes.json"));
const tokensets = [
...new Set(
$themes.reduce(
(acc, theme) => [...acc, ...Object.keys(theme.selectedTokenSets)],
[]
)
),
];
const themeableSets = tokensets.filter((set) => {
return !$themes.every((theme) =>
Object.keys(theme.selectedTokenSets).includes(set)
);
});

const configs = $themes.map((theme) => ({
__theme__: theme,
Expand Down Expand Up @@ -69,7 +82,7 @@ async function run() {
const set = token.filePath
.replace(/^tokens\//g, "")
.replace(/.json$/g, "");
return cfg.__theme__.selectedTokenSets[set] === "enabled";
return themeableSets.includes(set);
}

// Set token to themeable if it's part of an enabled set
Expand Down
2 changes: 1 addition & 1 deletion styles/core.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Do not edit directly
* Generated on Tue, 12 Mar 2024 13:49:57 GMT
* Generated on Thu, 02 May 2024 09:30:52 GMT
*/

:root {
Expand Down

0 comments on commit da7c4ea

Please sign in to comment.