Initial commit
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jake 2022-01-19 21:36:14 +00:00
commit 55a5b2b54c
17 changed files with 3060 additions and 0 deletions

34
.drone.yml Normal file
View File

@ -0,0 +1,34 @@
---
kind: pipeline
type: docker
name: main
steps:
- name: lint
image: node:17-alpine
commands:
- yarn --dev
- yarn run lint
- name: build
image: node:17-alpine
commands:
- yarn run build
- name: deploy
image: appleboy/drone-scp
settings:
host: southlondon.cc
username: jakew
key:
from_secret: ssh_key
port: 22
target: /home/jakew/public_html/cookbook/
source: _site
strip_components: 1
when:
branch:
- main
event:
- push
- tag
repo:
- jakew/cookbook

12
.editorconfig Normal file
View File

@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

22
.eleventy.js Normal file
View File

@ -0,0 +1,22 @@
const path = require("path");
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("static");
eleventyConfig.addWatchTarget("static");
eleventyConfig.addNunjucksFilter("domain", function(input) {
return (new URL(input)).hostname;
});
eleventyConfig.addNunjucksFilter("date", function(input) {
return (new Date(input)).toLocaleDateString("en-GB", {
day: "numeric",
month: "short",
year: "numeric"
});
});
return {
pathPrefix: "/~jakew/cookbook/"
}
}

2
.eleventyignore Normal file
View File

@ -0,0 +1,2 @@
README.md
LICENSE.md

211
.gitignore vendored Normal file
View File

@ -0,0 +1,211 @@
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### Node Patch ###
# Serverless Webpack directories
.webpack/
# Optional stylelint cache
# SvelteKit build / generate output
.svelte-kit
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
_site

24
LICENSE.md Normal file
View File

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>

19
README.md Normal file
View File

