From 9c436634f8cac0fdde673f8be5b983e6446c823d Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Wed, 13 Nov 2019 23:06:07 +0400 Subject: [PATCH] Restructure and update imports --- components/featured-content/roadmaps.js | 2 +- components/helmet/index.js | 2 +- components/mdx-components/heading.js | 2 +- components/page-footer/index.js | 2 +- components/roadmap-summary/index.js | 8 ++++---- layouts/default/index.js | 2 +- lib/author.js | 2 +- lib/guide.js | 6 +++--- lib/roadmap.js | 2 +- lib/url.js | 2 +- pages/guides/[guide].js | 2 +- pages/guides/index.js | 12 ++++++------ pages/roadmaps.js | 6 +++--- path-map.js | 4 ++-- readme.md | 4 ++-- {data => storage}/authors.json | 0 {data => storage}/guides.json | 0 .../guides/design-patterns-for-humans.md | 0 {data => storage}/guides/dns-in-one-picture.md | 0 {data => storage}/guides/http-caching.md | 0 {data => storage}/guides/journey-to-http2.md | 0 {data => storage}/project/backend-map.json | 0 {data => storage}/project/devops-map.json | 0 {data => storage}/project/disclaimer.json | 0 {data => storage}/project/frontend-map.json | 0 {data => storage}/project/intro-map.json | 0 {data => storage}/roadmaps.json | 0 {data => storage}/roadmaps/upcoming.md | 0 {data => storage}/site.json | 0 test/path-map.spec.js | 6 +++--- 30 files changed, 32 insertions(+), 32 deletions(-) rename {data => storage}/authors.json (100%) rename {data => storage}/guides.json (100%) rename {data => storage}/guides/design-patterns-for-humans.md (100%) rename {data => storage}/guides/dns-in-one-picture.md (100%) rename {data => storage}/guides/http-caching.md (100%) rename {data => storage}/guides/journey-to-http2.md (100%) rename {data => storage}/project/backend-map.json (100%) rename {data => storage}/project/devops-map.json (100%) rename {data => storage}/project/disclaimer.json (100%) rename {data => storage}/project/frontend-map.json (100%) rename {data => storage}/project/intro-map.json (100%) rename {data => storage}/roadmaps.json (100%) rename {data => storage}/roadmaps/upcoming.md (100%) rename {data => storage}/site.json (100%) diff --git a/components/featured-content/roadmaps.js b/components/featured-content/roadmaps.js index b604d331c..e77520e7c 100644 --- a/components/featured-content/roadmaps.js +++ b/components/featured-content/roadmaps.js @@ -1,6 +1,6 @@ import Link from 'next/link'; import { FeaturedContentWrap } from './style'; -import roadmaps from 'data/roadmaps'; +import roadmaps from 'storage/roadmaps'; import FeaturedRoadmap from 'components/featured-roadmap'; const FeaturedRoadmaps = () => ( diff --git a/components/helmet/index.js b/components/helmet/index.js index da8d32d92..15a431e0a 100644 --- a/components/helmet/index.js +++ b/components/helmet/index.js @@ -1,5 +1,5 @@ import NextHead from 'next/head'; -import siteConfig from 'data/site'; +import siteConfig from 'storage/site'; import { GA_TRACKING_ID } from 'lib/gtag'; const prepareTitle = (givenTitle) => { diff --git a/components/mdx-components/heading.js b/components/mdx-components/heading.js index 236fbec99..4668ac9bc 100644 --- a/components/mdx-components/heading.js +++ b/components/mdx-components/heading.js @@ -1,5 +1,5 @@ import styled from 'styled-components'; -import Link from '../icons/link.svg'; +import Link from 'components/icons/link.svg'; const linkify = (Component) => { return (props) => { diff --git a/components/page-footer/index.js b/components/page-footer/index.js index 3890a04f1..5efc307f4 100644 --- a/components/page-footer/index.js +++ b/components/page-footer/index.js @@ -1,5 +1,5 @@ import Link from 'next/link'; -import siteConfig from "data/site"; +import siteConfig from "storage/site"; import { FooterWrap } from './style.js' const PageFooter = () => ( diff --git a/components/roadmap-summary/index.js b/components/roadmap-summary/index.js index 15240e71a..2297cb738 100644 --- a/components/roadmap-summary/index.js +++ b/components/roadmap-summary/index.js @@ -1,5 +1,7 @@ import Link from 'next/link'; import classNames from 'classnames'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faEnvelope, faClock, faHandshake, faArrowLeft } from '@fortawesome/free-solid-svg-icons'; import { SummaryContainer, Title, @@ -12,17 +14,15 @@ import { } from './style'; import SharePage from 'components/share-page'; import { BadgeLink, BadgesList, PrimaryBadge, SecondaryBadge, DarkBadge } from 'components/badges'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faEnvelope, faClock, faHandshake, faArrowLeft } from '@fortawesome/free-solid-svg-icons'; import GuideBody from 'components/guide-body'; -import siteConfig from "data/site"; +import siteConfig from "storage/site"; const isActiveRoadmap = (loadedVersion, roadmapVersion) => ( (loadedVersion === roadmapVersion) || (loadedVersion === 'latest' && parseInt(roadmapVersion, 10) === (new Date()).getFullYear()) ); -const UpcomingGuide = require(`../../data/roadmaps/upcoming.md`).default; +const UpcomingGuide = require(`../../storage/roadmaps/upcoming.md`).default; const RoadmapSummary = ({ roadmap }) => ( diff --git a/layouts/default/index.js b/layouts/default/index.js index d3f164ba3..66adf7d9c 100644 --- a/layouts/default/index.js +++ b/layouts/default/index.js @@ -1,7 +1,7 @@ import React from 'react'; import Helmet from 'components/helmet'; import './global.scss'; -import { firePageView } from '../../lib/gtag'; +import { firePageView } from 'lib/gtag'; class DefaultLayout extends React.Component { componentDidMount() { diff --git a/lib/author.js b/lib/author.js index 9c53b1c6c..5c76e3091 100644 --- a/lib/author.js +++ b/lib/author.js @@ -1,3 +1,3 @@ -import authors from "data/authors"; +import authors from "storage/authors"; export const findByUsername = (username) => authors.find(author => author.username === username) || {}; diff --git a/lib/guide.js b/lib/guide.js index 148d1d712..9696f9496 100644 --- a/lib/guide.js +++ b/lib/guide.js @@ -1,6 +1,6 @@ -import guides from "data/guides"; -import authors from "data/authors"; -import siteConfig from "data/site"; +import guides from "storage/guides"; +import authors from "storage/authors"; +import siteConfig from "storage/site"; export const getAllGuides = () => { return guides.filter(guide => !guide.draft) diff --git a/lib/roadmap.js b/lib/roadmap.js index e9b8f3662..1fb16cbf8 100644 --- a/lib/roadmap.js +++ b/lib/roadmap.js @@ -1,4 +1,4 @@ -import roadmaps from "data/roadmaps"; +import roadmaps from "storage/roadmaps"; export const getRequestedRoadmap = req => { // Considering it a new roadmap URL e.g. `/roadmaps/frontend` diff --git a/lib/url.js b/lib/url.js index ee76ec580..c19b531d3 100644 --- a/lib/url.js +++ b/lib/url.js @@ -1,5 +1,5 @@ import queryString from 'query-string'; -import siteConfig from 'data/site'; +import siteConfig from 'storage/site'; export const prefixHost = (url) => { return /^\//.test(url) ? `${siteConfig.url}${url}` : url; diff --git a/pages/guides/[guide].js b/pages/guides/[guide].js index 7f481253a..1f90cc410 100644 --- a/pages/guides/[guide].js +++ b/pages/guides/[guide].js @@ -13,7 +13,7 @@ const Guide = ({ guide }) => { return } - const GuideContent = require(`../../data/guides/${guide.fileName}.md`).default; + const GuideContent = require(`../../storage/guides/${guide.fileName}.md`).default; return ( diff --git a/pages/guides/index.js b/pages/guides/index.js index 6ffaae590..011a23786 100644 --- a/pages/guides/index.js +++ b/pages/guides/index.js @@ -1,13 +1,13 @@ +import { faCodeBranch, faEnvelope } from '@fortawesome/free-solid-svg-icons/index'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { BadgeLink, BadgesList, PrimaryBadge, SecondaryBadge } from 'components/badges'; +import FeaturedGuide from 'components/featured-guide'; import DefaultLayout from 'layouts/default/index'; -import SiteNav from 'components/site-nav'; import PageHeader from 'components/page-header'; import PageFooter from 'components/page-footer'; +import SiteNav from 'components/site-nav'; import { getAllGuides } from 'lib/guide'; -import FeaturedGuide from '../../components/featured-guide'; -import { faCodeBranch, faEnvelope } from '@fortawesome/free-solid-svg-icons/index'; -import { BadgeLink, BadgesList, PrimaryBadge, SecondaryBadge } from 'components/badges'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import siteConfig from "data/site"; +import siteConfig from 'storage/site'; const Roadmap = () => ( diff --git a/pages/roadmaps.js b/pages/roadmaps.js index b266c6174..c69b3b61a 100644 --- a/pages/roadmaps.js +++ b/pages/roadmaps.js @@ -4,11 +4,11 @@ import DefaultLayout from 'layouts/default/index'; import SiteNav from 'components/site-nav'; import PageFooter from 'components/page-footer'; import PageHeader from 'components/page-header'; -import roadmaps from "data/roadmaps"; +import roadmaps from "storage/roadmaps"; import RowBlock from 'components/row-block'; import IconRowBlock from 'components/icon-row-block'; -import siteConfig from "data/site"; -import { BadgeLink, BadgesList, PrimaryBadge, SecondaryBadge } from '../components/badges'; +import siteConfig from "storage/site"; +import { BadgeLink, BadgesList, PrimaryBadge, SecondaryBadge } from 'components/badges'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faEnvelope, faCodeBranch } from '@fortawesome/free-solid-svg-icons'; diff --git a/path-map.js b/path-map.js index ff273ed2d..e00d48a67 100644 --- a/path-map.js +++ b/path-map.js @@ -1,8 +1,8 @@ const path = require('path'); const glob = require('glob'); -const guides = require('./data/guides.json'); -const roadmaps = require('./data/roadmaps'); +const guides = require('./storage/guides.json'); +const roadmaps = require('./storage/roadmaps'); const PAGES_PATH = path.join(__dirname, 'pages'); diff --git a/readme.md b/readme.md index c71be4d29..b016b45a6 100644 --- a/readme.md +++ b/readme.md @@ -21,9 +21,9 @@ If you think that these can be improved in anyway, please do suggest. ![Frontend Roadmap](./static/roadmaps/latest/frontend.png) -## Back-end Roadmap +## Backend Roadmap -![Back-end Roadmap](./static/roadmaps/latest/backend.png) +![Backend Roadmap](./static/roadmaps/latest/backend.png) ## DevOps Roadmap diff --git a/data/authors.json b/storage/authors.json similarity index 100% rename from data/authors.json rename to storage/authors.json diff --git a/data/guides.json b/storage/guides.json similarity index 100% rename from data/guides.json rename to storage/guides.json diff --git a/data/guides/design-patterns-for-humans.md b/storage/guides/design-patterns-for-humans.md similarity index 100% rename from data/guides/design-patterns-for-humans.md rename to storage/guides/design-patterns-for-humans.md diff --git a/data/guides/dns-in-one-picture.md b/storage/guides/dns-in-one-picture.md similarity index 100% rename from data/guides/dns-in-one-picture.md rename to storage/guides/dns-in-one-picture.md diff --git a/data/guides/http-caching.md b/storage/guides/http-caching.md similarity index 100% rename from data/guides/http-caching.md rename to storage/guides/http-caching.md diff --git a/data/guides/journey-to-http2.md b/storage/guides/journey-to-http2.md similarity index 100% rename from data/guides/journey-to-http2.md rename to storage/guides/journey-to-http2.md diff --git a/data/project/backend-map.json b/storage/project/backend-map.json similarity index 100% rename from data/project/backend-map.json rename to storage/project/backend-map.json diff --git a/data/project/devops-map.json b/storage/project/devops-map.json similarity index 100% rename from data/project/devops-map.json rename to storage/project/devops-map.json diff --git a/data/project/disclaimer.json b/storage/project/disclaimer.json similarity index 100% rename from data/project/disclaimer.json rename to storage/project/disclaimer.json diff --git a/data/project/frontend-map.json b/storage/project/frontend-map.json similarity index 100% rename from data/project/frontend-map.json rename to storage/project/frontend-map.json diff --git a/data/project/intro-map.json b/storage/project/intro-map.json similarity index 100% rename from data/project/intro-map.json rename to storage/project/intro-map.json diff --git a/data/roadmaps.json b/storage/roadmaps.json similarity index 100% rename from data/roadmaps.json rename to storage/roadmaps.json diff --git a/data/roadmaps/upcoming.md b/storage/roadmaps/upcoming.md similarity index 100% rename from data/roadmaps/upcoming.md rename to storage/roadmaps/upcoming.md diff --git a/data/site.json b/storage/site.json similarity index 100% rename from data/site.json rename to storage/site.json diff --git a/test/path-map.spec.js b/test/path-map.spec.js index 0188e6c7c..0ab131bd5 100644 --- a/test/path-map.spec.js +++ b/test/path-map.spec.js @@ -1,7 +1,7 @@ const path = require('path'); const fs = require('fs'); -const guides = require('../data/guides'); -const roadmaps = require('../data/roadmaps'); +const guides = require('../storage/guides'); +const roadmaps = require('../storage/roadmaps'); const { getPageRoutes, @@ -50,7 +50,7 @@ describe("Build scripts tests", () => { guides.forEach(guide => { const [,, slug] = guide.url.split('/'); - const expectedFile = path.join(__dirname, `../data/guides/${slug}.md`); + const expectedFile = path.join(__dirname, `../storage/guides/${slug}.md`); const foundFile = fs.existsSync(expectedFile) ? expectedFile : ''; expect(foundFile).toEqual(expectedFile);