* tests: fix float problems and PAT problem * extend CONTRIBUTING.md * extend build documentation, add GH action, fix build on MacOS * fix build on Vercel * update .gitignore and CONTRIBUTING.md * feat: begin work on monorepo * chore(actions/basic-build): use pnpm * fix: vercel-deploy * docs: updates with new folders * chore: apply PR review comments --------- Co-authored-by: martin-mfg <2026226+martin-mfg@users.noreply.github.com>
31 lines
793 B
JavaScript
31 lines
793 B
JavaScript
import axios from "axios";
|
|
import fs from "fs";
|
|
import jsYaml from "js-yaml";
|
|
|
|
const LANGS_FILEPATH = "./src/common/languageColors.json";
|
|
|
|
//Retrieve languages from github linguist repository yaml file
|
|
//@ts-ignore
|
|
axios
|
|
.get(
|
|
"https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml",
|
|
)
|
|
.then((response) => {
|
|
//and convert them to a JS Object
|
|
const languages = jsYaml.load(response.data);
|
|
|
|
const languageColors = {};
|
|
|
|
//Filter only language colors from the whole file
|
|
Object.keys(languages).forEach((lang) => {
|
|
languageColors[lang] = languages[lang].color;
|
|
});
|
|
|
|
//Debug Print
|
|
//console.dir(languageColors);
|
|
fs.writeFileSync(
|
|
LANGS_FILEPATH,
|
|
JSON.stringify(languageColors, null, " "),
|
|
);
|
|
});
|