From 88be65e0a6a52826251505cc4111215d4c73f1a6 Mon Sep 17 00:00:00 2001 From: hippoz Date: Sun, 17 Oct 2021 00:05:22 +0300 Subject: [PATCH] feat: custom static site generation --- .gitignore | 4 + LICENSE | 9 + README.md | 24 ++ blog.html | 32 --- build.js | 96 +++++++ buildconfig.js | 14 + extra/discordwebhookmanager/index.html | 144 ---------- extra/index.html | 56 ---- index.html | 29 -- me.html | 32 --- favicon.ico => out/favicon.ico | Bin {res => out/res}/style.css | 30 +- {res => out/res}/wave.svg | 0 robots.txt => out/robots.txt | 1 - package-lock.json | 380 +++++++++++++++++++++++++ package.json | 18 ++ src/blog.page.js | 12 + src/components/LinkButton.component.js | 1 + src/components/Navigation.component.js | 16 ++ src/components/Page.component.js | 19 ++ src/env/index.js | 9 + src/index.page.js | 9 + src/me.page.js | 12 + 23 files changed, 635 insertions(+), 312 deletions(-) create mode 100644 .gitignore create mode 100644 LICENSE delete mode 100644 blog.html create mode 100644 build.js create mode 100644 buildconfig.js delete mode 100644 extra/discordwebhookmanager/index.html delete mode 100644 extra/index.html delete mode 100644 index.html delete mode 100644 me.html rename favicon.ico => out/favicon.ico (100%) rename {res => out/res}/style.css (71%) rename {res => out/res}/wave.svg (100%) rename robots.txt => out/robots.txt (62%) create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/blog.page.js create mode 100644 src/components/LinkButton.component.js create mode 100644 src/components/Navigation.component.js create mode 100644 src/components/Page.component.js create mode 100644 src/env/index.js create mode 100644 src/index.page.js create mode 100644 src/me.page.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a3dc99c --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules/ + +# the only files that need to be generated are .html, so just exclude them +out/*.html diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..117a364 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2021 hippoz + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 0663813..a5821c5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ # homepage +This repository holds the entire source code of my website. It has a custom static site generation system. + +## Building + +NPM/Yarn and Node are required. + +``` +npm install +npm start +``` + +This will "build" all of the necessary html files and place them into the `out` folder. The `out` folder now contains all the files necessary for the website, so it can be served somewhere. + +## Structure + +`src/components/` - Contains reusable components. + +`src/env/` - Contains configuration for how the website should be laid out/where it should get data from. + +`src/*.page.js` - Files that end in .page.js will be "built" into html files. They must export a string. + +`buildconfig.js` - Contains various parameters that alter the build process. + +`out/` - All generated html files will be placed in this folder. Note that by default it contains certain static content such as the css styles. diff --git a/blog.html b/blog.html deleted file mode 100644 index 670df92..0000000 --- a/blog.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - hippoz blog - - - - - - -
-

hippoz's blog

-

i think

-
-
-

no articles yet

