mirror of
https://github.com/dilllxd/gitfolio.git
synced 2024-08-14 22:28:09 +00:00
Removed xo
This commit is contained in:
parent
566c7aea3a
commit
ee3ccb26ab
13 changed files with 478 additions and 469 deletions
18
.eslintrc.json
Normal file
18
.eslintrc.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"globals": {
|
||||||
|
"Atomics": "readonly",
|
||||||
|
"SharedArrayBuffer": "readonly"
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2018,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,4 +2,3 @@
|
||||||
[![Dependency Status](https://img.shields.io/david/k4ustu3h/gitfolio?style=for-the-badge)](https://david-dm.org/k4ustu3h/gitfolio)
|
[![Dependency Status](https://img.shields.io/david/k4ustu3h/gitfolio?style=for-the-badge)](https://david-dm.org/k4ustu3h/gitfolio)
|
||||||
[![devDependencies Status](https://img.shields.io/david/dev/k4ustu3h/gitfolio?style=for-the-badge)](https://david-dm.org/k4ustu3h/gitfolio?type=dev)
|
[![devDependencies Status](https://img.shields.io/david/dev/k4ustu3h/gitfolio?style=for-the-badge)](https://david-dm.org/k4ustu3h/gitfolio?type=dev)
|
||||||
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier)
|
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier)
|
||||||
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=for-the-badge)](https://github.com/xojs/xo)
|
|
||||||
|
|
24
package-lock.json
generated
24
package-lock.json
generated
|
@ -1278,9 +1278,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "6.7.2",
|
"version": "6.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz",
|
||||||
"integrity": "sha512-qMlSWJaCSxDFr8fBPvJM9kJwbazrhNcBU3+DszDW1OlEwKBBRWsJc7NJFelvwQpanHCR14cOLD41x8Eqvo3Nng==",
|
"integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.0.0",
|
"@babel/code-frame": "^7.0.0",
|
||||||
|
@ -1349,6 +1349,12 @@
|
||||||
"lodash.zip": "^4.2.0"
|
"lodash.zip": "^4.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"eslint-config-google": {
|
||||||
|
"version": "0.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.14.0.tgz",
|
||||||
|
"integrity": "sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"eslint-config-prettier": {
|
"eslint-config-prettier": {
|
||||||
"version": "6.9.0",
|
"version": "6.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.9.0.tgz",
|
||||||
|
@ -2584,9 +2590,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"inquirer": {
|
"inquirer": {
|
||||||
"version": "7.0.1",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.3.tgz",
|
||||||
"integrity": "sha512-V1FFQ3TIO15det8PijPLFR9M9baSlnRs9nL7zWu1MNVA2T9YVl9ZbrHJhYs7e9X8jeMZ3lr2JH/rdHFgNCBdYw==",
|
"integrity": "sha512-+OiOVeVydu4hnCGLCSX+wedovR/Yzskv9BFqUNNKq9uU2qg7LCcCo3R86S2E7WLo0y/x2pnEZfZe1CoYnORUAw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-escapes": "^4.2.1",
|
"ansi-escapes": "^4.2.1",
|
||||||
|
@ -4642,9 +4648,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rxjs": {
|
"rxjs": {
|
||||||
"version": "6.5.3",
|
"version": "6.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz",
|
||||||
"integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==",
|
"integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
|
|
|
@ -8,10 +8,7 @@
|
||||||
"cli": "OUT_DIR='./dist' node bin/gitfolio.js",
|
"cli": "OUT_DIR='./dist' node bin/gitfolio.js",
|
||||||
"clean": "rm -rf ./dist/*",
|
"clean": "rm -rf ./dist/*",
|
||||||
"prettier": "prettier --write \"./**/*.{js,jsx,json,html,css,md}\"",
|
"prettier": "prettier --write \"./**/*.{js,jsx,json,html,css,md}\"",
|
||||||
"test": "xo && OUT_DIR='./dist' node bin/gitfolio.js build k4ustu3h --fork --theme dark --sort updated --twitter k4ustu3h_ --dribbble k4ustu3h --email k4ustu3h@gmail.com --codepen k4ustu3h --dev k4ustu3h --instagram k4ustu3h --telegram k4ustu3h --reddit kaustubhladiya"
|
"test": "OUT_DIR='./dist' node bin/gitfolio.js build k4ustu3h --fork --theme dark --sort updated --twitter k4ustu3h_ --dribbble k4ustu3h --email k4ustu3h@gmail.com --codepen k4ustu3h --dev k4ustu3h --instagram k4ustu3h --telegram k4ustu3h --reddit kaustubhladiya"
|
||||||
},
|
|
||||||
"xo": {
|
|
||||||
"prettier": true
|
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "@imfunniee and community",
|
"name": "@imfunniee and community",
|
||||||
|
@ -46,6 +43,7 @@
|
||||||
"ncp": "^2.0.0"
|
"ncp": "^2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"eslint": "^6.8.0",
|
||||||
"prettier": "1.19.1",
|
"prettier": "1.19.1",
|
||||||
"xo": "^0.25.3"
|
"xo": "^0.25.3"
|
||||||
}
|
}
|
||||||
|
|
94
populate.js
94
populate.js
|
@ -1,37 +1,33 @@
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const emoji = require("github-emoji");
|
const emoji = require("github-emoji");
|
||||||
const jsdom = require("jsdom").JSDOM;
|
const jsdom = require("jsdom").JSDOM,
|
||||||
const options = {
|
options = {
|
||||||
resources: "usable"
|
resources: "usable"
|
||||||
};
|
};
|
||||||
const { getConfig, outDir } = require("./utils");
|
const { getConfig, outDir } = require("./utils");
|
||||||
const { getRepos, getUser } = require("./api");
|
const { getRepos, getUser } = require("./api");
|
||||||
|
|
||||||
function convertToEmoji(text) {
|
function convertToEmoji(text) {
|
||||||
if (text === null) {
|
if (text == null) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
text = text.toString();
|
text = text.toString();
|
||||||
const pattern = /(?<=:\s*).*?(?=\s*:)/gs;
|
var pattern = /(?<=:\s*).*?(?=\s*:)/gs;
|
||||||
if (text.match(pattern) !== null) {
|
if (text.match(pattern) != null) {
|
||||||
let str = text.match(pattern);
|
var str = text.match(pattern);
|
||||||
str = str.filter(arr => {
|
str = str.filter(function(arr) {
|
||||||
return /\S/.test(arr);
|
return /\S/.test(arr);
|
||||||
});
|
});
|
||||||
for (i = 0; i < str.length; i++) {
|
for (i = 0; i < str.length; i++) {
|
||||||
if (emoji.URLS[str[i]] !== undefined) {
|
if (emoji.URLS[str[i]] != undefined) {
|
||||||
text = text.replace(
|
text = text.replace(
|
||||||
`:${str[i]}:`,
|
`:${str[i]}:`,
|
||||||
`<img src="${emoji.URLS[str[i]]}" class="emoji">`
|
`<img src="${emoji.URLS[str[i]]}" class="emoji">`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return text;
|
||||||
|
} else {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.updateHTML = (username, opts) => {
|
module.exports.updateHTML = (username, opts) => {
|
||||||
|
@ -49,64 +45,62 @@ module.exports.updateHTML = (username, opts) => {
|
||||||
//add data to assets/index.html
|
//add data to assets/index.html
|
||||||
jsdom
|
jsdom
|
||||||
.fromFile(`${__dirname}/assets/index.html`, options)
|
.fromFile(`${__dirname}/assets/index.html`, options)
|
||||||
.then(dom => {
|
.then(function(dom) {
|
||||||
const {window} = dom;
|
let window = dom.window,
|
||||||
const {document} = window;
|
document = window.document;
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
console.log("Building HTML/CSS...");
|
console.log("Building HTML/CSS...");
|
||||||
const repos = await getRepos(username, opts);
|
const repos = await getRepos(username, opts);
|
||||||
|
|
||||||
for (const element of repos) {
|
for (var i = 0; i < repos.length; i++) {
|
||||||
let element;
|
let element;
|
||||||
if (element.fork === false) {
|
if (repos[i].fork == false) {
|
||||||
element = document.querySelector("#work_section");
|
element = document.getElementById("work_section");
|
||||||
} else if (includeFork === true) {
|
} else if (includeFork == true) {
|
||||||
document.querySelector("#forks").style.display = "block";
|
document.getElementById("forks").style.display = "block";
|
||||||
element = document.querySelector("#forks_section");
|
element = document.getElementById("forks_section");
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
element.innerHTML += `
|
element.innerHTML += `
|
||||||
<a href="${element.html_url}" target="_blank">
|
<a href="${repos[i].html_url}" target="_blank">
|
||||||
<section>
|
<section>
|
||||||
<div class="section_title">${element.name}</div>
|
<div class="section_title">${repos[i].name}</div>
|
||||||
<div class="about_section">
|
<div class="about_section">
|
||||||
<span style="display:${
|
<span style="display:${
|
||||||
element.description === undefined
|
repos[i].description == undefined
|
||||||
? "none"
|
? "none"
|
||||||
: "block"
|
: "block"
|
||||||
};">${convertToEmoji(element.description)}</span>
|
};">${convertToEmoji(repos[i].description)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom_section">
|
<div class="bottom_section">
|
||||||
<span style="display:${
|
<span style="display:${
|
||||||
element.language === null
|
repos[i].language == null
|
||||||
? "none"
|
? "none"
|
||||||
: "inline-block"
|
: "inline-block"
|
||||||
};"><i class="mdi mdi-code-tags"></i> ${
|
};"><i class="mdi mdi-code-tags"></i> ${
|
||||||
element.language
|
repos[i].language
|
||||||
}</span>
|
}</span>
|
||||||
<span><i class="mdi mdi-star"></i> ${
|
<span><i class="mdi mdi-star"></i> ${
|
||||||
element.stargazers_count
|
repos[i].stargazers_count
|
||||||
}</span>
|
}</span>
|
||||||
<span><i class="mdi mdi-source-branch"></i> ${
|
<span><i class="mdi mdi-source-branch"></i> ${
|
||||||
element.forks_count
|
repos[i].forks_count
|
||||||
}</span>
|
}</span>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</a>`;
|
</a>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await getUser(username);
|
const user = await getUser(username);
|
||||||
document.title = user.login;
|
document.title = user.login;
|
||||||
const icon = document.createElement("link");
|
var icon = document.createElement("link");
|
||||||
icon.setAttribute("rel", "icon");
|
icon.setAttribute("rel", "icon");
|
||||||
icon.setAttribute("href", user.avatar_url);
|
icon.setAttribute("href", user.avatar_url);
|
||||||
icon.setAttribute("type", "image/png");
|
icon.setAttribute("type", "image/png");
|
||||||
|
|
||||||
document.querySelectorAll("head")[0].append(icon);
|
document.getElementsByTagName("head")[0].appendChild(icon);
|
||||||
document.querySelectorAll("head")[0].innerHTML += `
|
document.getElementsByTagName("head")[0].innerHTML += `
|
||||||
<meta name="description" content="${user.bio}" />
|
<meta name="description" content="${user.bio}" />
|
||||||
<meta property="og:image" content="${user.avatar_url}" />
|
<meta property="og:image" content="${user.avatar_url}" />
|
||||||
<meta property="og:type" content="profile" />
|
<meta property="og:type" content="profile" />
|
||||||
|
@ -118,20 +112,20 @@ module.exports.updateHTML = (username, opts) => {
|
||||||
<meta name="twitter:card" content="summary" />
|
<meta name="twitter:card" content="summary" />
|
||||||
<meta name="twitter:title" content="${user.login}" />
|
<meta name="twitter:title" content="${user.login}" />
|
||||||
<meta name="twitter:description" content="${user.bio}" />`;
|
<meta name="twitter:description" content="${user.bio}" />`;
|
||||||
document.querySelector(
|
document.getElementById(
|
||||||
"#username"
|
"username"
|
||||||
).innerHTML = `<span id="text" style="display:${
|
).innerHTML = `<span id="text" style="display:${
|
||||||
user.name === null || !user.name ? "none" : "block"
|
user.name == null || !user.name ? "none" : "block"
|
||||||
};"></span><div class='console-underscore' id='console'>_</div><br><a href="${
|
};"></span><div class='console-underscore' id='console'>_</div><br><a href="${
|
||||||
user.html_url
|
user.html_url
|
||||||
}">@${user.login}</a>`;
|
}">@${user.login}</a>`;
|
||||||
//document.getElementById("github_link").href = `https://github.com/${user.login}`;
|
//document.getElementById("github_link").href = `https://github.com/${user.login}`;
|
||||||
document.querySelector("#userbio").innerHTML = convertToEmoji(
|
document.getElementById("userbio").innerHTML = convertToEmoji(
|
||||||
user.bio
|
user.bio
|
||||||
);
|
);
|
||||||
document.querySelector("#userbio").style.display =
|
document.getElementById("userbio").style.display =
|
||||||
user.bio == null || !user.bio ? "none" : "block";
|
user.bio == null || !user.bio ? "none" : "block";
|
||||||
document.querySelector("#about").innerHTML = `
|
document.getElementById("about").innerHTML = `
|
||||||
<span style="display:${
|
<span style="display:${
|
||||||
user.company == null || !user.company ? "none" : "block"
|
user.company == null || !user.company ? "none" : "block"
|
||||||
};"><i class="mdi-face"></i> ${user.company}</span>
|
};"><i class="mdi-face"></i> ${user.company}</span>
|
||||||
|
@ -182,22 +176,16 @@ module.exports.updateHTML = (username, opts) => {
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
`${outDir}/config.json`,
|
`${outDir}/config.json`,
|
||||||
JSON.stringify(data, null, " "),
|
JSON.stringify(data, null, " "),
|
||||||
err => {
|
function(err) {
|
||||||
if (err) {
|
if (err) throw err;
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Config file updated.");
|
console.log("Config file updated.");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
`${outDir}/index.html`,
|
`${outDir}/index.html`,
|
||||||
"<!DOCTYPE html>" + window.document.documentElement.outerHTML,
|
"<!DOCTYPE html>" + window.document.documentElement.outerHTML,
|
||||||
error => {
|
function(error) {
|
||||||
if (error) {
|
if (error) throw error;
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Build Complete, Files can be Found @ ${outDir}\n`);
|
console.log(`Build Complete, Files can be Found @ ${outDir}\n`);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -206,7 +194,7 @@ module.exports.updateHTML = (username, opts) => {
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(function(error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue