Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildTypography(typographyDir) {
console.log("Building Typography Variables");
console.log("Reading data from " + typographyDir);
var dir = List.hd(List.filter((function (file) {
return +(file !== "page.json");
}))($$Array.to_list(Fs.readdirSync(typographyDir))));
var typos = List.map((function (json) {
return /* record */[
/* name */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 0),
/* value */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 1)
];
}), List.map(Json.parseOrRaise, List.map((function (file) {
return Fs.readFileSync(typographyDir + ("/" + (dir + ("/" + file))), "utf8");
}), List.filter((function (file) {
return +(file !== "artboard.json");
console.log("Building Color Variables!");
console.log("Reading data from " + colorsDir);
var clrs = List.map((function (json) {
return /* record */[
/* name */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 0),
/* hex */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 1)
];
}), List.map(Json.parseOrRaise, List.map((function (file) {
return Fs.readFileSync(colorsDir + ("/" + file), "utf8");
}), List.filter((function (file) {
if (file !== "page.json") {
return +file.includes(".json");
} else {
return /* false */0;
}
}))($$Array.to_list(Fs.readdirSync(colorsDir))))));
return /* Colors */Block.__(0, [clrs]);
}
return +(file !== "page.json");
}))($$Array.to_list(Fs.readdirSync(typographyDir))));
var typos = List.map((function (json) {
return /* record */[
/* name */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 0),
/* value */Caml_array.caml_array_get(Json_decode.field("overrideValues", (function (param) {
return Json_decode.array((function (param) {
return Json_decode.field("value", Json_decode.string, param);
}), param);
}), json), 1)
];
}), List.map(Json.parseOrRaise, List.map((function (file) {
return Fs.readFileSync(typographyDir + ("/" + (dir + ("/" + file))), "utf8");
}), List.filter((function (file) {
return +(file !== "artboard.json");
}))($$Array.to_list(Fs.readdirSync(typographyDir + ("/" + dir)))))));
return /* Typography */Block.__(1, [typos]);
}