From 8d0a028d39c02277cfeca235f01916151db015c0 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sun, 8 Apr 2018 00:19:54 +0200 Subject: [PATCH] finalize gatsby migration --- .eslintrc | 3 +++ .gitignore | 1 - .gitlab-ci.yml | 3 ++- .stylelintrc | 10 ++++++++++ data/meta.json | 1 + gatsby-config.js | 12 ++++++++---- package.json | 11 +++++++++-- public/index.html | 1 - src/components/molecules/Footer.js | 2 +- src/components/molecules/Header.js | 2 +- src/components/molecules/Social.js | 2 +- src/components/organisms/Projects.js | 1 - src/layouts/Project.js | 9 +++------ src/layouts/index.js | 2 +- 14 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 .stylelintrc delete mode 100644 public/index.html diff --git a/.eslintrc b/.eslintrc index 1e9ad3b..8cf65df 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,6 +11,9 @@ "browser": true, "node": true }, + "globals": { + "graphql": true + }, "extends": ["eslint:recommended", "plugin:react/recommended"], "rules": { "quotes": ["error", "single"], diff --git a/.gitignore b/.gitignore index d8105c3..5cebd59 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,3 @@ npm-debug.log* yarn-debug.log* yarn.lock package-lock.json -src/**/*.css diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ef8885..8184d4f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ cache: testing: stage: test script: - - npm install + - npm i gatsby-cli -g + - npm i - npm test - npm run build diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 0000000..f537488 --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,10 @@ +{ + "extends": [ + "stylelint-config-standard" + ], + "syntax": "scss", + "rules": { + "indentation": 4, + "number-leading-zero": "never" + } +} diff --git a/data/meta.json b/data/meta.json index f9c1273..988d9a9 100644 --- a/data/meta.json +++ b/data/meta.json @@ -2,6 +2,7 @@ "title": "Matthias Kretschmann", "tagline": "Designer & Developer", "description": "", + "url": "https://matthiaskretschmann.com", "social": { "Twitter": "https://twitter.com/kremalicious", "GitHub": "https://github.com/kremalicious", diff --git a/gatsby-config.js b/gatsby-config.js index 643d7a1..9e679a4 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,10 +1,14 @@ +const meta = require('./data/meta.json') + module.exports = { siteMetadata: { - title: 'Gatsby Default Starter', + siteUrl: `${meta.url}`, }, plugins: [ + 'gatsby-plugin-react-next', 'gatsby-plugin-react-helmet', 'gatsby-transformer-json', + 'gatsby-plugin-sitemap', { resolve: 'gatsby-source-filesystem', options: { @@ -17,9 +21,9 @@ module.exports = { options: { includePaths: [ `${__dirname}/node_modules`, - `${__dirname}/src/styles`, + `${__dirname}/src/styles` ], }, - }, - ], + } + ] } diff --git a/package.json b/package.json index ff2b7f9..0b438ff 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "gatsby": "^1.9.241", "gatsby-link": "^1.6.39", "gatsby-plugin-react-helmet": "^2.0.8", + "gatsby-plugin-react-next": "^1.0.11", "gatsby-plugin-sass": "latest", + "gatsby-plugin-sitemap": "^1.2.20", "gatsby-source-filesystem": "^1.5.28", "gatsby-transformer-json": "^1.0.16", "react-helmet": "^5.2.0", @@ -18,12 +20,17 @@ "eslint": "^4.19.1", "eslint-plugin-graphql": "^1.5.0", "eslint-plugin-react": "^7.7.0", - "prettier": "^1.11.1" + "prettier": "^1.11.1", + "stylelint": "^9.2.0", + "stylelint-config-standard": "^18.2.0" }, "scripts": { + "lint:js": "eslint ./src/**/*.js", + "lint:css": "stylelint ./src/**/*.scss", + "lint": "npm run lint:js && npm run lint:css", "build": "gatsby build", "start": "gatsby develop", "format": "prettier --write 'src/**/*.js'", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "npm run lint" } } diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 53b46f3..0000000 --- a/public/index.html +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/src/components/molecules/Footer.js b/src/components/molecules/Footer.js index d7e3059..776ef71 100644 --- a/src/components/molecules/Footer.js +++ b/src/components/molecules/Footer.js @@ -1,5 +1,5 @@ import React from 'react' -import meta from '../../data/meta.json' +import meta from '../../../data/meta.json' import './Footer.scss' const Footer = () => { diff --git a/src/components/molecules/Header.js b/src/components/molecules/Header.js index d7dfd64..0a6c8c4 100644 --- a/src/components/molecules/Header.js +++ b/src/components/molecules/Header.js @@ -3,7 +3,7 @@ import Link from 'react-router-dom/Link' import PropTypes from 'prop-types' import Social from './Social' import './Header.scss' -import meta from '../../data/meta.json' +import meta from '../../../data/meta.json' class Header extends Component { render() { diff --git a/src/components/molecules/Social.js b/src/components/molecules/Social.js index 37b9e34..b00a6f3 100644 --- a/src/components/molecules/Social.js +++ b/src/components/molecules/Social.js @@ -1,6 +1,6 @@ import React from 'react' import { Twitter, GitHub, Facebook } from '../atoms/Icons' -import meta from '../../data/meta.json' +import meta from '../../../data/meta.json' import './Social.scss' const social = meta.social diff --git a/src/components/organisms/Projects.js b/src/components/organisms/Projects.js index 80b5c7a..1fbbb8e 100644 --- a/src/components/organisms/Projects.js +++ b/src/components/organisms/Projects.js @@ -6,7 +6,6 @@ import images from '../../images' import './Projects.scss' const Projects = ({ data }) => { - console.log(data) const projects = data.allProjectsJson return
diff --git a/src/layouts/Project.js b/src/layouts/Project.js index 70c208d..bb6ccc1 100644 --- a/src/layouts/Project.js +++ b/src/layouts/Project.js @@ -9,10 +9,7 @@ import images from '../images' import './Project.scss' const Project = ({ data }) => { - const project = data.allProjectsJson - - console.log(project) - + const project = data.allProjectsJson.edges[0].node const title = project.title const img = project.img const img_more = project.img_more @@ -82,8 +79,8 @@ Project.propTypes = { export default Project export const query = graphql` - query ProjectQuery($slug: String!) { - allProjectsJson(slug: { eq: $slug }) { + query ProjectQuery($slug: String) { + allProjectsJson(filter: { slug: { eq: $slug } }) { edges { node { title diff --git a/src/layouts/index.js b/src/layouts/index.js index 0328e19..608bc66 100644 --- a/src/layouts/index.js +++ b/src/layouts/index.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types' import Helmet from 'react-helmet' import FadeIn from '../components/atoms/FadeIn' import Footer from '../components/molecules/Footer' -import meta from '../data/meta.json' +import meta from '../../data/meta.json' import './index.scss' const Head = () => (