1
0
Fork 0

start refactor

This commit is contained in:
Matthias Kretschmann 2018-07-11 17:56:13 +02:00
parent ce6c2af091
commit d134cef267
Signed by: m
GPG Key ID: 606EEEF3C479A91F
717 changed files with 244 additions and 959 deletions

View File

@ -1,3 +0,0 @@
{
"presets": ["env"]
}

View File

@ -1,13 +1,14 @@
# EditorConfig is awesome: http://EditorConfig.org
root = true
[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
[*.json]
indent_size = 2
[*.scss]
indent_size = 4

27
.eslintrc Normal file
View File

@ -0,0 +1,27 @@
{
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"plugins": ["react", "graphql", "prettier"],
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true
}
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"rules": {
"quotes": ["error", "single"],
"semi": ["error", "never"],
"object-curly-spacing": ["error", "always"],
"prettier/prettier": "error"
}
}

6
.gitignore vendored
View File

@ -1,8 +1,6 @@
node_modules
_site
_build
Gemfile.lock
_src/.jekyll-metadata
yarn.lock
.yarnclean
package-lock.json
public
.cache

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
node_modules/
.cache/
static/
public/

5
.prettierrc Normal file
View File

@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}

12
.stylelintrc Normal file
View File

@ -0,0 +1,12 @@
{
"extends": [
"stylelint-config-standard",
"stylelint-config-css-modules",
"./node_modules/prettier-stylelint/config.js"
],
"syntax": "scss",
"rules": {
"indentation": 4,
"number-leading-zero": "never"
}
}

View File

@ -1,36 +1,22 @@
language: ruby
rvm:
- 2.5
language: node_js
node_js: node
cache:
bundler: true
directories:
- $TRAVIS_BUILD_DIR/node_modules
- $TRAVIS_BUILD_DIR/_site/media
- node_modules
- public
addons:
artifacts:
paths:
- $TRAVIS_BUILD_DIR/_site/media
apt:
update: true
packages:
- libgsl0ldbl
- libgsl0-dev
install:
- npm i
before_install:
- nvm install 10
before_script: "_ci/setup.sh"
script: "_ci/build.sh"
deploy:
skip_cleanup: true
provider: script
script: "_ci/deploy.sh"
on:
branch: master
script:
- npm test
- npm run build
after_success:
- pip install --user awscli
- export PATH=$PATH:$HOME/.local/bin
- npm run deploy
notifications:
email: false

20
Gemfile
View File

@ -1,20 +0,0 @@
# A sample Gemfile
source "https://rubygems.org"
group :jekyll do
gem 'jekyll'
gem 'jekyll-sitemap'
gem 'jekyll-redirect-from'
gem 'jekyll-archives'
gem 'jekyll-paginate'
end
group :development do
gem 'redcarpet'
end
group :lsi do
gem 'narray'
gem 'gsl'
gem 'classifier-reborn'
end

View File