-
- - \ No newline at end of file diff --git a/build.js b/build.js new file mode 100644 index 0000000..53a57f5 --- /dev/null +++ b/build.js @@ -0,0 +1,96 @@ +const { promises: fs } = require("fs"); +const path = require("path"); +const { html: beautifyHtml } = require('js-beautify'); + +const buildConfig = require("./buildconfig"); + +// source: https://stackoverflow.com/a/41407246 +const escapeCodes = { + reset: "\x1b[0m", + bright: "\x1b[1m", + dim: "\x1b[2m", + underscore: "\x1b[4m", + blink: "\x1b[5m", + reverse: "\x1b[7m", + hidden: "\x1b[8m", + + fgBlack: "\x1b[30m", + fgRed: "\x1b[31m", + fgGreen: "\x1b[32m", + fgYellow: "\x1b[33m", + fgBlue: "\x1b[34m", + fgMagenta: "\x1b[35m", + fgCyan: "\x1b[36m", + fgWhite: "\x1b[37m", + + bgBlack: "\x1b[40m", + bgRed: "\x1b[41m", + bgGreen: "\x1b[42m", + bgYellow: "\x1b[43m", + bgBlue: "\x1b[44m", + bgMagenta: "\x1b[45m", + bgCyan: "\x1b[46m", + bgWhite: "\x1b[47m", +}; + +if (!buildConfig.allowSpecialCharacters) { + for (i in escapeCodes) { + escapeCodes[i] = ""; + } +} + +const specialCharacter = (c) => { + if (buildConfig.allowSpecialCharacters) { + return c; + } + return ""; +} + +const processPageOutput = (out) => { + if (typeof out !== "string") { + throw new Error("got non-string page output (maybe one of the pages isn't exporting a string?)"); + } + + if (buildConfig.postProcessing.trimOutput) { + out = out.trim(); + } + + if (buildConfig.postProcessing.beautifyOutput) { + out = beautifyHtml(out, buildConfig.postProcessing.beautifyOutputOptions); + } + + return out; +}; + +const findAllPages = async (directory) => + (await fs.readdir(directory)) + .filter( + f => f.endsWith(buildConfig.pageExtension) + ) + .map(f => directory + "/" + f); // TODO: hack + +const buildPage = (pagePath) => processPageOutput(require(pagePath)); + +const buildAllPages = async (directory) => + (await findAllPages(directory)) + .map( + p => [p, buildPage(p)] + ); + +const exportAllPages = async (sourcePath, outputPath) => { + const pages = await buildAllPages(sourcePath); + for (const [pagePath, pageContent] of pages) { + const pageName = path.parse(path.basename(pagePath, buildConfig.pageExtension)).name; + await fs.writeFile(path.join(outputPath, pageName + ".html"), pageContent); + console.log(`${escapeCodes.fgGreen}${specialCharacter("→")}${escapeCodes.reset} Built ${escapeCodes.fgBlue}${pageName}${escapeCodes.reset}`); + } + return pages.length; +}; + +const main = async () => { + const startTime = new Date(); + const builtPages = await exportAllPages(buildConfig.sourceDirectory, buildConfig.outputDirectory); + console.log(`${escapeCodes.fgGreen}${specialCharacter("✓")} Done! ${escapeCodes.fgBlue}Built ${builtPages} pages in ${((new Date()) - startTime)}ms.${escapeCodes.reset}`); +}; + +main(); \ No newline at end of file diff --git a/buildconfig.js b/buildconfig.js new file mode 100644 index 0000000..367f2eb --- /dev/null +++ b/buildconfig.js @@ -0,0 +1,14 @@ +module.exports = { + sourceDirectory: "./src", + outputDirectory: "./out", + pageExtension: ".page.js", + postProcessing: { + trimOutput: false, // not very useful when beautifyOutput === true + beautifyOutput: true, + beautifyOutputOptions: { + indent_size: 2, + preserve_newlines: false + } + }, + allowSpecialCharacters: true +}; \ No newline at end of file diff --git a/extra/discordwebhookmanager/index.html b/extra/discordwebhookmanager/index.html deleted file mode 100644 index 26eddd9..0000000 --- a/extra/discordwebhookmanager/index.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - hippoz - - - - - - -
- - -
-

Selected webhook: {{ selectedWebhookObject.name }}

-

i think

-
-
-
- -
- -
-
-
- -
-
-
- - - - - \ No newline at end of file diff --git a/extra/index.html b/extra/index.html deleted file mode 100644 index 7d68175..0000000 --- a/extra/index.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - extra - - - - - - - - -
-

diag

-

i think.

-

STATIC @ /

- -

SERVICES @ hippoz.xyz

- -
- - \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 11e87d5..0000000 --- a/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - hippoz - - - - - - -
-

hippoz's website

-

i think

