mirror of
https://github.com/anuraghazra/github-readme-stats.git
synced 2024-12-15 06:04:17 +08:00
107f7ca52c
* GRS-1955: Using ES6 import/export in src files * GRS-1955: Using ES6 import/export in test files * GRS-1955: Using ES6 import/export in themes index.js * GRS-1955: Readding blank line at end of top-languages-card.js * feat: fix test es6 import errors This commit makes sure jest is set-up to support es6. It also fixes several test errors and sorts the imports. * test: update test node version This commit makes sure node 16 is used in the github actions. * refactor: run prettier Co-authored-by: rickstaa <rick.staa@outlook.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, " "),
|
|
);
|
|
});
|