diff --git a/app/client.js b/app/client.js index de3c7dc..64b77e2 100755 --- a/app/client.js +++ b/app/client.js @@ -11,7 +11,7 @@ import devtools from "choo-devtools"; import { require as local } from "app-root-path"; import ssr from "choo-ssr"; -// V A R I A B L E S +// U T I L S const head = local("app/components/head").default; const wrapper = local("app/components/wrapper").default; diff --git a/app/components/ecosystem.js b/app/components/ecosystem.js index 9adf194..585b518 100644 --- a/app/components/ecosystem.js +++ b/app/components/ecosystem.js @@ -2,15 +2,19 @@ -// V A R I A B L E S +// P A C K A G E -const APPLICATIONS = require("./ecosystem/module-applications"); -const CHAINQUERY = require("./ecosystem/submodule-chainquery"); -const LBRY = require("./ecosystem/module-lbry"); -const LBRYCRD = require("./ecosystem/module-lbrycrd"); -const LIGHTHOUSE = require("./ecosystem/submodule-lighthouse"); -const REFLECTOR = require("./ecosystem/submodule-reflector"); -const WALLET = require("./ecosystem/submodule-wallet"); +const local = require("app-root-path").require; + +// U T I L S + +const applications = local("/app/components/ecosystem/module-applications"); +const chainquery = local("/app/components/ecosystem/submodule-chainquery"); +const lbry = local("/app/components/ecosystem/module-lbry"); +const lbrycrd = local("/app/components/ecosystem/module-lbrycrd"); +const lighthouse = local("/app/components/ecosystem/submodule-lighthouse"); +const reflector = local("/app/components/ecosystem/submodule-reflector"); +const wallet = local("/app/components/ecosystem/submodule-wallet"); @@ -20,19 +24,19 @@ export default () => { return `
- ${LBRYCRD()} - ${LBRY()} - ${APPLICATIONS()} + ${lbrycrd()} + ${lbry()} + ${applications()}
`; diff --git a/app/components/edit-link.js b/app/components/edit-link.js index 6b181c4..88d9342 100644 --- a/app/components/edit-link.js +++ b/app/components/edit-link.js @@ -7,7 +7,7 @@ import html from "choo/html"; import { require as local } from "app-root-path"; -// V A R I A B L E +// U T I L const config = local("/config"); diff --git a/app/components/feature-links.js b/app/components/feature-links.js index 0b85661..f0c61d1 100644 --- a/app/components/feature-links.js +++ b/app/components/feature-links.js @@ -2,7 +2,7 @@ -// V A R I A B L E +// U T I L const links = [ { diff --git a/app/components/footer.js b/app/components/footer.js index b4ed315..01ee284 100644 --- a/app/components/footer.js +++ b/app/components/footer.js @@ -7,12 +7,11 @@ import html from "choo/html"; import { require as local } from "app-root-path"; -// V A R I A B L E S - -import editLink from "./edit-link"; -import emailSubscribe from "./email-subscribe"; +// U T I L S const config = local("/config"); +const editLink = local("/app/components/edit-link").default; +const emailSubscribe = local("/app/components/email-subscribe").default; diff --git a/app/components/head.js b/app/components/head.js index 655dbd8..3496530 100644 --- a/app/components/head.js +++ b/app/components/head.js @@ -7,7 +7,7 @@ import html from "choo/html"; import { require as local } from "app-root-path"; -// V A R I A B L E S +// U T I L S const config = local("/config"); let title = ""; diff --git a/app/components/navigation.js b/app/components/navigation.js index 51cfcab..e5e9fc7 100644 --- a/app/components/navigation.js +++ b/app/components/navigation.js @@ -2,7 +2,7 @@ -// P A C K A G E S +// P A C K A G E import html from "choo/html"; diff --git a/app/components/resources-link-grid.js b/app/components/resources-link-grid.js index 5bc7d33..9bdf332 100644 --- a/app/components/resources-link-grid.js +++ b/app/components/resources-link-grid.js @@ -6,9 +6,9 @@ import { require as local } from "app-root-path"; -// V A R I A B L E +// U T I L -const linkGrid = local("app/components/link-grid").default; +const linkGrid = local("/app/components/link-grid").default; diff --git a/app/components/wrapper.js b/app/components/wrapper.js index cda916f..2ef0690 100644 --- a/app/components/wrapper.js +++ b/app/components/wrapper.js @@ -2,15 +2,15 @@ -// P A C K A G E +// P A C K A G E S import asyncHtml from "choo-async/html"; import { require as local } from "app-root-path"; -// V A R I A B L E S +// U T I L S -const footer = local("app/components/footer").default; -const navigation = local("app/components/navigation").default; +const footer = local("/app/components/footer").default; +const navigation = local("/app/components/navigation").default; diff --git a/app/helpers/fetch-metadata.js b/app/helpers/fetch-metadata.js index ca553c0..3f64d84 100644 --- a/app/helpers/fetch-metadata.js +++ b/app/helpers/fetch-metadata.js @@ -4,19 +4,19 @@ // P A C K A G E S +const loadLanguages = require("prismjs/components/"); const local = require("app-root-path").require; const prism = require("prismjs"); const raw = require("choo/html/raw"); const request = require("request-promise-native"); const stringifyObject = require("stringify-object"); -// V A R I A B L E S +// U T I L S -const randomString = local("app/helpers/random-string"); -const loadLanguages = require("prismjs/components/"); -const logSlackError = local("app/helpers/slack"); -const publishMeme = local("app/helpers/publish-meme"); -const uploadImage = local("app/helpers/upload-image"); +const randomString = local("/app/helpers/random-string"); +const logSlackError = local("/app/helpers/slack"); +const publishMeme = local("/app/helpers/publish-meme"); +const uploadImage = local("/app/helpers/upload-image"); loadLanguages(["json"]); diff --git a/app/helpers/github.js b/app/helpers/github.js index 5b55392..9aa1547 100644 --- a/app/helpers/github.js +++ b/app/helpers/github.js @@ -10,14 +10,15 @@ const local = require("app-root-path").require; const octokit = require("@octokit/rest")(); const redis = require("redis"); -// V A R I A B L E S +// U T I L S -const logSlackError = local("app/helpers/slack"); -const relativeDate = local("app/modules/relative-date"); -let client; +const logSlackError = local("/app/helpers/slack"); +const relativeDate = local("/app/modules/relative-date"); // R E D I S +let client; + if (typeof process.env.GITHUB_OAUTH_TOKEN !== "undefined") { octokit.authenticate({ type: "oauth", diff --git a/app/helpers/random-string.js b/app/helpers/random-string.js index 4ed3bcc..33bc691 100644 --- a/app/helpers/random-string.js +++ b/app/helpers/random-string.js @@ -2,7 +2,7 @@ -// P A C K A G E +// N A T I V E const crypto = require("crypto"); diff --git a/app/modules/redirect-404.js b/app/modules/redirect-404.js index c4ae326..891e529 100644 --- a/app/modules/redirect-404.js +++ b/app/modules/redirect-404.js @@ -2,12 +2,12 @@ -// P A C K A G E +// P A C K A G E S import html from "choo/html"; import { require as local } from "app-root-path"; -// V A R I A B L E S +// U T I L S const page404 = local("app/views/404.js"); const redirects = local("app/data/redirects.json"); diff --git a/app/sockets.js b/app/sockets.js index 3b518f8..c27d3f5 100644 --- a/app/sockets.js +++ b/app/sockets.js @@ -8,7 +8,7 @@ const html = require("choo/html"); const local = require("app-root-path").require; const request = require("request-promise-native"); -// V A R I A B L E S +// U T I L S const fetchMetadata = local("app/helpers/fetch-metadata"); const { generateGitHubFeed } = local("app/helpers/github"); diff --git a/app/views/api.js b/app/views/api.js index eb7e5d2..065d863 100644 --- a/app/views/api.js +++ b/app/views/api.js @@ -8,7 +8,7 @@ import asyncHtml from "choo-async/html"; import dedent from "dedent"; import { require as local } from "app-root-path"; -// V A R I A B L E S +// U T I L S const fetch = require("make-fetch-happen").defaults({ cacheManager: "./cache" }); const headerBlockchain = local("app/components/api/header-blockchain").default; diff --git a/app/views/home.js b/app/views/home.js index e615448..c69ceb8 100644 --- a/app/views/home.js +++ b/app/views/home.js @@ -7,7 +7,7 @@ import html from "choo/html"; import { require as local } from "app-root-path"; -// V A R I A B L E +// U T I L const linkGrid = local("app/components/link-grid").default; diff --git a/app/views/redirect.js b/app/views/redirect.js index 149fd4a..16efdf6 100644 --- a/app/views/redirect.js +++ b/app/views/redirect.js @@ -13,9 +13,12 @@ import path from "path"; import { require as local } from "app-root-path"; import raw from "choo/html/raw"; -// V A R I A B L E S +// V A R I A B L E const numberRegex = /^[0-9]/g; + +// U T I L S + const redirect404 = local("app/modules/redirect-404"); const md = require("markdown-it")({ diff --git a/server.js b/server.js index bb276b0..7146315 100755 --- a/server.js +++ b/server.js @@ -15,7 +15,7 @@ const fastify = require("fastify")({ } }); -// V A R I A B L E S +// U T I L S const handleSocketMessages = local("app/sockets"); const logSlackError = local("app/helpers/slack"); @@ -24,23 +24,20 @@ const logSlackError = local("app/helpers/slack"); // P R O G R A M -fastify.use(cors()); - -fastify.register(require("fastify-compress")); -fastify.register(require("fastify-ws")); - -fastify.register(require("fastify-helmet"), { - hidePoweredBy: { setTo: "LBRY" } -}); - -fastify.register(require("fastify-static"), { - prefix: "/assets/", - root: `${__dirname}/app/dist/` -}); - -fastify.register(require("choo-ssr/fastify"), { - app: require("./app") -}); +fastify + .use(cors()) + .register(require("fastify-compress")) + .register(require("fastify-ws")) + .register(require("fastify-helmet"), { + hidePoweredBy: { setTo: "LBRY" } + }) + .register(require("fastify-static"), { + prefix: "/assets/", + root: `${__dirname}/app/dist/` + }) + .register(require("choo-ssr/fastify"), { + app: require("./app") + }); fastify.ready(err => { if (err) throw err;