-
- - \ No newline at end of file diff --git a/me.html b/me.html deleted file mode 100644 index 928b67e..0000000 --- a/me.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - hippoz - - - - - - -
-

hello

-

i think

-
-
-

i'm hippoz. that's about it.

-
- - \ No newline at end of file diff --git a/favicon.ico b/out/favicon.ico similarity index 100% rename from favicon.ico rename to out/favicon.ico diff --git a/res/style.css b/out/res/style.css similarity index 71% rename from res/style.css rename to out/res/style.css index 647763a..a1c0875 100644 --- a/res/style.css +++ b/out/res/style.css @@ -3,20 +3,20 @@ --accent-bg-color: #d4d3d3; --button-accent-color: #3d3d3d; --selected-bg-color: #2E2E2E; - --hover-bg-color: #555555; - --card-border-radius: 0; - --button-border-radius: 4px; + --hover-bg-color: #4d4d4d; + --card-border-radius: 8px; + --button-border-radius: 6px; --main-font-weight: 500; --cards-length: 600px; - --fonts-proportional: -apple-system,"Segoe UI",system-ui,"Roboto","Helvetica Neue","Arial"; - --fonts-monospace: "SFMono-Regular","Menlo","Monaco","Consolas","Liberation Mono","Courier New",monospace,var(--fonts-emoji); - --fonts-emoji: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji","Twemoji Mozilla"; - --fonts-regular: var(--fonts-override,var(--fonts-proportional)),"Noto Sans","Liberation Sans",var(--fonts-emoji),sans-serif; + --fonts-regular: "Noto Sans","Liberation Sans",sans-serif; } body { - background: var(--body-bg-color); + background-color: var(--body-bg-color); + background-image: url(wave.svg); + background-size: 100% auto; + background-repeat: no-repeat; font-family: var(--fonts-regular); font-weight: var(--main-font-weight); } @@ -27,19 +27,13 @@ br { margin-top: 2px; } -.wave-background { - background-image: url(wave.svg); - background-size: 100% auto; - background-repeat: no-repeat; -} - .card { - margin: 25px auto; - padding: 20px; + margin: 36px auto; + padding: 26px; background: var(--accent-bg-color); border-radius: var(--card-border-radius); - box-shadow: 2px -2px 38px 1px rgba(0,0,0,0.59); + box-shadow: 0 0 30px 1px rgba(0, 0, 0, 0.45); } .card.layout-card { @@ -105,6 +99,6 @@ br { @media screen and (max-width: 768px) { .card.layout-card { - width: 80%; + width: 85%; } } \ No newline at end of file diff --git a/res/wave.svg b/out/res/wave.svg similarity index 100% rename from res/wave.svg rename to out/res/wave.svg diff --git a/robots.txt b/out/robots.txt similarity index 62% rename from robots.txt rename to out/robots.txt index caebd43..31a7615 100644 --- a/robots.txt +++ b/out/robots.txt @@ -1,3 +1,2 @@ User-agent: * -Disallow: /extra/ Disallow: /res/ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..efc541f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,380 @@ +{ + "name": "website-generator", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "website-generator", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "js-beautify": "^1.14.0" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", + "dependencies": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "node_modules/editorconfig": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", + "integrity": "sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==", + "dependencies": { + "commander": "^2.19.0", + "lru-cache": "^4.1.5", + "semver": "^5.6.0", + "sigmund": "^1.0.1" + }, + "bin": { + "editorconfig": "bin/editorconfig" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "node_modules/js-beautify": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.14.0.tgz", + "integrity": "sha512-yuck9KirNSCAwyNJbqW+BxJqJ0NLJ4PwBUzQQACl5O3qHMBXVkXb/rD0ilh/Lat/tn88zSZ+CAHOlk0DsY7GuQ==", + "dependencies": { + "config-chain": "^1.1.12", + "editorconfig": "^0.15.3", + "glob": "^7.1.3", + "nopt": "^5.0.0" + }, + "bin": { + "css-beautify": "js/bin/css-beautify.js", + "html-beautify": "js/bin/html-beautify.js", + "js-beautify": "js/bin/js-beautify.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=" + }, + "node_modules/pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "node_modules/yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + } + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "editorconfig": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", + "integrity": "sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==", + "requires": { + "commander": "^2.19.0", + "lru-cache": "^4.1.5", + "semver": "^5.6.0", + "sigmund": "^1.0.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "js-beautify": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.14.0.tgz", + "integrity": "sha512-yuck9KirNSCAwyNJbqW+BxJqJ0NLJ4PwBUzQQACl5O3qHMBXVkXb/rD0ilh/Lat/tn88zSZ+CAHOlk0DsY7GuQ==", + "requires": { + "config-chain": "^1.1.12", + "editorconfig": "^0.15.3", + "glob": "^7.1.3", + "nopt": "^5.0.0" + } + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "requires": { + "abbrev": "1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=" + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..2f10cd2 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "website-generator", + "version": "1.0.0", + "description": "", + "main": "build.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://git.hippoz.xyz/hippoz/homepage" + }, + "author": "", + "license": "MIT", + "dependencies": { + "js-beautify": "^1.14.0" + } +} diff --git a/src/blog.page.js b/src/blog.page.js new file mode 100644 index 0000000..8a088d2 --- /dev/null +++ b/src/blog.page.js @@ -0,0 +1,12 @@ +const Page = require("./components/Page.component"); + +module.exports = Page({ + title: "hippoz blog", + description: "hippoz blog" +})(` +

