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:
parent
c247ead4f4
commit
85835e6167
7 changed files with 224 additions and 252 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.html",
|
||||
"files": ["*.html", "*.ejs"],
|
||||
"options": {
|
||||
"parser": "html",
|
||||
"htmlWhitespaceSensitivity": "ignore"
|
||||
|
|
|
@ -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) {
|
||||
workbox.setConfig({
|
||||
debug: false
|
||||
});
|
||||
if (workbox) {
|
||||
workbox.setConfig({
|
||||
debug: false
|
||||
});
|
||||
|
||||
var defaultStrategy = workbox.strategies.networkFirst({
|
||||
cacheName: "fallback",
|
||||
plugins: [
|
||||
new workbox.expiration.Plugin({
|
||||
maxEntries: 128,
|
||||
maxAgeSeconds: 7 * 24 * 60 * 60, // 1 week
|
||||
purgeOnQuotaError: true, // Opt-in to automatic cleanup
|
||||
}),
|
||||
new workbox.cacheableResponse.Plugin({
|
||||
statuses: [0, 200] // for opague requests
|
||||
}),
|
||||
],
|
||||
});
|
||||
workbox.routing.setDefaultHandler(
|
||||
(args) => {
|
||||
if (args.event.request.method === 'GET') {
|
||||
return defaultStrategy.handle(args); // use default strategy
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
);
|
||||
var defaultStrategy = workbox.strategies.networkFirst({
|
||||
cacheName: "fallback",
|
||||
plugins: [
|
||||
new workbox.expiration.Plugin({
|
||||
maxEntries: 128,
|
||||
maxAgeSeconds: 7 * 24 * 60 * 60, // 1 week
|
||||
purgeOnQuotaError: true // Opt-in to automatic cleanup
|
||||
}),
|
||||
new workbox.cacheableResponse.Plugin({
|
||||
statuses: [0, 200] // for opague requests
|
||||
})
|
||||
]
|
||||
});
|
||||
workbox.routing.setDefaultHandler(args => {
|
||||
if (args.event.request.method === "GET") {
|
||||
return defaultStrategy.handle(args); // use default strategy
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
workbox.routing.registerRoute(
|
||||
new RegExp(/.*\.(?:js|css)/g),
|
||||
workbox.strategies.networkFirst()
|
||||
);
|
||||
workbox.routing.registerRoute(
|
||||
new RegExp(/.*\.(?:js|css)/g),
|
||||
workbox.strategies.networkFirst()
|
||||
);
|
||||
|
||||
workbox.routing.registerRoute(
|
||||
new RegExp(/.*\.(?:png|jpg|jpeg|svg|gif|webp)/g),
|
||||
workbox.strategies.cacheFirst()
|
||||
);
|
||||
} else {
|
||||
console.log(`No workbox on this browser 😬`);
|
||||
}
|
||||
workbox.routing.registerRoute(
|
||||
new RegExp(/.*\.(?:png|jpg|jpeg|svg|gif|webp)/g),
|
||||
workbox.strategies.cacheFirst()
|
||||
);
|
||||
} else {
|
||||
console.log(`No workbox on this browser 😬`);
|
||||
}
|
||||
|
|
|
@ -5,29 +5,13 @@ const program = require("commander");
|
|||
|
||||
process.env.OUT_DIR = process.env.OUT_DIR || process.cwd();
|
||||
|
||||
const
|
||||
{
|
||||
buildCommand
|
||||
} = require("../build");
|
||||
const
|
||||
{
|
||||
updateCommand
|
||||
} = require("../update");
|
||||
const
|
||||
{
|
||||
uiCommand
|
||||
} = require("../ui");
|
||||
const
|
||||
{
|
||||
runCommand
|
||||
} = require("../run");
|
||||
const
|
||||
{
|
||||
version
|
||||
} = require("../package.json");
|
||||
const { buildCommand } = require("../build");
|
||||
const { 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);
|
||||
return memo;
|
||||
}
|
||||
|
@ -61,8 +45,7 @@ program
|
|||
.option("-p, --port [port]", "provide a port for localhost, default is 3000")
|
||||
.action(runCommand);
|
||||
|
||||
program.on("command:*", () =>
|
||||
{
|
||||
program.on("command:*", () => {
|
||||
console.log("Unknown Command: " + program.args.join(" "));
|
||||
program.help();
|
||||
});
|
||||
|
@ -72,4 +55,4 @@ program
|
|||
.usage("<command> [options]")
|
||||
.parse(process.argv);
|
||||
|
||||
if (program.args.length === 0) program.help();
|
||||
if (program.args.length === 0) program.help();
|
||||
|
|
18
update.js
18
update.js
|
@ -1,18 +1,10 @@
|
|||
const
|
||||
{
|
||||
getConfig
|
||||
} = require("./utils");
|
||||
const
|
||||
{
|
||||
updateHTML
|
||||
} = require("./populate");
|
||||
const { getConfig } = require("./utils");
|
||||
const { updateHTML } = require("./populate");
|
||||
|
||||
async function updateCommand()
|
||||
{
|
||||
async function updateCommand() {
|
||||
const data = await getConfig();
|
||||
var username = data[0].username;
|
||||
if (username == null)
|
||||
{
|
||||
if (username == null) {
|
||||
console.log(
|
||||
"username not found in config.json, please run build command before using update"
|
||||
);
|
||||
|
@ -35,4 +27,4 @@ async function updateCommand()
|
|||
|
||||
module.exports = {
|
||||
updateCommand
|
||||
};
|
||||
};
|
||||
|
|
15
utils.js
15
utils.js
|
@ -11,14 +11,10 @@ const defaultConfigPath = path.resolve(`${__dirname}/default/config.json`);
|
|||
* Tries to read file from out dir,
|
||||
* if not present returns default file contents
|
||||
*/
|
||||
async function getFileWithDefaults(file, defaultFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
async function getFileWithDefaults(file, defaultFile) {
|
||||
try {
|
||||
await fs.accessAsync(file, fs.constants.F_OK);
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
} catch (err) {
|
||||
const defaultData = await fs.readFileAsync(defaultFile);
|
||||
return JSON.parse(defaultData);
|
||||
}
|
||||
|
@ -26,12 +22,11 @@ async function getFileWithDefaults(file, defaultFile)
|
|||
return JSON.parse(data);
|
||||
}
|
||||
|
||||
async function getConfig()
|
||||
{
|
||||
async function getConfig() {
|
||||
return getFileWithDefaults(configPath, defaultConfigPath);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
outDir,
|
||||
getConfig
|
||||
};
|
||||
};
|
||||
|
|
|
@ -170,4 +170,4 @@ textarea:focus {
|
|||
|
||||
::placeholder {
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
|
|
330
views/index.ejs
330
views/index.ejs
|
@ -1,172 +1,174 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
<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>
|
||||
<body class="body-light">
|
||||
<header>
|
||||
<b>gitfolio</b>
|
||||
<a href="/update" style="float: right">Update</a>
|
||||
<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>
|
||||
|
||||
<body class="body-light">
|
||||
<header>
|
||||
<b>gitfolio</b>
|
||||
<a href="/update"
|
||||
style="float: right">Update</a>
|
||||
<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
|
||||
<input type="radio" name="sort" value="created" checked />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
|
||||
<label class="label">Created
|
||||
<input type="radio"
|
||||
name="sort"
|
||||
value="created"
|
||||
checked />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
<label class="label">
|
||||
Updated
|
||||
<input type="radio" name="sort" value="updated" />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
|
||||
<label class="label">Updated
|
||||
<input type="radio"
|
||||
name="sort"
|
||||
value="updated" />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
<label class="label">
|
||||
Pushed
|
||||
<input type="radio" name="sort" value="pushed" />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
|
||||
<label class="label">Pushed
|
||||
<input type="radio"
|
||||
name="sort"
|
||||
value="pushed" />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
<label class="label">
|
||||
Full Name
|
||||
<input type="radio" name="sort" value="full_name" />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
|
||||
<label class="label">Full Name
|
||||
<input type="radio"
|
||||
name="sort"
|
||||
value="full_name" />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
|
||||
<h3>Order By :</h3>
|
||||
<label class="label">Asc
|
||||
<input type="radio"
|
||||
name="order"
|
||||
value="asc"
|
||||
checked />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
<label class="label">Desc
|
||||
<input type="radio"
|
||||
name="order"
|
||||
value="desc" />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
<br /><br />
|
||||
<label class="label">Use Dark Theme
|
||||
<input type="checkbox"
|
||||
id="theme"
|
||||
name="theme" />
|
||||
<span class="checkbox"></span>
|
||||
</label>
|
||||
<label class="label">Include Forks
|
||||
<input type="checkbox"
|
||||
id="fork"
|
||||
name="fork"
|
||||
value="true" />
|
||||
<span class="checkbox"></span>
|
||||
</label>
|
||||
<label class="label">Include Socials
|
||||
<input type="checkbox"
|
||||
id="socials"
|
||||
name="socials" />
|
||||
<span class="checkbox"></span>
|
||||
</label>
|
||||
<div style="display: none"
|
||||
id="input_for_socials">
|
||||
<input type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="codepen username"
|
||||
id="codepen"
|
||||
name="codepen" /><br />
|
||||
<input type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="dev username"
|
||||
id="dev"
|
||||
name="dev" /><br />
|
||||
<input type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="dribbble username"
|
||||
id="dribbble"
|
||||
name="dribbble" /><br />
|
||||
<input type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="email address"
|
||||
id="email"
|
||||
name="email" /><br />
|
||||
<input type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="instagram username"
|
||||
id="instagram"
|
||||
name="instagram" />
|
||||
<input type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="twitter username"
|
||||
id="twitter"
|
||||
name="twitter" />
|
||||
</div>
|
||||
<br /><br />
|
||||
<button type="submit"
|
||||
class="button"
|
||||
id="build">Build</button>
|
||||
</form>
|
||||
<script type="text/javascript"
|
||||
src="https://cdn.jsdelivr.net/gh/zeva-ui/zeva/dist/js/index.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
document.querySelector("#socials").addEventListener("change", event =>
|
||||
{
|
||||
if (event.target.checked)
|
||||
{
|
||||
document.querySelector("#input_for_socials").style.display = "block";
|
||||
}
|
||||
else
|
||||
{
|
||||
document.querySelector("#input_for_socials").style.display = "none";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<h3>Order By :</h3>
|
||||
<label class="label">
|
||||
Asc
|
||||
<input type="radio" name="order" value="asc" checked />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
<label class="label">
|
||||
Desc
|
||||
<input type="radio" name="order" value="desc" />
|
||||
<span class="radio"></span>
|
||||
</label>
|
||||
<br />
|
||||
<br />
|
||||
<label class="label">
|
||||
Use Dark Theme
|
||||
<input type="checkbox" id="theme" name="theme" />
|
||||
<span class="checkbox"></span>
|
||||
</label>
|
||||
<label class="label">
|
||||
Include Forks
|
||||
<input type="checkbox" id="fork" name="fork" value="true" />
|
||||
<span class="checkbox"></span>
|
||||
</label>
|
||||
<label class="label">
|
||||
Include Socials
|
||||
<input type="checkbox" id="socials" name="socials" />
|
||||
<span class="checkbox"></span>
|
||||
</label>
|
||||
<div style="display: none" id="input_for_socials">
|
||||
<input
|
||||
type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="codepen username"
|
||||
id="codepen"
|
||||
name="codepen"
|
||||
/>
|
||||
<br />
|
||||
<input
|
||||
type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="dev username"
|
||||
id="dev"
|
||||
name="dev"
|
||||
/>
|
||||
<br />
|
||||
<input
|
||||
type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="dribbble username"
|
||||
id="dribbble"
|
||||
name="dribbble"
|
||||
/>
|
||||
<br />
|
||||
<input
|
||||
type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="email address"
|
||||
id="email"
|
||||
name="email"
|
||||
/>
|
||||
<br />
|
||||
<input
|
||||
type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="instagram username"
|
||||
id="instagram"
|
||||
name="instagram"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
class="input h-weight-bold"
|
||||
placeholder="twitter username"
|
||||
id="twitter"
|
||||
name="twitter"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
<button type="submit" class="button" id="build">Build</button>
|
||||
</form>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="https://cdn.jsdelivr.net/gh/zeva-ui/zeva/dist/js/index.min.js"
|
||||
></script>
|
||||
<script type="text/javascript">
|
||||
document.querySelector("#socials").addEventListener("change", event => {
|
||||
if (event.target.checked) {
|
||||
document.querySelector("#input_for_socials").style.display = "block";
|
||||
} else {
|
||||
document.querySelector("#input_for_socials").style.display = "none";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue