Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions scripts/variable-exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ const FIGMA_FILE_KEY = process.env.FIGMA_FILE_KEY;
const OUTPUT_DIR = "src/variables";

const WANTED_COLLECTIONS = new Set([
"1. Semantic colors",
"1.1 Base colors",
"2. Semantic dimensions",
"2.1 Base dimensions",
"3. Semantic fonts",
"3.1 Base fonts",
"TEDI colors base",
"TEDI colors semantic",
"TEDI dimensions base",
"TEDI dimensions semantic",
"TEDI fonts base",
"TEDI fonts semantic",
]);

const THEME_MAP: Record<string, { folder: string; fileSuffix: string }> = {
default: { folder: "default", fileSuffix: "default" },
light: { folder: "default", fileSuffix: "default" },
dark: { folder: "default", fileSuffix: "dark" },
muis: { folder: "muis", fileSuffix: "muis" },
rit: { folder: "rit", fileSuffix: "rit" },
};

const RESPONSIVE_MEDIA: Record<string, string> = {
Expand Down Expand Up @@ -194,7 +192,7 @@ async function run() {
);

const baseLines: string[] = [];
for (const coll of wantedColls.filter(c => c.name.includes("Base"))) {
for (const coll of wantedColls.filter(c => c.name.includes("base"))) {
const modeId = coll.defaultModeId ?? coll.modes[0]?.modeId;
if (!modeId) continue;

Expand All @@ -216,11 +214,11 @@ async function run() {
fs.writeFileSync(path.join(OUTPUT_DIR, "_base-variables.scss"), css);
}

for (const coll of wantedColls.filter(c => !c.name.includes("Base"))) {
for (const coll of wantedColls.filter(c => !c.name.includes("base"))) {
const unit = getUnit(coll.name);
const isFonts = coll.name === "3. Semantic fonts";
const isColors = coll.name === "1. Semantic colors";
const isDimensions = coll.name === "2. Semantic dimensions";
const isFonts = coll.name === "TEDI fonts semantic";
const isColors = coll.name === "TEDI colors semantic";
const isDimensions = coll.name === "TEDI dimensions semantic";

if (isFonts) {
const desktopLines: string[] = [];
Expand Down
Loading