hippoz's blog

+

i think

+
+
+

no articles yet

+`); diff --git a/src/components/LinkButton.component.js b/src/components/LinkButton.component.js new file mode 100644 index 0000000..e19998a --- /dev/null +++ b/src/components/LinkButton.component.js @@ -0,0 +1 @@ +module.exports = ({ link, text }) => `${text}`; \ No newline at end of file diff --git a/src/components/Navigation.component.js b/src/components/Navigation.component.js new file mode 100644 index 0000000..c431296 --- /dev/null +++ b/src/components/Navigation.component.js @@ -0,0 +1,16 @@ +const { navigationLinks, navigationBrandingText } = require("../env"); +const LinkButton = require("./LinkButton.component"); + +module.exports = () => ` +
+ + +
`; \ No newline at end of file diff --git a/src/components/Page.component.js b/src/components/Page.component.js new file mode 100644 index 0000000..f3a43c9 --- /dev/null +++ b/src/components/Page.component.js @@ -0,0 +1,19 @@ +const Navigation = require("./Navigation.component"); + +module.exports = ({ title="page", description="a page" }) => (content) => +` + + + + + + ${title} + + + + ${Navigation()} +
+ ${content} +
+ +`; diff --git a/src/env/index.js b/src/env/index.js new file mode 100644 index 0000000..3397448 --- /dev/null +++ b/src/env/index.js @@ -0,0 +1,9 @@ +module.exports = { + navigationLinks: [ + ["index.html", "home"], + ["blog.html", "blog"], + ["me.html", "me"], + ["https://git.hippoz.xyz", "git"], + ], + navigationBrandingText: "hippoz." +} \ No newline at end of file diff --git a/src/index.page.js b/src/index.page.js new file mode 100644 index 0000000..a1c70b9 --- /dev/null +++ b/src/index.page.js @@ -0,0 +1,9 @@ +const Page = require("./components/Page.component"); + +module.exports = Page({ + title: "hippoz", + description: "hippoz website homepage" +})(` +

hippoz's website

+

i think

+`); diff --git a/src/me.page.js b/src/me.page.js new file mode 100644 index 0000000..12c5585 --- /dev/null +++ b/src/me.page.js @@ -0,0 +1,12 @@ +const Page = require("./components/Page.component"); + +module.exports = Page({ + title: "about", + description: "hippoz about page" +})(` +

hello

+

i think

+
+
+

i'm hippoz. that's about it.

+`);