@ -1,7 +1,7 @@
kremalicious3
blog
==================
> [kremalicious.com](http://kremalicious.com) based on [Jekyll](http://jekyllrb.com). Neat.
> [kremalicious.com](http://kremalicious.com) built with [Gatsby](http://gatsbyjs.org). Neat.
[![Build Status](https://travis-ci.com/kremalicious/kremalicious3.svg?branch=master)](https://travis-ci.com/kremalicious/kremalicious3)
[![Greenkeeper badge](https://badges.greenkeeper.io/kremalicious/kremalicious3.svg)](https://greenkeeper.io/)
@ -13,19 +13,6 @@ Requirements
You need to have the following tools installed on your development machine before moving on:
- [node.js](http://nodejs.org/) & [npm](https://npmjs.org/)
- [Ruby](https://www.ruby-lang.org) (for sanity, install with [rvm](https://rvm.io/)) and [Bundler](http://bundler.io/)
Content Creation
------------------
Some handy rake tasks creating the correct front matter for each content type:
New Content | Command
----------- | -----------
Post | `rake post -- Title`
Photo | `rake photo -- Title`
Link | `rake link -- Title`
Get up and running
@ -37,7 +24,7 @@ Get up and running
Run the following command from the repository's root folder to install all dependencies.
```bash
npm install && bundle install
npm install
```
### Development server
@ -45,13 +32,13 @@ npm install && bundle install
This generates the site with the dev build task `gulp build` and starts a local dev server combined with a livereloading watch task under `http://localhost:1337`.
```bash
gulp
npm start
```
### Production build
```bash
gulp build --production
npm run build
```

View File

@ -1,93 +0,0 @@
require 'rubygems'
require 'optparse'
require 'yaml'
#
# Create New Post
# rake post -- Title
#
task :post do
OptionParser.new.parse!
ARGV.shift
title = ARGV.join(' ')
path = "_src/_drafts/#{Date.today}-#{title.downcase.gsub(/[^[:alnum:]]+/, '-')}.md"
if File.exist?(path)
puts "Dude, file exists - skipping create"
else
File.open(path, "w") do |file|
file.puts YAML.dump({
'layout' => 'post',
'title' => title,
'image' => 'REPLACEME.jpg',
'author' => 'Matthias Kretschmann',
'date' => Time.now
})
file.puts "---"
end
end
`atom #{path}`
exit 1
end
#
# Create New Photo Post
# rake photo -- Title
#
task :photo do
OptionParser.new.parse!
ARGV.shift
title = ARGV.join(' ')
path = "_src/_drafts/#{Date.today}-#{title.downcase.gsub(/[^[:alnum:]]+/, '-')}.md"
if File.exist?(path)
puts "Dude, file exists - skipping create"
else
File.open(path, "w") do |file|
file.puts YAML.dump({
'layout' => 'photo',
'title' => title,
'image' => 'REPLACEME.jpg',
'author' => 'Matthias Kretschmann',
'date' => Time.now,
'category' => 'photos'
})
file.puts "---"
end
end
`atom-beta #{path}`
exit 1
end
#
# Create New Link Post
# rake link -- Title
#
task :photo do
OptionParser.new.parse!
ARGV.shift
title = ARGV.join(' ')
path = "_src/_drafts/#{Date.today}-#{title.downcase.gsub(/[^[:alnum:]]+/, '-')}.md"
if File.exist?(path)
puts "Dude, file exists - skipping create"
else
File.open(path, "w") do |file|
file.puts YAML.dump({
'layout' => 'link',
'title' => title,
'author' => 'Matthias Kretschmann',
'date' => Time.now
})
file.puts "---"
end
end
`atom #{path}`
exit 1
end

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
npm test &&
if [ "$TRAVIS_BRANCH" == "master" ]; then
gulp build --production
else
gulp build
fi;
exit;

View File

@ -1,17 +0,0 @@
#!/usr/bin/env bash
set -e;
echo "$(tput setaf 136)"
echo " Starting S3 deployment "
echo "============================================="
echo "$(tput sgr0)" # reset
gulp deploy
gulp seo
echo "$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ done S3 deployment "
echo "$(tput sgr0)" # reset

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
set -e;
echo "$(tput setaf 136)"
echo " Installing dependencies "
echo "============================================="
echo "$(tput sgr0)" # reset
npm install gulp-cli -g
npm install
# Travis does that automatically after selecting ruby
#bundle install
echo "$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ done installing dependencies"
echo "$(tput sgr0)" # reset

View File

@ -1,3 +0,0 @@
# fix for jekyll-picture-tag always prepending site.url
url: http://localhost:1337

View File

@ -1,76 +0,0 @@
#
# Home: /
# Archive Page: /archive/
# Pagination: /page/N/
# Post: /post-slug/
# RSS Feed: /feed/
#
# Basics
# --------------------
name: kremalicious
description: 'Blog of designer & developer Matthias Kretschmann'
url: https://kremalicious.com
author:
name: Matthias Kretschmann
email: m@kretschmann.io
uri: https://matthiaskretschmann.com
twitter: kremalicious
github: kremalicious
facebook: matthiaskretschmann
googleplus: +MatthiasKretschmann
bitcoin: 171qDmKEXm9YBgBLXyGjjPvopP5o9htQ1V
ether: "0x339dbC44d39bf1961E385ed0Ae88FC6069b87Ea1"
# Urls
# --------------------
permalink: /:title/
paginate: 15
paginate_path: "/page/:num"
category_dir: "/"
category_title_prefix: ""
media_url: "https://res.cloudinary.com/kremalicious"
# Content Parsing
# --------------------
future: false
markdown: redcarpet
redcarpet:
extensions: ['no_intra_emphasis', 'autolink', 'tables', 'smart', 'hard_wrap', 'fenced_code_blocks', 'strikethrough', 'highlight', 'quote', 'footnotes', 'with_toc_data', 'space_after_headers', 'superscript', 'lax_spacing']
# Generator
# --------------------
source: ./_src
destination: ./_site
keep_files: ['media']
# Plugins
# --------------------
plugins:
- jekyll-sitemap
- jekyll-redirect-from
- jekyll-paginate
- jekyll-archives
# jekyll-archives
# --------------------
jekyll-archives:
enabled:
- categories
- tags
layout: 'archive'
permalinks:
tag: '/tag/:name/'
category: '/:name/'

View File

@ -1,96 +0,0 @@
#custom filters for Octopress
module OctopressLiquidFilters
# Used on the blog index to split posts on the <!--more--> marker
def excerpt(input)
if input.index(/<!--\s*more\s*-->/i)
input.split(/<!--\s*more\s*-->/i)[0]
else
input
end
end
# Checks for excerpts (helpful for template conditionals)
def has_excerpt(input)
input =~ /<!--\s*more\s*-->/i ? true : false
end
# Summary is used on the Archive pages to return the first block of content from a post.
def summary(input)
if input.index(/\n\n/)
input.split(/\n\n/)[0]
else
input
end
end
# Extracts raw content DIV from template, used for page description as {{ content }}
# contains complete sub-template code on main page level
def raw_content(input)
/<div class="entry-content">(?<content>[\s\S]*?)<\/div>\s*<(footer|\/article)>/ =~ input
return (content.nil?) ? input : content
end
# Escapes CDATA sections in post content
def cdata_escape(input)
input.gsub(/<!\[CDATA\[/, '&lt;![CDATA[').gsub(/\]\]>/, ']]&gt;')
end
# Replaces relative urls with full urls
def expand_urls(input, url='')
url ||= '/'
input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\"'>]*)/ do
$1+url+$3
end
end
# Improved version of Liquid's truncate:
# - Doesn't cut in the middle of a word.
# - Uses typographically correct ellipsis (…) insted of '...'
def truncate(input, length)
if input.length > length && input[0..(length-1)] =~ /(.+)\b.+$/im
$1.strip + ' &hellip;'
else
input
end
end
# Improved version of Liquid's truncatewords:
# - Uses typographically correct ellipsis (…) insted of '...'
def truncatewords(input, length)
truncate = input.split(' ')
if truncate.length > length
truncate[0..length-1].join(' ').strip + ' &hellip;'
else
input
end
end
# Condenses multiple spaces and tabs into a single space
def condense_spaces(input)
input.gsub(/\s{2,}/, ' ')
end
# Removes trailing forward slash from a string for easily appending url segments
def strip_slash(input)
if input =~ /(.+)\/$|^\/$/
input = $1
end
input
end
# Returns a url without the protocol (http://)
def shorthand_url(input)
input.gsub /(https?:\/\/)(\S+)/ do
$2
end
end
# Returns a title cased string based on John Gruber's title case http://daringfireball.net/2008/08/title_case_update
def titlecase(input)
input.titlecase
end
end
Liquid::Template.register_filter OctopressLiquidFilters

View File

@ -1,36 +0,0 @@
class String
def titlecase
small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs. ezeep)
x = split(" ").map do |word|
# note: word could contain non-word characters!
# downcase all small_words, capitalize the rest
small_words.include?(word.gsub(/\W/, "").downcase) ? word.downcase! : word.smart_capitalize!
word
end
# capitalize first and last words
x.first.to_s.smart_capitalize!
x.last.to_s.smart_capitalize!
# small words are capitalized after colon, period, exclamation mark, question mark
x.join(" ").gsub(/(:|\.|!|\?)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " }
end
def titlecase!
replace(titlecase)
end
def smart_capitalize
# ignore any leading crazy characters and capitalize the first real character
if self =~ /^['"\(\[']*([a-z])/
i = index($1)
x = self[i,self.length]
# word with capitals and periods mid-word are left alone
self[i,1] = self[i,1].upcase unless x =~ /[A-Z]/ or x =~ /\.\w+/
end
self
end
def smart_capitalize!
replace(smart_capitalize)
end
end

View File

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

Before

Width:  |  Height:  |  Size: 3.0 MiB

After

Width:  |  Height:  |  Size: 3.0 MiB

View File

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 3.0 MiB

After

Width:  |  Height:  |  Size: 3.0 MiB

View File

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

Before

Width:  |  Height:  |  Size: 3.7 MiB

After

Width:  |  Height:  |  Size: 3.7 MiB

View File

Before

Width:  |  Height:  |  Size: 5.1 MiB

After

Width:  |  Height:  |  Size: 5.1 MiB

View File

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

Before

Width:  |  Height:  |  Size: 3.5 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

View File

Before

Width:  |  Height:  |  Size: 6.9 MiB

After

Width:  |  Height:  |  Size: 6.9 MiB

View File

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

View File

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

View File

Before

Width:  |  Height:  |  Size: 225 KiB

After

Width:  |  Height:  |  Size: 225 KiB

View File

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View File

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 153 KiB

View File

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 109 KiB

View File

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

View File

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

Before

Width:  |  Height:  |  Size: 2.4 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

Before

Width:  |  Height:  |  Size: 261 KiB

After

Width:  |  Height:  |  Size: 261 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 989 KiB

After

Width:  |  Height:  |  Size: 989 KiB

View File

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View File

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 115 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

Before

Width:  |  Height:  |  Size: 639 KiB

After

Width:  |  Height:  |  Size: 639 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

View File

Before

Width:  |  Height:  |  Size: 416 KiB

After

Width:  |  Height:  |  Size: 416 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

View File

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

Before

Width:  |  Height:  |  Size: 794 KiB

After

Width:  |  Height:  |  Size: 794 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 895 KiB

After

Width:  |  Height:  |  Size: 895 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 163 KiB

View File

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 183 KiB

View File

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Some files were not shown because too many files have changed in this diff Show More