@ -0,0 +1,19 @@
# Cookbook
This is a little cookbook site which will hopefully have lots of different people's favourite recipes and serve as a place to find new and interesting recipes.
## Development
The site is made using the [Eleventy](https://www.11ty.dev) static site generator.
Firstly, install the dependencies using `npm install --dev` or `yarn install --dev`.
Then, run `npm run dev` or `yarn run dev` to start a local development server.
You can also run `npm run build` or `yarn run build` to build the site, the files are output in the `_site` directory.
## Adding Recipes
To add a new recipe, simply create a new JSON file in `_data/recipes`. It might be worth copying an existing one as a template.
There is a schema in the root of the repo `recipe.schema.json`, which all the JSON files are checked against in the CI stage. If you use an IDE like Visual Studio Code, it will automagically validate your recipe (make sure to have `"$schema": "../../recipe.schema.json"` in the document).

View File

@ -0,0 +1,32 @@
{
"$schema": "../../recipe.schema.json",
"title": "Easy Chicken Ramen",
"description": "A hearty noodle soup.",
"author": {
"username": "jakew",
"tilde": "https://southlondon.cc/"
},
"date": "2022-01-17",
"ingredients": [
"1.2l chicken stock",
"Small pack of coriander",
"1 red chilli (sliced)",
"2 tbsp light soy sauce",
"100g grey oyster mushrooms (sliced)",
"100g baby pak coi",
"2 skinless, cooked chicken breasts (sliced)",
"100g egg noodles",
"50g bamboo shoots (sliced)"
],
"instructions": [
"Set a large saucepan over a medium heat and pour in the stock. Finely chop the coriander stalks and add to the stock with most of the chilli. Bring to the boil and add 200ml water. Once boiled, reduce the heat and simmer for 5-10 mins to infuse the coriander and chilli.",
"Add the soy sauce and a grinding of black pepper, then the mushrooms, pak choi, chicken and noodles. Simmer for 2 mins until the noodles soften, before adding the bamboo shoots.",
"Serve in deep bowls topped with coriander leaves and the remaining chilli slices."
],
"source": "https://www.bbcgoodfood.com/recipes/cheats-chicken-ramen",
"servings": 4,
"timings": {
"prep": 10,
"cook": 20
}
}

View File

@ -0,0 +1,29 @@
{
"$schema": "../../recipe.schema.json",
"title": "3 Ingredient Macaroni and Cheese",
"description": "A super easy to make macaroni and cheese that only uses 3 ingredients!",
"author": {
"username": "jakew",
"tilde": "https://southlondon.cc/"
},
"date": "2022-01-17",
"ingredients": [
"227g Elbow Macaroni",
"Salt",
"237ml Double Cream",
"225g Grated Cheddar Cheese"
],
"instructions": [
"Bring a large pot of salted water to a boil.",
"Stir in the macaroni and cook, stirring frequently at the beginning, until al dente, about 1 minute shy of what the package directions suggest.",
"Dump the macaroni into a colander placed in the sink to drain.",
"While the macaroni drains, place the pot back on the stovetop over low heat. Add the double cream and then the cheese. Stir, increasing the heat slightly as you need to in order to speed things along, until the cheese melts into a sauce, 3 to 5 minutes.",
"Add the pasta to the sauce and stir enthusiastically until the sauce thickens and clings to each noodle, 1 to 2 minutes. Serve immediately."
],
"source": "https://leitesculinaria.com/136011/recipes-3-ingredient-macaroni-cheese.html",
"servings": 4,
"timings": {
"prep": 5,
"cook": 15
}
}

View File

@ -0,0 +1,39 @@
{
"$schema": "../../recipe.schema.json",
"title": "Spaghetti Bake",
"description": "A pasta bake but with spaghetti?",
"author": {
"username": "jakew",
"tilde": "https://southlondon.cc/"
},
"date": "2022-01-17",
"ingredients": [
"cooking spray",
"450g spaghetti",
"2 tbsp extra-virgin olive oil",
"1 medium onion, finely chopped",
"2 cloves of garlic, crushed",
"450g minced beef",
"salt",
"black pepper",
"1 tsp Italian seasoning",
"2 cans chopped tomatoes",
"20g chopped basil",
"100g grated mozzarella",
"25g grated Parmesan",
"fresh chopped parsley"
],
"instructions": [
"Preheat oven to 180°C. Grease a medium baking dish with cooking spray.",
"Cook spaghetti according to package directions until al dente, drain, and set aside.",
"Meanwhile, in a large skillet over medium heat, heat oil. Add onions and cook until soft and translucent, about 5 minutes. Stir in garlic and cook until fragrant, 1 minute more. Add minced beef, season with salt, pepper, and Italian seasoning, and cook until no longer pink, about 8 minutes. Drain fat in a bowl lined with paper towels and return to pan. Pour in chopped tomatoes and basil and simmer until slightly reduced, about 10 minutes. Season with more salt and pepper to taste.",
"Toss with spaghetti, then transfer to baking dish and top with mozzarella and Parmesan. Bake until cheese is melted and pasta is warmed through, about 20 minutes.",
"Garnish with parsley and serve."
],
"source": "https://www.delish.com/uk/cooking/recipes/a29067841/easy-baked-spaghetti-recipe/",
"servings": 6,
"timings": {
"prep": 15,
"cook": 45
}
}

19
_includes/main.njk Normal file
View File

@ -0,0 +1,19 @@
---
title: Cookbook
---
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ '/static/main.css' | url }}"/>
<title>{{ title }}</title>
</head>
<body>
<main>
{{ content | safe }}
</main>
</body>
</html>

26
index.njk Normal file
View File

@ -0,0 +1,26 @@
---
title: "Hello World!"
layout: main.njk
---
<h1>Cookbook</h1>
<p>Hello! This is a collection of delicious recipes.</p>
<p>Please add some of your own favourite recipes (or some cool feature) in the <a href="https://tildegit.org/jakew/cookbook">Git repo</a>.</p>
<h2>Contents</h2>
<ul>
{%- for recipe in collections.recipe -%}
<li class="recipe-item">
<span class="recipe-title">
<a href="{{ recipe.url | url }}">{{ recipe.data.title }}</a>
<span class="recipe-user">(~{{ recipe.data.recipe.author.username }})</span>
</span>
{% if recipe.data.recipe.description %}
<span class="recipe-description">{{ recipe.data.recipe.description }}</span>
{% endif %}
</li>
{%- endfor -%}
</ul>

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "cookbook",
"version": "1.0.0",
"main": "index.js",
"repository": "https://tildegit.org/jakew/cookbook.git",
"author": "Jake Walker <hi@jakew.me>",
"license": "Unlicense",
"private": false,
"devDependencies": {
"@11ty/eleventy": "^1.0.0",
"ajv-cli": "^5.0.0"
},
"scripts": {
"build": "eleventy",
"dev": "eleventy --serve",
"lint": "ajv validate -s recipe.schema.json -d \"_data/recipes/*.json\""
}
}

67
recipe.njk Normal file
View File

