forked from anuraghazra/github-readme-stats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added script to automate language color retrieval (anuraghazra#…
- Loading branch information
Showing
3 changed files
with
294 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const fs = require('fs'); | ||
const jsYaml = require('js-yaml'); | ||
const axios = require('axios'); | ||
|
||
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, ' ')); | ||
|
||
}); |
Oops, something went wrong.