1
0
Fork 0
mirror of https://github.com/dilllxd/gitfolio.git synced 2024-08-14 22:28:09 +00:00

Formatted some files

This commit is contained in:
K4USTU3H 2019-12-11 22:40:27 +05:30
parent c247ead4f4
commit 85835e6167
No known key found for this signature in database
GPG key ID: 00B12ABC9EE9D58D
7 changed files with 224 additions and 252 deletions

View file

@ -1,7 +1,7 @@
{ {
"overrides": [ "overrides": [
{ {
"files": "*.html", "files": ["*.html", "*.ejs"],
"options": { "options": {
"parser": "html", "parser": "html",
"htmlWhitespaceSensitivity": "ignore" "htmlWhitespaceSensitivity": "ignore"

View file

@ -1,42 +1,42 @@
importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js'); importScripts(
"https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js"
);
if (workbox) { if (workbox) {
workbox.setConfig({ workbox.setConfig({
debug: false debug: false
}); });
var defaultStrategy = workbox.strategies.networkFirst({ var defaultStrategy = workbox.strategies.networkFirst({
cacheName: "fallback", cacheName: "fallback",
plugins: [ plugins: [
new workbox.expiration.Plugin({ new workbox.expiration.Plugin({
maxEntries: 128, maxEntries: 128,
maxAgeSeconds: 7 * 24 * 60 * 60, // 1 week maxAgeSeconds: 7 * 24 * 60 * 60, // 1 week
purgeOnQuotaError: true, // Opt-in to automatic cleanup purgeOnQuotaError: true // Opt-in to automatic cleanup
}), }),
new workbox.cacheableResponse.Plugin({ new workbox.cacheableResponse.Plugin({
statuses: [0, 200] // for opague requests statuses: [0, 200] // for opague requests
}), })
], ]
}); });
workbox.routing.setDefaultHandler( workbox.routing.setDefaultHandler(args => {
(args) => { if (args.event.request.method === "GET") {
if (args.event.request.method === 'GET') { return defaultStrategy.handle(args); // use default strategy
return defaultStrategy.handle(args); // use default strategy } else {
} else { return null;
return null }
} });
}
);
workbox.routing.registerRoute( workbox.routing.registerRoute(
new RegExp(/.*\.(?:js|css)/g), new RegExp(/.*\.(?:js|css)/g),
workbox.strategies.networkFirst() workbox.strategies.networkFirst()
); );
workbox.routing.registerRoute( workbox.routing.registerRoute(
new RegExp(/.*\.(?:png|jpg|jpeg|svg|gif|webp)/g), new RegExp(/.*\.(?:png|jpg|jpeg|svg|gif|webp)/g),
workbox.strategies.cacheFirst() workbox.strategies.cacheFirst()
); );
} else { } else {
console.log(`No workbox on this browser 😬`); console.log(`No workbox on this browser 😬`);
} }

View file

@ -5,29 +5,13 @@ const program = require("commander");
process.env.OUT_DIR = process.env.OUT_DIR || process.cwd(); process.env.OUT_DIR = process.env.OUT_DIR || process.cwd();
const const { buildCommand } = require("../build");
{ const { updateCommand } = require("../update");
buildCommand const { uiCommand } = require("../ui");
} = require("../build"); const { runCommand } = require("../run");
const const { version } = require("../package.json");
{
updateCommand
} = require("../update");
const
{
uiCommand
} = require("../ui");
const
{
runCommand
} = require("../run");
const
{
version
} = require("../package.json");
function collect(val, memo) function collect(val, memo) {
{
memo.push(val); memo.push(val);
return memo; return memo;
} }
@ -61,8 +45,7 @@ program
.option("-p, --port [port]", "provide a port for localhost, default is 3000") .option("-p, --port [port]", "provide a port for localhost, default is 3000")
.action(runCommand); .action(runCommand);
program.on("command:*", () => program.on("command:*", () => {
{
console.log("Unknown Command: " + program.args.join(" ")); console.log("Unknown Command: " + program.args.join(" "));
program.help(); program.help();
}); });
@ -72,4 +55,4 @@ program
.usage("<command> [options]") .usage("<command> [options]")
.parse(process.argv); .parse(process.argv);
if (program.args.length === 0) program.help(); if (program.args.length === 0) program.help();

View file

@ -1,18 +1,10 @@
const const { getConfig } = require("./utils");
{ const { updateHTML } = require("./populate");
getConfig
} = require("./utils");
const
{
updateHTML
} = require("./populate");
async function updateCommand() async function updateCommand() {
{
const data = await getConfig(); const data = await getConfig();
var username = data[0].username; var username = data[0].username;
if (username == null) if (username == null) {
{
console.log( console.log(
"username not found in config.json, please run build command before using update" "username not found in config.json, please run build command before using update"
); );
@ -35,4 +27,4 @@ async function updateCommand()
module.exports = { module.exports = {
updateCommand updateCommand
}; };

View file

@ -11,14 +11,10 @@ const defaultConfigPath = path.resolve(`${__dirname}/default/config.json`);
* Tries to read file from out dir, * Tries to read file from out dir,
* if not present returns default file contents * if not present returns default file contents
*/ */
async function getFileWithDefaults(file, defaultFile) async function getFileWithDefaults(file, defaultFile) {
{ try {
try
{
await fs.accessAsync(file, fs.constants.F_OK); await fs.accessAsync(file, fs.constants.F_OK);
} } catch (err) {
catch (err)
{
const defaultData = await fs.readFileAsync(defaultFile); const defaultData = await fs.readFileAsync(defaultFile);
return JSON.parse(defaultData); return JSON.parse(defaultData);
} }
@ -26,12 +22,11 @@ async function getFileWithDefaults(file, defaultFile)
return JSON.parse(data); return JSON.parse(data);
} }
async function getConfig() async function getConfig() {
{
return getFileWithDefaults(configPath, defaultConfigPath); return getFileWithDefaults(configPath, defaultConfigPath);
} }
module.exports = { module.exports = {
outDir, outDir,
getConfig getConfig
}; };

View file

@ -170,4 +170,4 @@ textarea:focus {
::placeholder { ::placeholder {
color: #000; color: #000;
} }

View file

@ -1,172 +1,174 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Gitfolio UI</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css"
/>
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr"
crossorigin="anonymous"
/>
<link rel="stylesheet" type="text/css" href="./css/index.css" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/zeva-ui/zeva/dist/css/zeva.min.css"
/>
</head>
<head> <body class="body-light">
<meta charset="UTF-8" /> <header>
<meta name="viewport" <b>gitfolio</b>
content="width=device-width, initial-scale=1.0" /> <a href="/update" style="float: right">Update</a>
<meta http-equiv="X-UA-Compatible" <a href="/" style="float: right">Home</a>
content="ie=edge" /> </header>
<title>Gitfolio UI</title> <form method="post" action="build">
<link rel="stylesheet" <h3>Build or Edit Portfolio</h3>
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css" /> <input
<link rel="stylesheet" type="text"
href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" class="input h-weight-bold"
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" placeholder="username"
crossorigin="anonymous" /> id="username"
<link rel="stylesheet" name="username"
type="text/css" required
href="./css/index.css" /> />
<link rel="stylesheet" <br />
href="https://cdn.jsdelivr.net/gh/zeva-ui/zeva/dist/css/zeva.min.css" /> <input
</head> type="text"
class="input h-weight-bold"
placeholder="background"
name="background"
id="background"
/>
<h3>Sort By :</h3>
<label class="label">
Star
<input type="radio" name="sort" value="star" />
<span class="radio"></span>
</label>
<body class="body-light"> <label class="label">
<header> Created
<b>gitfolio</b> <input type="radio" name="sort" value="created" checked />
<a href="/update" <span class="radio"></span>
style="float: right">Update</a> </label>
<a href="/"
style="float: right">Home</a>
</header>
<form method="post"
action="build">
<h3>Build or Edit Portfolio</h3>
<input type="text"
class="input h-weight-bold"
placeholder="username"
id="username"
name="username"
required /><br />
<input type="text"
class="input h-weight-bold"
placeholder="background"
name="background"
id="background" />
<h3>Sort By :</h3>
<label class="label">Star
<input type="radio"
name="sort"
value="star" />
<span class="radio"></span>
</label>
<label class="label">Created <label class="label">
<input type="radio" Updated
name="sort" <input type="radio" name="sort" value="updated" />
value="created" <span class="radio"></span>
checked /> </label>
<span class="radio"></span>
</label>
<label class="label">Updated <label class="label">
<input type="radio" Pushed
name="sort" <input type="radio" name="sort" value="pushed" />
value="updated" /> <span class="radio"></span>
<span class="radio"></span> </label>
</label>
<label class="label">Pushed <label class="label">
<input type="radio" Full Name
name="sort" <input type="radio" name="sort" value="full_name" />
value="pushed" /> <span class="radio"></span>
<span class="radio"></span> </label>
</label>
<label class="label">Full Name <h3>Order By :</h3>
<input type="radio" <label class="label">
name="sort" Asc
value="full_name" /> <input type="radio" name="order" value="asc" checked />
<span class="radio"></span> <span class="radio"></span>
</label> </label>
<label class="label">
<h3>Order By :</h3> Desc
<label class="label">Asc <input type="radio" name="order" value="desc" />
<input type="radio" <span class="radio"></span>
name="order" </label>
value="asc" <br />
checked /> <br />
<span class="radio"></span> <label class="label">
</label> Use Dark Theme
<label class="label">Desc <input type="checkbox" id="theme" name="theme" />
<input type="radio" <span class="checkbox"></span>
name="order" </label>
value="desc" /> <label class="label">
<span class="radio"></span> Include Forks
</label> <input type="checkbox" id="fork" name="fork" value="true" />
<br /><br /> <span class="checkbox"></span>
<label class="label">Use Dark Theme </label>
<input type="checkbox" <label class="label">
id="theme" Include Socials
name="theme" /> <input type="checkbox" id="socials" name="socials" />
<span class="checkbox"></span> <span class="checkbox"></span>
</label> </label>
<label class="label">Include Forks <div style="display: none" id="input_for_socials">
<input type="checkbox" <input
id="fork" type="text"
name="fork" class="input h-weight-bold"
value="true" /> placeholder="codepen username"
<span class="checkbox"></span> id="codepen"
</label> name="codepen"
<label class="label">Include Socials />
<input type="checkbox" <br />
id="socials" <input
name="socials" /> type="text"
<span class="checkbox"></span> class="input h-weight-bold"
</label> placeholder="dev username"
<div style="display: none" id="dev"
id="input_for_socials"> name="dev"
<input type="text" />
class="input h-weight-bold" <br />
placeholder="codepen username" <input
id="codepen" type="text"
name="codepen" /><br /> class="input h-weight-bold"
<input type="text" placeholder="dribbble username"
class="input h-weight-bold" id="dribbble"
placeholder="dev username" name="dribbble"
id="dev" />
name="dev" /><br /> <br />
<input type="text" <input
class="input h-weight-bold" type="text"
placeholder="dribbble username" class="input h-weight-bold"
id="dribbble" placeholder="email address"
name="dribbble" /><br /> id="email"
<input type="text" name="email"
class="input h-weight-bold" />
placeholder="email address" <br />
id="email" <input
name="email" /><br /> type="text"
<input type="text" class="input h-weight-bold"
class="input h-weight-bold" placeholder="instagram username"
placeholder="instagram username" id="instagram"
id="instagram" name="instagram"
name="instagram" /> />
<input type="text" <input
class="input h-weight-bold" type="text"
placeholder="twitter username" class="input h-weight-bold"
id="twitter" placeholder="twitter username"
name="twitter" /> id="twitter"
</div> name="twitter"
<br /><br /> />
<button type="submit" </div>
class="button" <br />
id="build">Build</button> <br />
</form> <button type="submit" class="button" id="build">Build</button>
<script type="text/javascript" </form>
src="https://cdn.jsdelivr.net/gh/zeva-ui/zeva/dist/js/index.min.js"></script> <script
<script type="text/javascript"> type="text/javascript"
document.querySelector("#socials").addEventListener("change", event => src="https://cdn.jsdelivr.net/gh/zeva-ui/zeva/dist/js/index.min.js"
{ ></script>
if (event.target.checked) <script type="text/javascript">
{ document.querySelector("#socials").addEventListener("change", event => {
document.querySelector("#input_for_socials").style.display = "block"; if (event.target.checked) {
} document.querySelector("#input_for_socials").style.display = "block";
else } else {
{ document.querySelector("#input_for_socials").style.display = "none";
document.querySelector("#input_for_socials").style.display = "none"; }
} });
}); </script>
</script> </body>
</body> </html>
</html>