@ -0,0 +1,67 @@
---
pagination:
data: recipes
size: 1
resolve: values
alias: recipe
addAllPagesToCollections: true
permalink: "recipes/{{ recipe.title | slug }}/"
eleventyComputed:
title: "{{ recipe.title }}"
layout: main.njk
tags: recipe
---
<a href="{{ '/' | url }}">↜ back</a>
<div id="recipe-meta">
<h1 id="recipe-title">{{ recipe.title }}</h1>
<p id="recipe-description">{{ recipe.description }}</p>
<p id="recipe-details">
<span id="recipe-author">
Added by
<a href="{{ recipe.author.tilde }}~{{ recipe.author.username }}">~{{ recipe.author.username }}</a>
<small><i>({{ recipe.author.tilde | domain }})</i></small>
</span>
&bull;
<span id="recipe-date">Added {{ recipe.date | date }}</span>
{% if recipe.timings %}
&bull;
<span id="recipie-times">
Prep: {{ recipe.timings.prep }} min,
Cook: {{ recipe.timings.cook }} min,
Total: {{ recipe.timings.cook + recipe.timings.prep }} min
</span>
{% endif %}
{% if recipe.servings %}
&bull;
<span id="recipie-servings">{{ recipe.servings }} servings</span>
{% endif %}
</p>
</div>
<div id="recipe-ingredients">
<h2>Ingredients</h2>
<ul>
{% for ingredient in recipe.ingredients %}
<li>{{ ingredient }}</li>
{% endfor %}
</ul>
</div>
<div id="recipe-instructions">
<h2>Instructions</h2>
<ol>
{% for step in recipe.instructions %}
<li>{{ step }}</li>
{% endfor %}
</ol>
</div>
<div id="recipe-footer">
{% if recipe.source %}
<p>Source: {{ recipe.source }}</p>
{% endif %}
</div>

80
recipe.schema.json Normal file
View File

@ -0,0 +1,80 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "https://tildegit.org/jakew/cookbook/raw/branch/main/recipe.schema.json",
"title": "Recipe",
"description": "A recipe",
"type": "object",
"required": ["title", "author", "date", "ingredients", "instructions"],
"properties": {
"title": {
"description": "The title of the recipe",
"type": "string"
},
"description": {
"description": "A short sentence describing what the recipe makes",
"type": "string"
},
"author": {
"description": "The author of this recipe",
"type": "object",
"properties": {
"username": {
"description": "The username of the author on the given tilde",
"type": "string"
},
"tilde": {
"description": "Which tilde the user lives on",
"type": "string",
"pattern": "^https?://(.*)\\.(.*)/"
}
},
"required": ["username", "tilde"]
},
"date": {
"description": "The date this recipe was added to the cookbook",
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"source": {
"description": "The source of the recipe, for example, the website or book it was copied from",
"type": "string"
},
"timings": {
"description": "The timings of the recipe",
"type": "object",
"properties": {
"prep": {
"description": "The time it takes to collect, prepare and combine the ingredients into the pot/pan/oven",
"type": "integer",
"minimum": 0
},
"cook": {
"description": "The time it takes to actually cook the dish",
"type": "integer",
"minimum": 0
}
},
"required": ["prep", "cook"]
},
"servings": {
"description": "The number of people this dish serves",
"type": "integer",
"minimum": 1
},
"ingredients": {
"description": "The ingredients needed to complete the recipe",
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"instructions": {
"description": "The steps needed to make the dish",
"type": "array",
"items": {
"type": "string"
}
}
}
}

78
static/main.css Normal file
View File

@ -0,0 +1,78 @@
:root {
--color-muted: #818181;
--color-bg: #fff;
--color-fg: #000;
--color-primary: #009688;
}
@media (prefers-color-scheme: dark) {
:root {
--color-muted: #818181;
--color-bg: #000;
--color-fg: #fff;
--color-primary: #009688;
}
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-size: 1.2em;
line-height: 1.5em;
background: var(--color-bg);
color: var(--color-fg);
}
main {
max-width: 800px;
margin-left: auto;
margin-right: auto;
padding: 2em;
}
#recipe-details {
font-size: 0.9em;
color: var(--color-muted);
}
#recipe-instructions li {
margin-bottom: 25px;
}
#recipe-footer {
font-size: 0.9em;
color: var(--color-muted);
font-style: italic;
}
a {
color: var(--color-primary);
}
a:hover {
text-decoration: none;
}
.recipe-item > * {
display: block;
}
.recipe-item .recipe-title {
font-weight: bold;
}
.recipe-item .recipe-description {
font-style: italic;
font-size: 1rem;
}
.recipe-item .recipe-user {
font-weight: normal;
font-style: italic;
font-size: 0.8rem;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1em;
margin-bottom: 1.2em;
}

2348
yarn.lock Normal file

File diff suppressed because it is too large Load Diff