diff --git a/.prettierrc b/.prettierrc index b914eec..c5aff99 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,7 +1,7 @@ { "overrides": [ { - "files": "*.html", + "files": ["*.html", "*.ejs"], "options": { "parser": "html", "htmlWhitespaceSensitivity": "ignore" diff --git a/assets/service-worker.js b/assets/service-worker.js index bb84cd8..8bf17ec 100644 --- a/assets/service-worker.js +++ b/assets/service-worker.js @@ -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 😬`); - } \ No newline at end of file + workbox.routing.registerRoute( + new RegExp(/.*\.(?:png|jpg|jpeg|svg|gif|webp)/g), + workbox.strategies.cacheFirst() + ); +} else { + console.log(`No workbox on this browser 😬`); +} diff --git a/bin/gitfolio.js b/bin/gitfolio.js index e606f7d..14126e1 100755 --- a/bin/gitfolio.js +++ b/bin/gitfolio.js @@ -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(" [options]") .parse(process.argv); -if (program.args.length === 0) program.help(); \ No newline at end of file +if (program.args.length === 0) program.help(); diff --git a/update.js b/update.js index d6dcd7e..6c915ff 100644 --- a/update.js +++ b/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 -}; \ No newline at end of file +}; diff --git a/utils.js b/utils.js index 00fd124..6b6de7d 100644 --- a/utils.js +++ b/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 -}; \ No newline at end of file +}; diff --git a/views/css/index.css b/views/css/index.css index 1e77aaf..1d2d585 100644 --- a/views/css/index.css +++ b/views/css/index.css @@ -170,4 +170,4 @@ textarea:focus { ::placeholder { color: #000; -} \ No newline at end of file +} diff --git a/views/index.ejs b/views/index.ejs index d5db94f..5f2ebc7 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -1,172 +1,174 @@ + + + + + Gitfolio UI + + + + + - - - - - Gitfolio UI - - - - - + +
+ gitfolio + Update + Home +
+
+

Build or Edit Portfolio

+ +
+ +

Sort By :

+ - -
- gitfolio - Update - Home -
- -

Build or Edit Portfolio

-
- -

Sort By :

- + - + - + - + - - -

Order By :

- - -

- - - - -

- -
- - - - - \ No newline at end of file +

Order By :

+ + +
+
+ + + + +
+
+ + + + + +