From 776395520deba05beaf6f1da3c249f4b647bed17 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Mon, 22 Oct 2018 17:21:29 +1100 Subject: [PATCH] Restructuring folders [ Broken ] --- .babelrc | 32 +++---- package.json | 62 ++++++------- private/app/App.js | 63 +++++++------- ...nfigurationManager.js => Configuration.js} | 47 +++++----- private/database/DatabaseConnection.js | 82 ++++++++---------- private/index.js | 28 +++--- private/index.test.js | 0 .../images/banners/about/glasses.svg | 0 public/{ => assets}/images/banners/palms.svg | 0 .../{ => assets}/images/banners/vhs-black.svg | 0 public/{ => assets}/images/banners/vhs.svg | 0 .../images/branding/csharp/csharp-logo.svg | 0 .../images/branding/discord/discord-logo.svg | 0 .../google-cloud/google-cloud-logo.svg | 0 .../images/branding/heroku/heroku-logo.svg | 0 .../images/branding/java/java-logo.svg | 0 .../branding/monogame/monogame-logo.svg | 0 .../images/branding/mysql/mysql-logo.svg | 0 .../images/branding/neto/neto-logo.svg | 0 .../images/branding/nodejs/nodejs-logo.svg | 0 .../images/branding/opengl/opengl-logo.svg | 0 .../images/branding/pgsql/pgsql-logo.svg | 0 .../images/branding/php/php-logo.svg | 0 .../images/branding/react/react-logo.svg | 0 .../images/branding/shopify/shopify_glyph.svg | 0 .../branding/shopify/shopify_logo_darkbg.svg | 0 .../branding/shopify/shopify_logo_whitebg.svg | 0 .../images/branding/twitch/twitch-logo.svg | 0 .../images/branding/twitter/twitter-logo.svg | 0 .../images/branding/xna/xna-logo.svg | 0 .../images/favicon/android-icon-144x144.png | Bin .../images/favicon/android-icon-192x192.png | Bin .../images/favicon/android-icon-36x36.png | Bin .../images/favicon/android-icon-48x48.png | Bin .../images/favicon/android-icon-72x72.png | Bin .../images/favicon/android-icon-96x96.png | Bin .../images/favicon/apple-icon-114x114.png | Bin .../images/favicon/apple-icon-120x120.png | Bin .../images/favicon/apple-icon-144x144.png | Bin .../images/favicon/apple-icon-152x152.png | Bin .../images/favicon/apple-icon-180x180.png | Bin .../images/favicon/apple-icon-57x57.png | Bin .../images/favicon/apple-icon-60x60.png | Bin .../images/favicon/apple-icon-72x72.png | Bin .../images/favicon/apple-icon-76x76.png | Bin .../images/favicon/apple-icon-precomposed.png | Bin .../images/favicon/apple-icon.png | Bin .../images/favicon/browserconfig.xml | 0 .../images/favicon/favicon-16x16.png | Bin .../images/favicon/favicon-32x32.png | Bin .../images/favicon/favicon-96x96.png | Bin .../{ => assets}/images/favicon/favicon.ico | Bin .../{ => assets}/images/favicon/manifest.json | 0 .../images/favicon/ms-icon-144x144.png | Bin .../images/favicon/ms-icon-150x150.png | Bin .../images/favicon/ms-icon-310x310.png | Bin .../images/favicon/ms-icon-70x70.png | Bin public/{ => assets}/images/floppy.svg | 0 public/{ => assets}/images/grain.png | Bin public/{ => assets}/images/hills-night.svg | 0 public/{ => assets}/images/hills.svg | 0 .../{ => assets}/images/icons/hamburger.svg | 0 public/{ => assets}/images/logo.svg | 0 public/{ => assets}/images/palm.svg | 0 .../{ => assets}/images/patterns/arcade.svg | 0 .../images/patterns/asteroids.svg | 0 .../{ => assets}/images/patterns/cookies.svg | 0 public/{ => assets}/images/patterns/dots.svg | 0 .../{ => assets}/images/patterns/florida.svg | 0 .../images/patterns/game-show.svg | 0 .../images/patterns/lemon-triangle.svg | 0 public/{ => assets}/images/patterns/poly.svg | 0 .../images/patterns/rhythm-heaven.svg | 0 .../images/patterns/schoolbell.svg | 0 .../patterns/third-dimension-squiggle.svg | 0 public/{ => assets}/images/patterns/vert.svg | 0 .../images/window/button-inverted.svg | 0 public/{ => assets}/images/window/button.svg | 0 public/{ => assets}/images/window/frame.svg | 0 public/{ => assets}/images/window/icons.png | Bin public/{ => assets}/images/window/window.svg | 0 .../images/work-showcase/kopalife.png | Bin .../images/work-showcase/ozhair.png | Bin .../images/work-showcase/smai.svg | 0 .../videos/about/programming/programming.mp4 | Bin .../videos/about/programming/programming.png | Bin .../videos/about/programming/programming.webm | Bin .../videos/bunny/big_buck_bunny.jpg | Bin .../videos/bunny/big_buck_bunny.mp4 | Bin .../videos/bunny/big_buck_bunny.webm | Bin public/{ => components}/App.jsx | 4 +- public/{ => components}/Favicon.jsx | 37 ++++---- public/{ => components}/footer/Footer.jsx | 2 +- public/{ => components}/header/Header.jsx | 0 .../nav/menu/HamburgerMenu.jsx | 0 public/{ => components}/nav/navbar/Navbar.jsx | 0 public/{ => components}/page/Page.jsx | 2 +- public/{ => components}/page/PageBoundary.jsx | 0 public/{ => components}/page/Routes.jsx | 0 .../page/contact/ContactPage.jsx | 0 .../page/home/HomePage.jsx} | 0 .../page/home/sections/BannerSection.jsx | 0 .../home/sections/ExistingWorkSection.jsx | 0 .../page/home/sections/PlatformsSection.jsx | 0 .../page/home/sections/ProgrammingSection.jsx | 0 .../page/home/sections/PromoVideoSection.jsx | 0 .../page/legal/privacy/PrivacyPolicyPage.jsx | 0 public/{ => components}/section/Section.jsx | 0 .../section/blog/FeaturedBlogSection.jsx | 0 .../section/body/BodySection.jsx | 0 .../section/image/ImageSection.jsx | 0 .../section/layout/ClearSection.jsx | 0 .../section/layout/SplitSection.jsx | 0 .../section/video/VideoSection.jsx | 0 public/index.jsx | 28 +++--- public/language/en-AU.jsx | 2 +- .../animation/fade/ElementScrollFader.jsx | 0 .../{ => objects}/background/Background.jsx | 0 public/{ => objects}/content/ContentBox.jsx | 0 .../content/FloatingContentBox.jsx | 0 public/{ => objects}/image/Image.jsx | 0 public/{ => objects}/image/LoadableImage.jsx | 0 public/{ => objects}/input/Input.jsx | 0 public/{ => objects}/input/button/Button.jsx | 0 .../input/button/ButtonGroup.jsx | 0 public/{ => objects}/input/form/Form.jsx | 0 .../{ => objects}/input/group/InputGroup.jsx | 0 public/{ => objects}/input/label/Label.jsx | 0 public/{ => objects}/layout/BoxSizer.jsx | 0 public/{ => objects}/loading/Loader.jsx | 0 public/{ => objects}/modal/Modal.jsx | 0 public/{ => objects}/typography/Heading.jsx | 0 public/{ => objects}/typography/Paragraph.jsx | 0 public/{ => objects}/typography/Subtitle.jsx | 0 public/{ => objects}/typography/Title.jsx | 0 .../{ => objects}/typography/Typography.jsx | 0 public/{ => objects}/video/Video.jsx | 0 public/{ => objects}/window/AddressBar.jsx | 0 public/{ => objects}/window/ContextMenu.jsx | 0 public/{ => objects}/window/Frame.jsx | 0 public/{ => objects}/window/MenuBar.jsx | 0 public/{ => objects}/window/TitleBar.jsx | 0 public/{ => objects}/window/Window95.jsx | 0 public/styles/components/_footer.scss | 2 +- public/styles/index.scss | 1 + public/styles/objects/_window95.scss | 11 +-- public/styles/settings/assets.scss | 8 ++ webpack.config.js | 25 +++++- 148 files changed, 238 insertions(+), 198 deletions(-) rename private/configuration/{ConfigurationManager.js => Configuration.js} (73%) delete mode 100644 private/index.test.js rename public/{ => assets}/images/banners/about/glasses.svg (100%) rename public/{ => assets}/images/banners/palms.svg (100%) rename public/{ => assets}/images/banners/vhs-black.svg (100%) rename public/{ => assets}/images/banners/vhs.svg (100%) rename public/{ => assets}/images/branding/csharp/csharp-logo.svg (100%) rename public/{ => assets}/images/branding/discord/discord-logo.svg (100%) rename public/{ => assets}/images/branding/google-cloud/google-cloud-logo.svg (100%) rename public/{ => assets}/images/branding/heroku/heroku-logo.svg (100%) rename public/{ => assets}/images/branding/java/java-logo.svg (100%) rename public/{ => assets}/images/branding/monogame/monogame-logo.svg (100%) rename public/{ => assets}/images/branding/mysql/mysql-logo.svg (100%) rename public/{ => assets}/images/branding/neto/neto-logo.svg (100%) rename public/{ => assets}/images/branding/nodejs/nodejs-logo.svg (100%) rename public/{ => assets}/images/branding/opengl/opengl-logo.svg (100%) rename public/{ => assets}/images/branding/pgsql/pgsql-logo.svg (100%) rename public/{ => assets}/images/branding/php/php-logo.svg (100%) rename public/{ => assets}/images/branding/react/react-logo.svg (100%) rename public/{ => assets}/images/branding/shopify/shopify_glyph.svg (100%) rename public/{ => assets}/images/branding/shopify/shopify_logo_darkbg.svg (100%) rename public/{ => assets}/images/branding/shopify/shopify_logo_whitebg.svg (100%) rename public/{ => assets}/images/branding/twitch/twitch-logo.svg (100%) rename public/{ => assets}/images/branding/twitter/twitter-logo.svg (100%) rename public/{ => assets}/images/branding/xna/xna-logo.svg (100%) rename public/{ => assets}/images/favicon/android-icon-144x144.png (100%) rename public/{ => assets}/images/favicon/android-icon-192x192.png (100%) rename public/{ => assets}/images/favicon/android-icon-36x36.png (100%) rename public/{ => assets}/images/favicon/android-icon-48x48.png (100%) rename public/{ => assets}/images/favicon/android-icon-72x72.png (100%) rename public/{ => assets}/images/favicon/android-icon-96x96.png (100%) rename public/{ => assets}/images/favicon/apple-icon-114x114.png (100%) rename public/{ => assets}/images/favicon/apple-icon-120x120.png (100%) rename public/{ => assets}/images/favicon/apple-icon-144x144.png (100%) rename public/{ => assets}/images/favicon/apple-icon-152x152.png (100%) rename public/{ => assets}/images/favicon/apple-icon-180x180.png (100%) rename public/{ => assets}/images/favicon/apple-icon-57x57.png (100%) rename public/{ => assets}/images/favicon/apple-icon-60x60.png (100%) rename public/{ => assets}/images/favicon/apple-icon-72x72.png (100%) rename public/{ => assets}/images/favicon/apple-icon-76x76.png (100%) rename public/{ => assets}/images/favicon/apple-icon-precomposed.png (100%) rename public/{ => assets}/images/favicon/apple-icon.png (100%) rename public/{ => assets}/images/favicon/browserconfig.xml (100%) rename public/{ => assets}/images/favicon/favicon-16x16.png (100%) rename public/{ => assets}/images/favicon/favicon-32x32.png (100%) rename public/{ => assets}/images/favicon/favicon-96x96.png (100%) rename public/{ => assets}/images/favicon/favicon.ico (100%) rename public/{ => assets}/images/favicon/manifest.json (100%) rename public/{ => assets}/images/favicon/ms-icon-144x144.png (100%) rename public/{ => assets}/images/favicon/ms-icon-150x150.png (100%) rename public/{ => assets}/images/favicon/ms-icon-310x310.png (100%) rename public/{ => assets}/images/favicon/ms-icon-70x70.png (100%) rename public/{ => assets}/images/floppy.svg (100%) rename public/{ => assets}/images/grain.png (100%) rename public/{ => assets}/images/hills-night.svg (100%) rename public/{ => assets}/images/hills.svg (100%) rename public/{ => assets}/images/icons/hamburger.svg (100%) rename public/{ => assets}/images/logo.svg (100%) rename public/{ => assets}/images/palm.svg (100%) rename public/{ => assets}/images/patterns/arcade.svg (100%) rename public/{ => assets}/images/patterns/asteroids.svg (100%) rename public/{ => assets}/images/patterns/cookies.svg (100%) rename public/{ => assets}/images/patterns/dots.svg (100%) rename public/{ => assets}/images/patterns/florida.svg (100%) rename public/{ => assets}/images/patterns/game-show.svg (100%) rename public/{ => assets}/images/patterns/lemon-triangle.svg (100%) rename public/{ => assets}/images/patterns/poly.svg (100%) rename public/{ => assets}/images/patterns/rhythm-heaven.svg (100%) rename public/{ => assets}/images/patterns/schoolbell.svg (100%) rename public/{ => assets}/images/patterns/third-dimension-squiggle.svg (100%) rename public/{ => assets}/images/patterns/vert.svg (100%) rename public/{ => assets}/images/window/button-inverted.svg (100%) rename public/{ => assets}/images/window/button.svg (100%) rename public/{ => assets}/images/window/frame.svg (100%) rename public/{ => assets}/images/window/icons.png (100%) rename public/{ => assets}/images/window/window.svg (100%) rename public/{ => assets}/images/work-showcase/kopalife.png (100%) rename public/{ => assets}/images/work-showcase/ozhair.png (100%) rename public/{ => assets}/images/work-showcase/smai.svg (100%) rename public/{ => assets}/videos/about/programming/programming.mp4 (100%) rename public/{ => assets}/videos/about/programming/programming.png (100%) rename public/{ => assets}/videos/about/programming/programming.webm (100%) rename public/{ => assets}/videos/bunny/big_buck_bunny.jpg (100%) rename public/{ => assets}/videos/bunny/big_buck_bunny.mp4 (100%) rename public/{ => assets}/videos/bunny/big_buck_bunny.webm (100%) rename public/{ => components}/App.jsx (97%) rename public/{ => components}/Favicon.jsx (69%) rename public/{ => components}/footer/Footer.jsx (97%) rename public/{ => components}/header/Header.jsx (100%) rename public/{ => components}/nav/menu/HamburgerMenu.jsx (100%) rename public/{ => components}/nav/navbar/Navbar.jsx (100%) rename public/{ => components}/page/Page.jsx (97%) rename public/{ => components}/page/PageBoundary.jsx (100%) rename public/{ => components}/page/Routes.jsx (100%) rename public/{ => components}/page/contact/ContactPage.jsx (100%) rename public/{page/home/Homepage.jsx => components/page/home/HomePage.jsx} (100%) rename public/{ => components}/page/home/sections/BannerSection.jsx (100%) rename public/{ => components}/page/home/sections/ExistingWorkSection.jsx (100%) rename public/{ => components}/page/home/sections/PlatformsSection.jsx (100%) rename public/{ => components}/page/home/sections/ProgrammingSection.jsx (100%) rename public/{ => components}/page/home/sections/PromoVideoSection.jsx (100%) rename public/{ => components}/page/legal/privacy/PrivacyPolicyPage.jsx (100%) rename public/{ => components}/section/Section.jsx (100%) rename public/{ => components}/section/blog/FeaturedBlogSection.jsx (100%) rename public/{ => components}/section/body/BodySection.jsx (100%) rename public/{ => components}/section/image/ImageSection.jsx (100%) rename public/{ => components}/section/layout/ClearSection.jsx (100%) rename public/{ => components}/section/layout/SplitSection.jsx (100%) rename public/{ => components}/section/video/VideoSection.jsx (100%) rename public/{ => objects}/animation/fade/ElementScrollFader.jsx (100%) rename public/{ => objects}/background/Background.jsx (100%) rename public/{ => objects}/content/ContentBox.jsx (100%) rename public/{ => objects}/content/FloatingContentBox.jsx (100%) rename public/{ => objects}/image/Image.jsx (100%) rename public/{ => objects}/image/LoadableImage.jsx (100%) rename public/{ => objects}/input/Input.jsx (100%) rename public/{ => objects}/input/button/Button.jsx (100%) rename public/{ => objects}/input/button/ButtonGroup.jsx (100%) rename public/{ => objects}/input/form/Form.jsx (100%) rename public/{ => objects}/input/group/InputGroup.jsx (100%) rename public/{ => objects}/input/label/Label.jsx (100%) rename public/{ => objects}/layout/BoxSizer.jsx (100%) rename public/{ => objects}/loading/Loader.jsx (100%) rename public/{ => objects}/modal/Modal.jsx (100%) rename public/{ => objects}/typography/Heading.jsx (100%) rename public/{ => objects}/typography/Paragraph.jsx (100%) rename public/{ => objects}/typography/Subtitle.jsx (100%) rename public/{ => objects}/typography/Title.jsx (100%) rename public/{ => objects}/typography/Typography.jsx (100%) rename public/{ => objects}/video/Video.jsx (100%) rename public/{ => objects}/window/AddressBar.jsx (100%) rename public/{ => objects}/window/ContextMenu.jsx (100%) rename public/{ => objects}/window/Frame.jsx (100%) rename public/{ => objects}/window/MenuBar.jsx (100%) rename public/{ => objects}/window/TitleBar.jsx (100%) rename public/{ => objects}/window/Window95.jsx (100%) create mode 100644 public/styles/settings/assets.scss diff --git a/.babelrc b/.babelrc index 0fc2cc9..292c529 100644 --- a/.babelrc +++ b/.babelrc @@ -1,20 +1,22 @@ { "presets": [ - ["env", { - "targets": { - "node": "current", - "browsers": [ - "Chrome >= 41", - "FireFox >= 44", - "Safari >= 7", - "Explorer 11", - "last 4 Edge versions" - ] - }, - "useBuiltIns": false - }], - "react", - "babel-polyfill" + [ + "@babel/preset-env", + { + "targets": { + "node": "current", + "browsers": [ + "Chrome >= 41", + "FireFox >= 44", + "Safari >= 7", + "Explorer 11", + "last 4 Edge versions" + ] + }, + "useBuiltIns": false + } + ], + "@babel/preset-react" ], "ignore": [ "node_modules" diff --git a/package.json b/package.json index 8668787..a5be0dc 100644 --- a/package.json +++ b/package.json @@ -26,45 +26,47 @@ }, "homepage": "https://github.com/YourWishes/domsPlaceNew#readme", "dependencies": { - "babel-core": "^6.26.3", - "babel-loader": "^7.1.4", - "babel-polyfill": "^6.26.0", - "babel-preset-env": "^1.7.0", - "babel-preset-react": "^6.24.1", + "@babel/core": "^7.1.2", + "@babel/polyfill": "^7.0.0", + "@babel/preset-env": "^7.1.0", + "@babel/preset-react": "^7.0.0", + "babel-loader": "^8.0.4", "body-parser": "^1.18.3", - "compression-webpack-plugin": "^1.1.11", - "css-loader": "^0.28.11", - "express": "^4.16.3", - "file-loader": "^1.1.11", + "compression-webpack-plugin": "^2.0.0", + "css-loader": "^1.0.0", + "express": "^4.16.4", + "file-loader": "^2.0.0", "html-webpack-plugin": "^3.2.0", - "jimp": "^0.2.28", - "mini-css-extract-plugin": "^0.4.1", - "node-sass": "^4.9.0", - "nodemailer": "^4.6.7", - "optimize-css-assets-webpack-plugin": "^4.0.3", - "pg-promise": "^8.4.4", - "react": "^16.4.0", - "react-dom": "^16.4.0", + "jimp": "^0.5.4", + "mini-css-extract-plugin": "^0.4.4", + "node-cache": "^4.2.0", + "node-sass": "^4.9.4", + "nodemailer": "^4.6.8", + "optimize-css-assets-webpack-plugin": "^5.0.1", + "pg-promise": "^8.5.1", + "react": "^16.5.2", + "react-dom": "^16.5.2", "react-helmet": "^5.2.0", "react-redux": "^5.0.7", "react-router": "^4.3.1", "react-router-dom": "^4.3.1", "react-tap-event-plugin": "^3.0.3", - "react-transition-group": "^2.3.1", - "redux": "^4.0.0", + "react-transition-group": "^2.5.0", + "redux": "^4.0.1", + "redux-logger": "^3.0.6", "responsive-loader": "^1.1.0", - "sanitize-html": "^1.18.2", - "sass-loader": "^7.0.3", - "sharp": "^0.20.5", - "style-loader": "^0.21.0", - "uglifyjs-webpack-plugin": "^1.2.7", - "url-loader": "^1.0.1", - "webpack": "^4.14.0" + "sanitize-html": "^1.19.1", + "sass-loader": "^7.1.0", + "sharp": "^0.21.0", + "style-loader": "^0.23.1", + "uglifyjs-webpack-plugin": "^2.0.1", + "url-loader": "^1.1.2", + "webpack": "^4.22.0" }, "devDependencies": { - "nodemon": "^1.17.5", - "react-hot-loader": "^4.3.3", - "webpack-cli": "^3.0.8", - "webpack-dev-server": "^3.1.4" + "nodemon": "^1.18.4", + "react-hot-loader": "^4.3.11", + "webpack-cli": "^3.1.2", + "webpack-dev-server": "^3.1.9" } } diff --git a/private/app/App.js b/private/app/App.js index 8229731..489e7af 100644 --- a/private/app/App.js +++ b/private/app/App.js @@ -23,8 +23,7 @@ //Imports const - path = require('path'), - ConfigurationManager = require('./../configuration/ConfigurationManager'), + Configuration = require('./../config/Configuration'), DatabaseConnection = require('./../database/DatabaseConnection'), Server = require('./../server/Server'), Email = require('./../email/Email') @@ -35,45 +34,44 @@ const PUBLIC_PATH = path.join(__dirname, '..', '..', 'dist'); class App { constructor() { - + this.config = new Configuration(this); + this.database = new DatabaseConnection(this); + this.server = new Server(this); + this.email = new Email(this); } - getConfig() { return this.config; } - getDatabase() { return this.db; } - getPublicDirectory() { return PUBLIC_PATH; } + getConfig() { return this.config; } + getDatabase() { return this.database; } getServer() { return this.server; } - getAPI() { return this.getServer().getAPI(); } getEmail() {return this.email;} //Primary Functions - async start() { - //First, load our configuration. + async init() { + this.log('Starting App...'); + + //Load configuration... + this.log('Reading Configuration...'); try { - console.log("Loading Configuration..."); - this.config = new ConfigurationManager(this); - this.config.loadConfig(); - console.log("...Done!"); + await this.config.loadConfig(); } catch(e) { - console.error("Failed to read config!"); - throw new Error(e); + this.error('Failed to load configuration!'); + this.error(e); + return; } - //Next, connect to the database. + //Connect to the Database + this.log('Connecting to the Database...'); try { - console.log("Connecting to database..."); - this.db = new DatabaseConnection(this); - this.db.loadQueries();//Load our prepared queries - await this.db.connect();//Connect to the DB. - console.log("...Done!"); + await this.database.connect(); } catch(e) { - console.error("Failed to connect to the database!"); - throw new Error(e); + this.error('Failed to connect to database!'); + this.error(e); + return; } //Connect to our SMTP Host (For sending mail) try { - console.log('Connecting to SMTP Server'); - this.email = new Email(this); + this.log('Connecting to SMTP Server'); await this.email.connect(); console.log('...Done'); } catch(e) { @@ -84,19 +82,24 @@ class App { //Now we need to start the server. This provides both a nice interface, as //well as our API Handler (including 2auth callback urls) try { - console.log("Starting Server..."); - this.server = new Server(this); + this.log("Starting Server..."); await this.server.start(); console.log("...Done!"); } catch(e) { console.error("Failed to start the server!"); throw new Error(e); } - } - //Database Specific - onDatabaseConnected(db) { } + // Logging Functions // + log(e) { + //Will allow for extra logging + console.log(e) + } + + error(e) { + console.error(e); + } } module.exports = App; diff --git a/private/configuration/ConfigurationManager.js b/private/configuration/Configuration.js similarity index 73% rename from private/configuration/ConfigurationManager.js rename to private/configuration/Configuration.js index c12dd40..725b54a 100644 --- a/private/configuration/ConfigurationManager.js +++ b/private/configuration/Configuration.js @@ -21,52 +21,59 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +const fs = require('fs'); +const CONFIG_PATH = './private/data/config.json';// TODO: Set this a... better way? -//Imports -const fs = require('fs');//Used for file based configurations (local testing) -const CONFIG_PATH = './private/data/config.json';// TODO: Set this a different way? - -//Constructor -class ConfigurationManager { +class Configuration { constructor(app) { this.app = app; this.data = {}; + this.isHeroku = false; } - loadConfig() { - //Is this a Heroku Server? I need a nicer way of doing this in the future - let process_variables = process.env; + getApp() { return this.app; } + + async loadConfig(path) { + //First we need to check if this is Heroku or not... + let processVariabels = process.env; this.isHeroku = false; if( - process_variables !== typeof undefined && - typeof process_variables.NODE_HOME !== typeof undefined && - process_variables.NODE_HOME.indexOf("heroku") !== -1 + processVariabels !== typeof undefined && + typeof processVariabels.NODE_HOME !== typeof undefined && + processVariabels.NODE_HOME.indexOf("heroku") !== -1 ) { this.isHeroku = true; } //Read config data - if(!this.isHeroku) { + if(this.isHeroku) { + this.data = processVariabels; + } else { //TODO: Rather than use readSync, convert the whole function to async and use a library like fs-extra for async? let dataRaw = fs.readFileSync(CONFIG_PATH, 'utf8'); let data = JSON.parse(dataRaw); if(!data) throw new Error("Failed to parse Config JSON! Check for an error and try again."); this.data = data; - } else { - this.data = process_variables; } } - getValueOf(key) { + has(key) { + let value = this.get(key); + if(typeof value === typeof undefined) return false; + if(!value) return false; + return value.length !== 0; + } + + get(key) { if(this.isHeroku) { key = key.replace(/\./g, '_').toUpperCase(); if(typeof this.data[key] === typeof undefined) return null; return this.data[key]; } - return this.getValueOfRecursive(key.split(".")); + return this.getRecursive(key.split(".")); } - getValueOfRecursive(key_array, data_obj) { + getRecursive(key_array, data_obj) { if(typeof data_obj === typeof undefined) data_obj = this.data; if(typeof data_obj === typeof undefined) return null; @@ -78,10 +85,10 @@ class ConfigurationManager { if(key_array.length > 1) { if(typeof o !== typeof {}) return null; key_array.shift(); - return this.getValueOfRecursive(key_array, o); + return this.getRecursive(key_array, o); } return o; } } -module.exports = ConfigurationManager;//Export +module.exports = Configuration; diff --git a/private/database/DatabaseConnection.js b/private/database/DatabaseConnection.js index 5ced6a9..485eacf 100644 --- a/private/database/DatabaseConnection.js +++ b/private/database/DatabaseConnection.js @@ -21,71 +21,57 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -const - pgp = require('pg-promise')(), - fs = require('fs'), - path = require('path') -; +const pgp = require('pg-promise')(); +const fs = require('fs'); -const QUERIES_PATH = 'queries'; +const QUERIES_DIRECTORY = "queries"; class DatabaseConnection { constructor(app) { this.app = app; } - getConfig() {return this.app.getConfig();}//Short Hand Method + getApp() { return this.app; } + getConfig() {return this.getApp().getConfig();} - getQueriesPath() { - return path.join(__dirname, QUERIES_PATH); - } - - loadQueries() { - //Load Queries - let queries = {}; - - if(fs.existsSync(this.getQueriesPath())) { - let queryFiles = fs.readdirSync(this.getQueriesPath()); - for(var i = 0; i < queryFiles.length; i++) { - let file = queryFiles[i]; - let x = fs.readFileSync(path.join(this.getQueriesPath(), file), 'utf8'); - queries[file.replace(".sql", "")] = x; - } - } - - this.queries = queries; - return queries; - } - - isConnected() { + isConnnected() { return typeof this.db !== typeof undefined; } async connect() { - await this.connectThen(); - } + //Check Configuration + if(!this.getConfig().has("database.connection") && !this.getConfig().has("database.url")) throw new Error("Missing Database Connection URL!"); - async connectThen() { - if(this.isConnected()) return true; + //Load queries into cache + let queries = {}; + let types = fs.readdirSync(__dirname + '/' + QUERIES_DIRECTORY); + for(let i = 0; i < types.length; i++) { + //Now Scan each file in this directory + let dir = __dirname + '/' + QUERIES_DIRECTORY + '/' + types[i]; + let dirContents = fs.readdirSync(dir); + for(let x = 0; x < dirContents.length; x++) { + //Now read each file within this dir.. + let filePath = dir + '/' + dirContents[x]; + console.log(filePath); + let query = fs.readFileSync(filePath, 'utf8'); - if( - !this.getConfig().getValueOf("database.connection") - && !this.getConfig().getValueOf("database.url") - ) { - throw new Error("Missing DB Credentials."); + //Now Save our query as filename minus extension. + queries[dirContents[x].split('.')[0]] = query; + } } - this.db = pgp( - this.getConfig().getValueOf("database.connection") || - this.getConfig().getValueOf("database.url") - ); + this.queries = queries; - //Fire the event - if(typeof this.app.onDatabaseConnected === "function") { - await this.app.onDatabaseConnected(this); - } + //Connect to Database + this.db = await pgp( this.getConfig().get("database.connection") || this.getConfig().get("database.url") ); - return true; + //Now run any "Create" queries + let keys = Object.keys(queries); + for(let i = 0; i < keys.length; i++) { + let k = keys[i]; + if(!k.startsWith("Create")) return; + await this.none(k); + }; } getQuery(name) { @@ -121,6 +107,6 @@ class DatabaseConnection { let x = await this.db.query(q, data); return x; } -}; +} module.exports = DatabaseConnection; diff --git a/private/index.js b/private/index.js index aa1f2a0..2edea32 100644 --- a/private/index.js +++ b/private/index.js @@ -1,4 +1,3 @@ -'use strict'; // Copyright (c) 2018 Dominic Masters // // MIT License @@ -22,19 +21,24 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -//Import -const - App = require('./app/App') -; +'use strict'; -//Create +const App = require('./app/App'); + +//Attempt to make a global "Async Handler" for the app itself const app = new App(); -//Create entire app wrapper for safe logging and exiting from crashes etc. (async () => { - //Start the app - return await app.start(); -})().then((e) => console.log).catch((e) => { - if(!e) return; - console.error(e); + //Initialize the app + await app.init(); + + //Start the main thread + + //End the app +})().then((e) => { + //Should never occur + +}).catch((e) => { + //On Error + if(e) console.error(e); }); diff --git a/private/index.test.js b/private/index.test.js deleted file mode 100644 index e69de29..0000000 diff --git a/public/images/banners/about/glasses.svg b/public/assets/images/banners/about/glasses.svg similarity index 100% rename from public/images/banners/about/glasses.svg rename to public/assets/images/banners/about/glasses.svg diff --git a/public/images/banners/palms.svg b/public/assets/images/banners/palms.svg similarity index 100% rename from public/images/banners/palms.svg rename to public/assets/images/banners/palms.svg diff --git a/public/images/banners/vhs-black.svg b/public/assets/images/banners/vhs-black.svg similarity index 100% rename from public/images/banners/vhs-black.svg rename to public/assets/images/banners/vhs-black.svg diff --git a/public/images/banners/vhs.svg b/public/assets/images/banners/vhs.svg similarity index 100% rename from public/images/banners/vhs.svg rename to public/assets/images/banners/vhs.svg diff --git a/public/images/branding/csharp/csharp-logo.svg b/public/assets/images/branding/csharp/csharp-logo.svg similarity index 100% rename from public/images/branding/csharp/csharp-logo.svg rename to public/assets/images/branding/csharp/csharp-logo.svg diff --git a/public/images/branding/discord/discord-logo.svg b/public/assets/images/branding/discord/discord-logo.svg similarity index 100% rename from public/images/branding/discord/discord-logo.svg rename to public/assets/images/branding/discord/discord-logo.svg diff --git a/public/images/branding/google-cloud/google-cloud-logo.svg b/public/assets/images/branding/google-cloud/google-cloud-logo.svg similarity index 100% rename from public/images/branding/google-cloud/google-cloud-logo.svg rename to public/assets/images/branding/google-cloud/google-cloud-logo.svg diff --git a/public/images/branding/heroku/heroku-logo.svg b/public/assets/images/branding/heroku/heroku-logo.svg similarity index 100% rename from public/images/branding/heroku/heroku-logo.svg rename to public/assets/images/branding/heroku/heroku-logo.svg diff --git a/public/images/branding/java/java-logo.svg b/public/assets/images/branding/java/java-logo.svg similarity index 100% rename from public/images/branding/java/java-logo.svg rename to public/assets/images/branding/java/java-logo.svg diff --git a/public/images/branding/monogame/monogame-logo.svg b/public/assets/images/branding/monogame/monogame-logo.svg similarity index 100% rename from public/images/branding/monogame/monogame-logo.svg rename to public/assets/images/branding/monogame/monogame-logo.svg diff --git a/public/images/branding/mysql/mysql-logo.svg b/public/assets/images/branding/mysql/mysql-logo.svg similarity index 100% rename from public/images/branding/mysql/mysql-logo.svg rename to public/assets/images/branding/mysql/mysql-logo.svg diff --git a/public/images/branding/neto/neto-logo.svg b/public/assets/images/branding/neto/neto-logo.svg similarity index 100% rename from public/images/branding/neto/neto-logo.svg rename to public/assets/images/branding/neto/neto-logo.svg diff --git a/public/images/branding/nodejs/nodejs-logo.svg b/public/assets/images/branding/nodejs/nodejs-logo.svg similarity index 100% rename from public/images/branding/nodejs/nodejs-logo.svg rename to public/assets/images/branding/nodejs/nodejs-logo.svg diff --git a/public/images/branding/opengl/opengl-logo.svg b/public/assets/images/branding/opengl/opengl-logo.svg similarity index 100% rename from public/images/branding/opengl/opengl-logo.svg rename to public/assets/images/branding/opengl/opengl-logo.svg diff --git a/public/images/branding/pgsql/pgsql-logo.svg b/public/assets/images/branding/pgsql/pgsql-logo.svg similarity index 100% rename from public/images/branding/pgsql/pgsql-logo.svg rename to public/assets/images/branding/pgsql/pgsql-logo.svg diff --git a/public/images/branding/php/php-logo.svg b/public/assets/images/branding/php/php-logo.svg similarity index 100% rename from public/images/branding/php/php-logo.svg rename to public/assets/images/branding/php/php-logo.svg diff --git a/public/images/branding/react/react-logo.svg b/public/assets/images/branding/react/react-logo.svg similarity index 100% rename from public/images/branding/react/react-logo.svg rename to public/assets/images/branding/react/react-logo.svg diff --git a/public/images/branding/shopify/shopify_glyph.svg b/public/assets/images/branding/shopify/shopify_glyph.svg similarity index 100% rename from public/images/branding/shopify/shopify_glyph.svg rename to public/assets/images/branding/shopify/shopify_glyph.svg diff --git a/public/images/branding/shopify/shopify_logo_darkbg.svg b/public/assets/images/branding/shopify/shopify_logo_darkbg.svg similarity index 100% rename from public/images/branding/shopify/shopify_logo_darkbg.svg rename to public/assets/images/branding/shopify/shopify_logo_darkbg.svg diff --git a/public/images/branding/shopify/shopify_logo_whitebg.svg b/public/assets/images/branding/shopify/shopify_logo_whitebg.svg similarity index 100% rename from public/images/branding/shopify/shopify_logo_whitebg.svg rename to public/assets/images/branding/shopify/shopify_logo_whitebg.svg diff --git a/public/images/branding/twitch/twitch-logo.svg b/public/assets/images/branding/twitch/twitch-logo.svg similarity index 100% rename from public/images/branding/twitch/twitch-logo.svg rename to public/assets/images/branding/twitch/twitch-logo.svg diff --git a/public/images/branding/twitter/twitter-logo.svg b/public/assets/images/branding/twitter/twitter-logo.svg similarity index 100% rename from public/images/branding/twitter/twitter-logo.svg rename to public/assets/images/branding/twitter/twitter-logo.svg diff --git a/public/images/branding/xna/xna-logo.svg b/public/assets/images/branding/xna/xna-logo.svg similarity index 100% rename from public/images/branding/xna/xna-logo.svg rename to public/assets/images/branding/xna/xna-logo.svg diff --git a/public/images/favicon/android-icon-144x144.png b/public/assets/images/favicon/android-icon-144x144.png similarity index 100% rename from public/images/favicon/android-icon-144x144.png rename to public/assets/images/favicon/android-icon-144x144.png diff --git a/public/images/favicon/android-icon-192x192.png b/public/assets/images/favicon/android-icon-192x192.png similarity index 100% rename from public/images/favicon/android-icon-192x192.png rename to public/assets/images/favicon/android-icon-192x192.png diff --git a/public/images/favicon/android-icon-36x36.png b/public/assets/images/favicon/android-icon-36x36.png similarity index 100% rename from public/images/favicon/android-icon-36x36.png rename to public/assets/images/favicon/android-icon-36x36.png diff --git a/public/images/favicon/android-icon-48x48.png b/public/assets/images/favicon/android-icon-48x48.png similarity index 100% rename from public/images/favicon/android-icon-48x48.png rename to public/assets/images/favicon/android-icon-48x48.png diff --git a/public/images/favicon/android-icon-72x72.png b/public/assets/images/favicon/android-icon-72x72.png similarity index 100% rename from public/images/favicon/android-icon-72x72.png rename to public/assets/images/favicon/android-icon-72x72.png diff --git a/public/images/favicon/android-icon-96x96.png b/public/assets/images/favicon/android-icon-96x96.png similarity index 100% rename from public/images/favicon/android-icon-96x96.png rename to public/assets/images/favicon/android-icon-96x96.png diff --git a/public/images/favicon/apple-icon-114x114.png b/public/assets/images/favicon/apple-icon-114x114.png similarity index 100% rename from public/images/favicon/apple-icon-114x114.png rename to public/assets/images/favicon/apple-icon-114x114.png diff --git a/public/images/favicon/apple-icon-120x120.png b/public/assets/images/favicon/apple-icon-120x120.png similarity index 100% rename from public/images/favicon/apple-icon-120x120.png rename to public/assets/images/favicon/apple-icon-120x120.png diff --git a/public/images/favicon/apple-icon-144x144.png b/public/assets/images/favicon/apple-icon-144x144.png similarity index 100% rename from public/images/favicon/apple-icon-144x144.png rename to public/assets/images/favicon/apple-icon-144x144.png diff --git a/public/images/favicon/apple-icon-152x152.png b/public/assets/images/favicon/apple-icon-152x152.png similarity index 100% rename from public/images/favicon/apple-icon-152x152.png rename to public/assets/images/favicon/apple-icon-152x152.png diff --git a/public/images/favicon/apple-icon-180x180.png b/public/assets/images/favicon/apple-icon-180x180.png similarity index 100% rename from public/images/favicon/apple-icon-180x180.png rename to public/assets/images/favicon/apple-icon-180x180.png diff --git a/public/images/favicon/apple-icon-57x57.png b/public/assets/images/favicon/apple-icon-57x57.png similarity index 100% rename from public/images/favicon/apple-icon-57x57.png rename to public/assets/images/favicon/apple-icon-57x57.png diff --git a/public/images/favicon/apple-icon-60x60.png b/public/assets/images/favicon/apple-icon-60x60.png similarity index 100% rename from public/images/favicon/apple-icon-60x60.png rename to public/assets/images/favicon/apple-icon-60x60.png diff --git a/public/images/favicon/apple-icon-72x72.png b/public/assets/images/favicon/apple-icon-72x72.png similarity index 100% rename from public/images/favicon/apple-icon-72x72.png rename to public/assets/images/favicon/apple-icon-72x72.png diff --git a/public/images/favicon/apple-icon-76x76.png b/public/assets/images/favicon/apple-icon-76x76.png similarity index 100% rename from public/images/favicon/apple-icon-76x76.png rename to public/assets/images/favicon/apple-icon-76x76.png diff --git a/public/images/favicon/apple-icon-precomposed.png b/public/assets/images/favicon/apple-icon-precomposed.png similarity index 100% rename from public/images/favicon/apple-icon-precomposed.png rename to public/assets/images/favicon/apple-icon-precomposed.png diff --git a/public/images/favicon/apple-icon.png b/public/assets/images/favicon/apple-icon.png similarity index 100% rename from public/images/favicon/apple-icon.png rename to public/assets/images/favicon/apple-icon.png diff --git a/public/images/favicon/browserconfig.xml b/public/assets/images/favicon/browserconfig.xml similarity index 100% rename from public/images/favicon/browserconfig.xml rename to public/assets/images/favicon/browserconfig.xml diff --git a/public/images/favicon/favicon-16x16.png b/public/assets/images/favicon/favicon-16x16.png similarity index 100% rename from public/images/favicon/favicon-16x16.png rename to public/assets/images/favicon/favicon-16x16.png diff --git a/public/images/favicon/favicon-32x32.png b/public/assets/images/favicon/favicon-32x32.png similarity index 100% rename from public/images/favicon/favicon-32x32.png rename to public/assets/images/favicon/favicon-32x32.png diff --git a/public/images/favicon/favicon-96x96.png b/public/assets/images/favicon/favicon-96x96.png similarity index 100% rename from public/images/favicon/favicon-96x96.png rename to public/assets/images/favicon/favicon-96x96.png diff --git a/public/images/favicon/favicon.ico b/public/assets/images/favicon/favicon.ico similarity index 100% rename from public/images/favicon/favicon.ico rename to public/assets/images/favicon/favicon.ico diff --git a/public/images/favicon/manifest.json b/public/assets/images/favicon/manifest.json similarity index 100% rename from public/images/favicon/manifest.json rename to public/assets/images/favicon/manifest.json diff --git a/public/images/favicon/ms-icon-144x144.png b/public/assets/images/favicon/ms-icon-144x144.png similarity index 100% rename from public/images/favicon/ms-icon-144x144.png rename to public/assets/images/favicon/ms-icon-144x144.png diff --git a/public/images/favicon/ms-icon-150x150.png b/public/assets/images/favicon/ms-icon-150x150.png similarity index 100% rename from public/images/favicon/ms-icon-150x150.png rename to public/assets/images/favicon/ms-icon-150x150.png diff --git a/public/images/favicon/ms-icon-310x310.png b/public/assets/images/favicon/ms-icon-310x310.png similarity index 100% rename from public/images/favicon/ms-icon-310x310.png rename to public/assets/images/favicon/ms-icon-310x310.png diff --git a/public/images/favicon/ms-icon-70x70.png b/public/assets/images/favicon/ms-icon-70x70.png similarity index 100% rename from public/images/favicon/ms-icon-70x70.png rename to public/assets/images/favicon/ms-icon-70x70.png diff --git a/public/images/floppy.svg b/public/assets/images/floppy.svg similarity index 100% rename from public/images/floppy.svg rename to public/assets/images/floppy.svg diff --git a/public/images/grain.png b/public/assets/images/grain.png similarity index 100% rename from public/images/grain.png rename to public/assets/images/grain.png diff --git a/public/images/hills-night.svg b/public/assets/images/hills-night.svg similarity index 100% rename from public/images/hills-night.svg rename to public/assets/images/hills-night.svg diff --git a/public/images/hills.svg b/public/assets/images/hills.svg similarity index 100% rename from public/images/hills.svg rename to public/assets/images/hills.svg diff --git a/public/images/icons/hamburger.svg b/public/assets/images/icons/hamburger.svg similarity index 100% rename from public/images/icons/hamburger.svg rename to public/assets/images/icons/hamburger.svg diff --git a/public/images/logo.svg b/public/assets/images/logo.svg similarity index 100% rename from public/images/logo.svg rename to public/assets/images/logo.svg diff --git a/public/images/palm.svg b/public/assets/images/palm.svg similarity index 100% rename from public/images/palm.svg rename to public/assets/images/palm.svg diff --git a/public/images/patterns/arcade.svg b/public/assets/images/patterns/arcade.svg similarity index 100% rename from public/images/patterns/arcade.svg rename to public/assets/images/patterns/arcade.svg diff --git a/public/images/patterns/asteroids.svg b/public/assets/images/patterns/asteroids.svg similarity index 100% rename from public/images/patterns/asteroids.svg rename to public/assets/images/patterns/asteroids.svg diff --git a/public/images/patterns/cookies.svg b/public/assets/images/patterns/cookies.svg similarity index 100% rename from public/images/patterns/cookies.svg rename to public/assets/images/patterns/cookies.svg diff --git a/public/images/patterns/dots.svg b/public/assets/images/patterns/dots.svg similarity index 100% rename from public/images/patterns/dots.svg rename to public/assets/images/patterns/dots.svg diff --git a/public/images/patterns/florida.svg b/public/assets/images/patterns/florida.svg similarity index 100% rename from public/images/patterns/florida.svg rename to public/assets/images/patterns/florida.svg diff --git a/public/images/patterns/game-show.svg b/public/assets/images/patterns/game-show.svg similarity index 100% rename from public/images/patterns/game-show.svg rename to public/assets/images/patterns/game-show.svg diff --git a/public/images/patterns/lemon-triangle.svg b/public/assets/images/patterns/lemon-triangle.svg similarity index 100% rename from public/images/patterns/lemon-triangle.svg rename to public/assets/images/patterns/lemon-triangle.svg diff --git a/public/images/patterns/poly.svg b/public/assets/images/patterns/poly.svg similarity index 100% rename from public/images/patterns/poly.svg rename to public/assets/images/patterns/poly.svg diff --git a/public/images/patterns/rhythm-heaven.svg b/public/assets/images/patterns/rhythm-heaven.svg similarity index 100% rename from public/images/patterns/rhythm-heaven.svg rename to public/assets/images/patterns/rhythm-heaven.svg diff --git a/public/images/patterns/schoolbell.svg b/public/assets/images/patterns/schoolbell.svg similarity index 100% rename from public/images/patterns/schoolbell.svg rename to public/assets/images/patterns/schoolbell.svg diff --git a/public/images/patterns/third-dimension-squiggle.svg b/public/assets/images/patterns/third-dimension-squiggle.svg similarity index 100% rename from public/images/patterns/third-dimension-squiggle.svg rename to public/assets/images/patterns/third-dimension-squiggle.svg diff --git a/public/images/patterns/vert.svg b/public/assets/images/patterns/vert.svg similarity index 100% rename from public/images/patterns/vert.svg rename to public/assets/images/patterns/vert.svg diff --git a/public/images/window/button-inverted.svg b/public/assets/images/window/button-inverted.svg similarity index 100% rename from public/images/window/button-inverted.svg rename to public/assets/images/window/button-inverted.svg diff --git a/public/images/window/button.svg b/public/assets/images/window/button.svg similarity index 100% rename from public/images/window/button.svg rename to public/assets/images/window/button.svg diff --git a/public/images/window/frame.svg b/public/assets/images/window/frame.svg similarity index 100% rename from public/images/window/frame.svg rename to public/assets/images/window/frame.svg diff --git a/public/images/window/icons.png b/public/assets/images/window/icons.png similarity index 100% rename from public/images/window/icons.png rename to public/assets/images/window/icons.png diff --git a/public/images/window/window.svg b/public/assets/images/window/window.svg similarity index 100% rename from public/images/window/window.svg rename to public/assets/images/window/window.svg diff --git a/public/images/work-showcase/kopalife.png b/public/assets/images/work-showcase/kopalife.png similarity index 100% rename from public/images/work-showcase/kopalife.png rename to public/assets/images/work-showcase/kopalife.png diff --git a/public/images/work-showcase/ozhair.png b/public/assets/images/work-showcase/ozhair.png similarity index 100% rename from public/images/work-showcase/ozhair.png rename to public/assets/images/work-showcase/ozhair.png diff --git a/public/images/work-showcase/smai.svg b/public/assets/images/work-showcase/smai.svg similarity index 100% rename from public/images/work-showcase/smai.svg rename to public/assets/images/work-showcase/smai.svg diff --git a/public/videos/about/programming/programming.mp4 b/public/assets/videos/about/programming/programming.mp4 similarity index 100% rename from public/videos/about/programming/programming.mp4 rename to public/assets/videos/about/programming/programming.mp4 diff --git a/public/videos/about/programming/programming.png b/public/assets/videos/about/programming/programming.png similarity index 100% rename from public/videos/about/programming/programming.png rename to public/assets/videos/about/programming/programming.png diff --git a/public/videos/about/programming/programming.webm b/public/assets/videos/about/programming/programming.webm similarity index 100% rename from public/videos/about/programming/programming.webm rename to public/assets/videos/about/programming/programming.webm diff --git a/public/videos/bunny/big_buck_bunny.jpg b/public/assets/videos/bunny/big_buck_bunny.jpg similarity index 100% rename from public/videos/bunny/big_buck_bunny.jpg rename to public/assets/videos/bunny/big_buck_bunny.jpg diff --git a/public/videos/bunny/big_buck_bunny.mp4 b/public/assets/videos/bunny/big_buck_bunny.mp4 similarity index 100% rename from public/videos/bunny/big_buck_bunny.mp4 rename to public/assets/videos/bunny/big_buck_bunny.mp4 diff --git a/public/videos/bunny/big_buck_bunny.webm b/public/assets/videos/bunny/big_buck_bunny.webm similarity index 100% rename from public/videos/bunny/big_buck_bunny.webm rename to public/assets/videos/bunny/big_buck_bunny.webm diff --git a/public/App.jsx b/public/components/App.jsx similarity index 97% rename from public/App.jsx rename to public/components/App.jsx index 3d94146..2974ac4 100644 --- a/public/App.jsx +++ b/public/components/App.jsx @@ -23,11 +23,11 @@ import React from 'react'; import { connect } from 'react-redux'; +import { HashRouter, BrowserRouter } from 'react-router-dom'; -import Background from './background/Background'; +import Background from './../objects/background/Background'; import Header from './header/Header'; import Footer from './footer/Footer'; -import { HashRouter, BrowserRouter } from 'react-router-dom'; import Routes from './page/Routes'; import Favicon from './Favicon'; diff --git a/public/Favicon.jsx b/public/components/Favicon.jsx similarity index 69% rename from public/Favicon.jsx rename to public/components/Favicon.jsx index 2602f9a..0101dac 100644 --- a/public/Favicon.jsx +++ b/public/components/Favicon.jsx @@ -28,27 +28,32 @@ import React from 'react'; import Helmet from 'react-helmet'; +const prefix = './../assets/images/favicon/'; export default (props) => { return ( - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + + */} ); }; diff --git a/public/footer/Footer.jsx b/public/components/footer/Footer.jsx similarity index 97% rename from public/footer/Footer.jsx rename to public/components/footer/Footer.jsx index 1b56a97..c47378a 100644 --- a/public/footer/Footer.jsx +++ b/public/components/footer/Footer.jsx @@ -23,7 +23,7 @@ import React from 'react'; import { connect } from 'react-redux'; -import Language from './../language/Language'; +import Language from './../../language/Language'; import { NavLink } from 'react-router-dom' import { PageBoundary } from './../page/Page'; diff --git a/public/header/Header.jsx b/public/components/header/Header.jsx similarity index 100% rename from public/header/Header.jsx rename to public/components/header/Header.jsx diff --git a/public/nav/menu/HamburgerMenu.jsx b/public/components/nav/menu/HamburgerMenu.jsx similarity index 100% rename from public/nav/menu/HamburgerMenu.jsx rename to public/components/nav/menu/HamburgerMenu.jsx diff --git a/public/nav/navbar/Navbar.jsx b/public/components/nav/navbar/Navbar.jsx similarity index 100% rename from public/nav/navbar/Navbar.jsx rename to public/components/nav/navbar/Navbar.jsx diff --git a/public/page/Page.jsx b/public/components/page/Page.jsx similarity index 97% rename from public/page/Page.jsx rename to public/components/page/Page.jsx index 5788465..f43ae50 100644 --- a/public/page/Page.jsx +++ b/public/components/page/Page.jsx @@ -25,7 +25,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { Helmet } from "react-helmet"; import PageBoundary from './PageBoundary'; -import Language from './../language/Language'; +import Language from './../../language/Language'; class Page extends React.Component { constructor(props) { diff --git a/public/page/PageBoundary.jsx b/public/components/page/PageBoundary.jsx similarity index 100% rename from public/page/PageBoundary.jsx rename to public/components/page/PageBoundary.jsx diff --git a/public/page/Routes.jsx b/public/components/page/Routes.jsx similarity index 100% rename from public/page/Routes.jsx rename to public/components/page/Routes.jsx diff --git a/public/page/contact/ContactPage.jsx b/public/components/page/contact/ContactPage.jsx similarity index 100% rename from public/page/contact/ContactPage.jsx rename to public/components/page/contact/ContactPage.jsx diff --git a/public/page/home/Homepage.jsx b/public/components/page/home/HomePage.jsx similarity index 100% rename from public/page/home/Homepage.jsx rename to public/components/page/home/HomePage.jsx diff --git a/public/page/home/sections/BannerSection.jsx b/public/components/page/home/sections/BannerSection.jsx similarity index 100% rename from public/page/home/sections/BannerSection.jsx rename to public/components/page/home/sections/BannerSection.jsx diff --git a/public/page/home/sections/ExistingWorkSection.jsx b/public/components/page/home/sections/ExistingWorkSection.jsx similarity index 100% rename from public/page/home/sections/ExistingWorkSection.jsx rename to public/components/page/home/sections/ExistingWorkSection.jsx diff --git a/public/page/home/sections/PlatformsSection.jsx b/public/components/page/home/sections/PlatformsSection.jsx similarity index 100% rename from public/page/home/sections/PlatformsSection.jsx rename to public/components/page/home/sections/PlatformsSection.jsx diff --git a/public/page/home/sections/ProgrammingSection.jsx b/public/components/page/home/sections/ProgrammingSection.jsx similarity index 100% rename from public/page/home/sections/ProgrammingSection.jsx rename to public/components/page/home/sections/ProgrammingSection.jsx diff --git a/public/page/home/sections/PromoVideoSection.jsx b/public/components/page/home/sections/PromoVideoSection.jsx similarity index 100% rename from public/page/home/sections/PromoVideoSection.jsx rename to public/components/page/home/sections/PromoVideoSection.jsx diff --git a/public/page/legal/privacy/PrivacyPolicyPage.jsx b/public/components/page/legal/privacy/PrivacyPolicyPage.jsx similarity index 100% rename from public/page/legal/privacy/PrivacyPolicyPage.jsx rename to public/components/page/legal/privacy/PrivacyPolicyPage.jsx diff --git a/public/section/Section.jsx b/public/components/section/Section.jsx similarity index 100% rename from public/section/Section.jsx rename to public/components/section/Section.jsx diff --git a/public/section/blog/FeaturedBlogSection.jsx b/public/components/section/blog/FeaturedBlogSection.jsx similarity index 100% rename from public/section/blog/FeaturedBlogSection.jsx rename to public/components/section/blog/FeaturedBlogSection.jsx diff --git a/public/section/body/BodySection.jsx b/public/components/section/body/BodySection.jsx similarity index 100% rename from public/section/body/BodySection.jsx rename to public/components/section/body/BodySection.jsx diff --git a/public/section/image/ImageSection.jsx b/public/components/section/image/ImageSection.jsx similarity index 100% rename from public/section/image/ImageSection.jsx rename to public/components/section/image/ImageSection.jsx diff --git a/public/section/layout/ClearSection.jsx b/public/components/section/layout/ClearSection.jsx similarity index 100% rename from public/section/layout/ClearSection.jsx rename to public/components/section/layout/ClearSection.jsx diff --git a/public/section/layout/SplitSection.jsx b/public/components/section/layout/SplitSection.jsx similarity index 100% rename from public/section/layout/SplitSection.jsx rename to public/components/section/layout/SplitSection.jsx diff --git a/public/section/video/VideoSection.jsx b/public/components/section/video/VideoSection.jsx similarity index 100% rename from public/section/video/VideoSection.jsx rename to public/components/section/video/VideoSection.jsx diff --git a/public/index.jsx b/public/index.jsx index a53fa21..71988a2 100644 --- a/public/index.jsx +++ b/public/index.jsx @@ -22,35 +22,33 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -import 'babel-polyfill'; +import '@babel/polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import { createStore, applyMiddleware } from 'redux'; +import { createLogger } from 'redux-logger'; import { Provider } from 'react-redux'; -import RootReducer from './reducers/RootReducer' +import RootReducer from './reducers/RootReducer'; import Keyboard from './keyboard/Keyboard'; + //Import Stylesheet import Styles from './styles/index'; //Import Base Component -import App from './App'; +import App from './components/App'; //Create our redux middleware -const store = createStore(RootReducer); -const unsubscribe = store.subscribe(() => { - console.log(store.getState()); -}); +const store = createStore(RootReducer, applyMiddleware( + createLogger({ collapsed: true }) +)); //Start listening for key events Keyboard.register(); -ReactDOM.render( - ( - - - - ), - document.getElementById('app') -); +ReactDOM.render(( + + + +),document.getElementById('app')); diff --git a/public/language/en-AU.jsx b/public/language/en-AU.jsx index 471a8bf..1414c23 100644 --- a/public/language/en-AU.jsx +++ b/public/language/en-AU.jsx @@ -3,7 +3,7 @@ import { LanguageTools } from './Language'; import Policy from './policy-english'; -module.exports = { +export default { "site": { "name": "domsPlace", "title": "domsPlace - Personal Site of Dominic Masters", diff --git a/public/animation/fade/ElementScrollFader.jsx b/public/objects/animation/fade/ElementScrollFader.jsx similarity index 100% rename from public/animation/fade/ElementScrollFader.jsx rename to public/objects/animation/fade/ElementScrollFader.jsx diff --git a/public/background/Background.jsx b/public/objects/background/Background.jsx similarity index 100% rename from public/background/Background.jsx rename to public/objects/background/Background.jsx diff --git a/public/content/ContentBox.jsx b/public/objects/content/ContentBox.jsx similarity index 100% rename from public/content/ContentBox.jsx rename to public/objects/content/ContentBox.jsx diff --git a/public/content/FloatingContentBox.jsx b/public/objects/content/FloatingContentBox.jsx similarity index 100% rename from public/content/FloatingContentBox.jsx rename to public/objects/content/FloatingContentBox.jsx diff --git a/public/image/Image.jsx b/public/objects/image/Image.jsx similarity index 100% rename from public/image/Image.jsx rename to public/objects/image/Image.jsx diff --git a/public/image/LoadableImage.jsx b/public/objects/image/LoadableImage.jsx similarity index 100% rename from public/image/LoadableImage.jsx rename to public/objects/image/LoadableImage.jsx diff --git a/public/input/Input.jsx b/public/objects/input/Input.jsx similarity index 100% rename from public/input/Input.jsx rename to public/objects/input/Input.jsx diff --git a/public/input/button/Button.jsx b/public/objects/input/button/Button.jsx similarity index 100% rename from public/input/button/Button.jsx rename to public/objects/input/button/Button.jsx diff --git a/public/input/button/ButtonGroup.jsx b/public/objects/input/button/ButtonGroup.jsx similarity index 100% rename from public/input/button/ButtonGroup.jsx rename to public/objects/input/button/ButtonGroup.jsx diff --git a/public/input/form/Form.jsx b/public/objects/input/form/Form.jsx similarity index 100% rename from public/input/form/Form.jsx rename to public/objects/input/form/Form.jsx diff --git a/public/input/group/InputGroup.jsx b/public/objects/input/group/InputGroup.jsx similarity index 100% rename from public/input/group/InputGroup.jsx rename to public/objects/input/group/InputGroup.jsx diff --git a/public/input/label/Label.jsx b/public/objects/input/label/Label.jsx similarity index 100% rename from public/input/label/Label.jsx rename to public/objects/input/label/Label.jsx diff --git a/public/layout/BoxSizer.jsx b/public/objects/layout/BoxSizer.jsx similarity index 100% rename from public/layout/BoxSizer.jsx rename to public/objects/layout/BoxSizer.jsx diff --git a/public/loading/Loader.jsx b/public/objects/loading/Loader.jsx similarity index 100% rename from public/loading/Loader.jsx rename to public/objects/loading/Loader.jsx diff --git a/public/modal/Modal.jsx b/public/objects/modal/Modal.jsx similarity index 100% rename from public/modal/Modal.jsx rename to public/objects/modal/Modal.jsx diff --git a/public/typography/Heading.jsx b/public/objects/typography/Heading.jsx similarity index 100% rename from public/typography/Heading.jsx rename to public/objects/typography/Heading.jsx diff --git a/public/typography/Paragraph.jsx b/public/objects/typography/Paragraph.jsx similarity index 100% rename from public/typography/Paragraph.jsx rename to public/objects/typography/Paragraph.jsx diff --git a/public/typography/Subtitle.jsx b/public/objects/typography/Subtitle.jsx similarity index 100% rename from public/typography/Subtitle.jsx rename to public/objects/typography/Subtitle.jsx diff --git a/public/typography/Title.jsx b/public/objects/typography/Title.jsx similarity index 100% rename from public/typography/Title.jsx rename to public/objects/typography/Title.jsx diff --git a/public/typography/Typography.jsx b/public/objects/typography/Typography.jsx similarity index 100% rename from public/typography/Typography.jsx rename to public/objects/typography/Typography.jsx diff --git a/public/video/Video.jsx b/public/objects/video/Video.jsx similarity index 100% rename from public/video/Video.jsx rename to public/objects/video/Video.jsx diff --git a/public/window/AddressBar.jsx b/public/objects/window/AddressBar.jsx similarity index 100% rename from public/window/AddressBar.jsx rename to public/objects/window/AddressBar.jsx diff --git a/public/window/ContextMenu.jsx b/public/objects/window/ContextMenu.jsx similarity index 100% rename from public/window/ContextMenu.jsx rename to public/objects/window/ContextMenu.jsx diff --git a/public/window/Frame.jsx b/public/objects/window/Frame.jsx similarity index 100% rename from public/window/Frame.jsx rename to public/objects/window/Frame.jsx diff --git a/public/window/MenuBar.jsx b/public/objects/window/MenuBar.jsx similarity index 100% rename from public/window/MenuBar.jsx rename to public/objects/window/MenuBar.jsx diff --git a/public/window/TitleBar.jsx b/public/objects/window/TitleBar.jsx similarity index 100% rename from public/window/TitleBar.jsx rename to public/objects/window/TitleBar.jsx diff --git a/public/window/Window95.jsx b/public/objects/window/Window95.jsx similarity index 100% rename from public/window/Window95.jsx rename to public/objects/window/Window95.jsx diff --git a/public/styles/components/_footer.scss b/public/styles/components/_footer.scss index 2bea98a..f897896 100644 --- a/public/styles/components/_footer.scss +++ b/public/styles/components/_footer.scss @@ -20,7 +20,7 @@ $c-footer--link-hover-color: blue; padding-bottom: 10em; position: relative; overflow: hidden; - background-image: url('./../images/banners/palms.svg'); + background-image: url($s-asset--directory+'images/banners/palms.svg'); background-size: cover; &__inner { diff --git a/public/styles/index.scss b/public/styles/index.scss index d779011..aa82219 100644 --- a/public/styles/index.scss +++ b/public/styles/index.scss @@ -25,6 +25,7 @@ //Settings @import './settings/animation.scss'; +@import './settings/assets.scss'; @import './settings/colors.scss'; @import './settings/responsive.scss'; @import './settings/typography.scss'; diff --git a/public/styles/objects/_window95.scss b/public/styles/objects/_window95.scss index e05c577..5a71233 100644 --- a/public/styles/objects/_window95.scss +++ b/public/styles/objects/_window95.scss @@ -7,6 +7,7 @@ * Version: * 1.0.0 - 2018/06/24 */ + $o-window--color-background: #C0C0C0; $o-window--color-highlight: #0000BF; $o-window--color-disabled: #808080; @@ -20,25 +21,25 @@ $o-window--one-third: #{"33.333333333%"};//I needed greater accuracy than SCSS p @mixin o-window-border($thickness) { border: (3px * $thickness) solid black; - border-image-source: url('./../images/window/window.svg'); + border-image-source: url($s-asset--directory+'images/window/window.svg'); border-image-slice: $o-window--one-third; } @mixin o-window-button($thickness) { border: (2px * $thickness) solid black; - border-image-source: url('./../images/window/button.svg'); + border-image-source: url($s-asset--directory+'images/window/button.svg'); border-image-slice: $o-window--one-third; display: inline-block; background: $o-window--color-background; &:not(.is-disabled):active { - border-image-source: url('./../images/window/button-inverted.svg'); + border-image-source: url($s-asset--directory+'images/window/button-inverted.svg'); } } @mixin o-window-frame($thickness) { border: (2px * $thickness) solid black; - border-image: url('./../images/window/frame.svg') $o-window--one-third repeat; + border-image: url($s-asset--directory+'images/window/frame.svg') $o-window--one-third repeat; } //Classes @@ -87,7 +88,7 @@ $o-window--one-third: #{"33.333333333%"};//I needed greater accuracy than SCSS p height: 14px * $o-window--scale; font-size: $o-window--font-size; - background-image: url('./../images/window/icons.png'); + background-image: url($s-asset--directory+'images/window/icons.png'); background-position: 0px 0px; background-size: 48px*$o-window--scale 20px*$o-window--scale; diff --git a/public/styles/settings/assets.scss b/public/styles/settings/assets.scss new file mode 100644 index 0000000..c216230 --- /dev/null +++ b/public/styles/settings/assets.scss @@ -0,0 +1,8 @@ +/* + * Asset Settings + * Provides basic settings for assets used throughout the SCSS + * + * Version: + * 1.0.0 - 2018/10/22 + */ +$s-asset--directory: './../assets/'; diff --git a/webpack.config.js b/webpack.config.js index 947a96c..ccee260 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -35,7 +35,30 @@ module.exports = { { test: /\.jsx?$/, exclude: /node_modules/, - loaders: ['babel-loader'] + use: { + loader: 'babel-loader', + options: { + presets: [ + [ + "@babel/preset-env", + { + "targets": { + "node": "current", + "browsers": [ + "Chrome >= 41", + "FireFox >= 44", + "Safari >= 7", + "Explorer 11", + "last 4 Edge versions" + ] + }, + "useBuiltIns": false + } + ], + "@babel/preset-react" + ] + } + } }, {