chore: replace Sculpin with Astro

This commit is contained in:
Oliver Davies 2022-10-07 09:14:10 +01:00
parent d0ef96dead
commit d1b76dda33
830 changed files with 5819 additions and 10532 deletions

View file

@ -27,9 +27,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: cp .env.example .env
working-directory: ./website
- run: |
just push-images ${{ github.sha }}

View file

@ -1 +0,0 @@
# oliverdavies.uk

View file

@ -1 +0,0 @@
/workspace.yml

View file

@ -1,29 +0,0 @@
# This file is used by editors and IDEs to unify coding standards
# @see http://EditorConfig.org
# @standards PHP: http://www.php-fig.org/psr/psr-2/
root = true
# Default configuration (applies to all file types)
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 4
indent_style = space
# Markdown customizations
[*.md]
trim_trailing_whitespace = false
[docker-compose.yaml,Dockerfile]
indent_size = 2
[*.pcss]
indent_size = 2
[{postcss,tailwind,webpack}.config.js]
indent_size = 2
[tools/tailwindcss/**/*.js]
indent_size = 2

View file

@ -1,31 +0,0 @@
COMPOSE_PROJECT_NAME=oliverdavies-uk
# The volume to store the generated output files.
#
# For development, an anonymous volume should be sufficient as the generated
# files don't need to be accessible locally.
#
# For production, you may want to output the files into a directory so that
# they can be served by a web server like Apache or Nginx.
#DOCKER_OUTPUT_VOLUME=./output_dev:/app/output_dev
#DOCKER_OUTPUT_VOLUME=./output_prod:/app/output_prod
DOCKER_OUTPUT_VOLUME=/app/output_dev
# The environment to generate the site for (e.g. dev or prod).
# SCULPIN_ENV=prod
# NODE_ENV=production
SCULPIN_ENV=dev
NODE_ENV=development
# The port on which to serve the site if the --server option is specified.
#SCULPIN_PORT=80
SCULPIN_PORT=8000
# The default URL to use if one hasn't been specified in the environment's
# configuration file.
#SCULPIN_URL=https://example.com
SCULPIN_URL=http://localhost
# Any additional arguments to pass to the "sculpin generate" command.
#SCULPIN_GENERATE_ARGS=
SCULPIN_GENERATE_ARGS="--output-dir=/output/html --server --watch"

28
website/.gitignore vendored
View file

@ -1,8 +1,20 @@
/.env
/.phpunit.cache
/build/
/docker-compose.override.yaml
/output/
/output_*/
/source/build/
/vendor/
# build output
dist/
.output/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store

View file

@ -1,76 +1,38 @@
FROM node:14-alpine AS assets
FROM node:14-bullseye-slim AS base
ARG NODE_ENV="production"
ARG SCULPIN_ENV="prod"
ENV NODE_ENV="${NODE_ENV}" \
PATH="${PATH}:/node_modules/.bin" \
SCULPIN_ENV="${SCULPIN_ENV}" \
USER="node"
RUN apk add --no-cache bash
WORKDIR /app/assets
WORKDIR /app
RUN mkdir -p /node_modules \
&& chown node:node -R /app /node_modules
###
FROM base AS build
USER node
COPY --chown=node:node assets/*yarn* assets/package.json ./
COPY --chown=node:node *yarn* package.json ./
RUN yarn install && yarn cache clean
COPY --chown=node:node . ..
COPY --chown=node:node . .
RUN if [ "${NODE_ENV}" != "development" ]; then \
../run yarn:build:css && ../run yarn:build:js; \
yarn build; \
else mkdir -p /app/build; fi
CMD ["bash"]
###
FROM opdavies/sculpin-serve AS app
WORKDIR /app
RUN mkdir /output \
&& chown sculpin:sculpin -R /output
###
FROM app AS build
ENV PATH=$PATH:/app/vendor/bin/phpunit
COPY tools/docker/images/app/root /
WORKDIR /app
USER sculpin
COPY --chown=sculpin:sculpin composer.* ./
RUN composer install --no-dev
COPY --chown=sculpin:sculpin app app
COPY --chown=sculpin:sculpin source source
COPY --chown=sculpin:sculpin src src
RUN sculpin generate --env prod --output-dir /output/html
COPY --chown=sculpin:sculpin . .
COPY --chown=sculpin:sculpin --from=assets /app/build build
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
CMD ["bash"]
###
FROM alpine AS production
COPY --from=build /output/html /app
COPY --from=assets /app/build /app/build
COPY --from=build /app/dist /app
CMD ["sh"]
CMD ["bash"]

View file

@ -1,21 +0,0 @@
<?php
declare(strict_types=1);
use Opdavies\Sculpin\Bundle\GistEmbedBundle\SculpinGistEmbedBundle;
use Opdavies\Sculpin\Bundle\TwigMarkdownBundle\SculpinTwigMarkdownBundle;
use Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel;
final class SculpinKernel extends AbstractKernel
{
/**
* {@inheritdoc}
*/
protected function getAdditionalSculpinBundles(): array
{
return [
SculpinGistEmbedBundle::class,
SculpinTwigMarkdownBundle::class,
];
}
}

View file

@ -1,18 +0,0 @@
sculpin_content_types:
daily_emails:
permalink: archive/:year/:month/:day/:basename/
pages:
permalink: /:basename/
posts:
permalink: blog/:basename/
taxonomies: [tags]
projects:
layout: default
permalink: projects/:basename/
talks:
permalink: talks/:basename/
services:
App\TwigExtension\TalkExtension:
tags:
- { name: twig.extension }

View file

@ -1,75 +0,0 @@
name: Oliver Davies
description: Drupal Developer and Consultant
locale: en-GB
avatar:
path: "/images/social-avatar.jpg"
drupalorg:
name: opdavies
url: 'https://www.drupal.org/u/%drupalorg.name%'
email: oliver@oliverdavies.uk
experience:
start_year: 2007
github:
gist:
url: 'https://gist.github.com/%github.name%'
name: opdavies
url: 'https://github.com/%github.name%'
linkedin:
name: opdavies
url: 'https://www.linkedin.com/in/%linkedin.name%'
menus:
footer:
- title: About
href: /
is_active: '^//$'
- title: Blog
href: /blog
is_active: '^/blog/?'
- title: Talks
href: /talks
is_active: '^/talks/?'
- title: Recommendations
href: /recommendations
- title: Daily list
href: /daily
main: []
packagist:
name: opdavies
url: 'https://packagist.org/packages/%packagist.name%'
plausible:
domain: ~
savvycal:
name: opdavies
url: 'https://savvycal.com/%savvycal.name%'
speakerdeck:
name: opdavies
url: 'https://speakerdeck.com/%speakerdeck.name%'
twitter:
name: opdavies
url: 'https://twitter.com/%twitter.name%'
work:
company:
name: Transport for Wales
url: https://tfw.wales
role: Lead Software Developer
youtube:
channel:
id: UCkeK0qF9HHUPQH_fvn4ghqQ
url: 'https://www.youtube.com/channel/%youtube.channel.id%'

View file

@ -1,8 +0,0 @@
---
imports:
- sculpin_site.yml
plausible:
domain: 'oliverdavies.uk'
url: https://www.oliverdavies.uk

View file

@ -1,29 +0,0 @@
const esbuild = require("esbuild");
let minify = false;
let sourcemap = true;
let watch_fs = true;
if (process.env.NODE_ENV === "production") {
minify = true;
sourcemap = false;
watch_fs = false;
}
const watch = watch_fs && {
onRebuild(error) {
if (error) console.error("[watch] build failed", error);
else console.log("[watch] build finished");
},
};
console.log(watch);
esbuild.build({
entryPoints: ["./js/app.js"],
outfile: "/app/build/app.js",
bundle: true,
minify: minify,
sourcemap: sourcemap,
watch: watch,
plugins: [],
});

View file

@ -1,19 +0,0 @@
import "focus-visible";
import bash from "highlight.js/lib/languages/bash";
import hljs from "highlight.js/lib/core";
import ini from "highlight.js/lib/languages/ini";
import javascript from "highlight.js/lib/languages/javascript";
import php from "highlight.js/lib/languages/php";
import yaml from "highlight.js/lib/languages/yaml";
hljs.registerLanguage("bash", bash);
hljs.registerLanguage("ini", ini);
hljs.registerLanguage("javascript", javascript);
hljs.registerLanguage("php", php);
hljs.registerLanguage("yaml", yaml);
document.addEventListener("DOMContentLoaded", (event) => {
document.querySelectorAll("pre code").forEach((element) => {
hljs.highlightElement(element);
});
});

View file

@ -1,22 +0,0 @@
{
"private": true,
"scripts": {
"build:css": "./run yarn:build:css"
},
"dependencies": {
"@tailwindcss/aspect-ratio": "^0.2.0",
"@tailwindcss/forms": "^0.2.1",
"@tailwindcss/typography": "^0.4.0",
"alpinejs": "^2.3.5",
"autoprefixer": "^10.2.5",
"elliptic": ">=6.5.3",
"esbuild": "^0.14.10",
"focus-visible": "^5.1.0",
"highlight.js": "^10.4.1",
"lodash": ">=4.17.19",
"postcss": "^8.2.1",
"postcss-easy-import": "^3.0.0",
"postcss-nested": "^5.0.5",
"tailwindcss": "2"
}
}

View file

@ -1,10 +0,0 @@
module.exports = {
plugins: {
'postcss-easy-import': {
extensions: ['.css', '.pcss']
},
tailwindcss: {},
'postcss-nested': {},
autoprefixer: {}
}
}

File diff suppressed because it is too large Load diff

15
website/astro.config.mjs Normal file
View file

@ -0,0 +1,15 @@
import { defineConfig } from 'astro/config';
import alpinejs from "@astrojs/alpinejs";
import tailwind from "@astrojs/tailwind";
import mdx from "@astrojs/mdx";
// https://astro.build/config
export default defineConfig({
integrations: [alpinejs(), tailwind({
config: {
applyBaseStyles: false
}
}), mdx()],
site: 'https://www.oliverdavies.uk',
});

View file

@ -1,50 +0,0 @@
{
"name": "opdavies/sculpin-skeleton",
"description": "A skeleton Sculpin site.",
"license": "MIT",
"authors": [
{
"name": "Oliver Davies",
"email": "oliver@oliverdavies.uk",
"homepage": "https://www.oliverdavies.uk"
}
],
"require": {
"illuminate/collections": "^8.55",
"nesbot/carbon": "^2.52",
"opdavies/sculpin-gist-embed-bundle": "^0.1.0",
"opdavies/sculpin-twig-markdown-bundle": "^0.2.0",
"sculpin/sculpin": "^3.0"
},
"scripts": {
"dev": "composer run-script generate",
"generate": "sculpin generate --clean --no-interaction",
"prod": "composer run-script generate -- --env prod",
"watch": "composer run-script --timeout=0 generate -- --server --watch"
},
"config": {
"sort-packages": true
},
"require-dev": {
"phpstan/phpstan": "^0.12.98",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"extra": {
"violinist": {
"one_pull_request_per_package": 1,
"run_scripts": 0,
"bundled_packages": {},
"blacklist": []
}
}
}

6293
website/composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,20 +0,0 @@
x-assets: &default-assets
build:
context: "."
target: "assets"
env_file:
- ".env"
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
tty: true
volumes:
- ".:/app"
services:
css:
<<: *default-assets
command: "../run yarn:build:css"
js:
<<: *default-assets
command: "../run yarn:build:js"

View file

@ -1,22 +0,0 @@
services:
app:
build:
context: .
target: build
image: "ghcr.io/opdavies/oliverdavies.uk-web:${DOCKER_TAG:-latest}"
command: "sculpin generate --clean --no-interaction --url ${SCULPIN_URL:-http://localhost} --env ${SCULPIN_ENV:-dev} ${SCULPIN_GENERATE_ARGS}"
volumes:
- .:/app
tty: true
expose:
- 8000
networks:
- web
labels:
- "traefik.docker.network=traefik_proxy"
- "traefik.http.routers.oliverdavies.rule=Host(`oliverdavies.docker.localhost`)"
networks:
web:
external:
name: traefik_proxy

View file

@ -1,21 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
readonly DRAFTS_DIR="${HOME}/Code/Personal/oliverdavies.uk/source/_posts"
if [[ $# -eq 0 ]]; then
grep -lr "draft: true" "${DRAFTS_DIR}" | cut -d"/" -f9- | tr ".md" "" | sort
exit 0
fi
readonly DRAFTS_FILE="${*}.md"
readonly DRAFTS_PATH="${DRAFTS_DIR}/${DRAFTS_FILE// /-}"
echo $DRAFTS_PATH
if [[ -e "${DRAFTS_PATH}" ]]; then
eval "${EDITOR}" "${DRAFTS_PATH}"
else
touch "${DRAFTS_PATH}"
fi

29
website/package.json Normal file
View file

@ -0,0 +1,29 @@
{
"name": "@example/basics",
"type": "module",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/alpinejs": "^0.1.2",
"@astrojs/mdx": "^0.11.4",
"@astrojs/rss": "^1.0.2",
"@astrojs/tailwind": "^2.0.2",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
"@tailwindcss/typography": "^0.5.7",
"@types/alpinejs": "^3.0.0",
"alpinejs": "^3.0.0",
"astro": "^1.4.5",
"lodash": "^4.17.21",
"postcss-import": "^15.0.0",
"tailwindcss": "^3.0.24"
}
}

View file

@ -1,4 +0,0 @@
parameters:
level: max
paths:
- src

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
colors="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>

View file

@ -0,0 +1,8 @@
module.exports = {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {}
}
}

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 36 36">
<path fill="#000" d="M22.25 4h-8.5a1 1 0 0 0-.96.73l-5.54 19.4a.5.5 0 0 0 .62.62l5.05-1.44a2 2 0 0 0 1.38-1.4l3.22-11.66a.5.5 0 0 1 .96 0l3.22 11.67a2 2 0 0 0 1.38 1.39l5.05 1.44a.5.5 0 0 0 .62-.62l-5.54-19.4a1 1 0 0 0-.96-.73Z"/>
<path fill="url(#gradient)" d="M18 28a7.63 7.63 0 0 1-5-2c-1.4 2.1-.35 4.35.6 5.55.14.17.41.07.47-.15.44-1.8 2.93-1.22 2.93.6 0 2.28.87 3.4 1.72 3.81.34.16.59-.2.49-.56-.31-1.05-.29-2.46 1.29-3.25 3-1.5 3.17-4.83 2.5-6-.67.67-2.6 2-5 2Z"/>
<defs>
<linearGradient id="gradient" x1="16" x2="16" y1="32" y2="24" gradientUnits="userSpaceOnUse">
<stop stop-color="#000"/>
<stop offset="1" stop-color="#000" stop-opacity="0"/>
</linearGradient>
</defs>
<style>
@media (prefers-color-scheme:dark){:root{filter:invert(100%)}}
</style>
</svg>

After

Width:  |  Height:  |  Size: 873 B

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View file

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View file

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View file

Before

Width:  |  Height:  |  Size: 530 KiB

After

Width:  |  Height:  |  Size: 530 KiB

View file

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View file

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

View file

Before

Width:  |  Height:  |  Size: 811 KiB

After

Width:  |  Height:  |  Size: 811 KiB

View file

Before

Width:  |  Height:  |  Size: 854 KiB

After

Width:  |  Height:  |  Size: 854 KiB

View file

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 257 KiB

View file

Before

Width:  |  Height:  |  Size: 285 KiB

After

Width:  |  Height:  |  Size: 285 KiB

View file

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

View file

Before

Width:  |  Height:  |  Size: 884 KiB

After

Width:  |  Height:  |  Size: 884 KiB

View file

Before

Width:  |  Height:  |  Size: 275 KiB

After

Width:  |  Height:  |  Size: 275 KiB

View file

Before

Width:  |  Height:  |  Size: 249 KiB

After

Width:  |  Height:  |  Size: 249 KiB

View file

Before

Width:  |  Height:  |  Size: 323 KiB

After

Width:  |  Height:  |  Size: 323 KiB

View file

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View file

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View file

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 281 KiB

After

Width:  |  Height:  |  Size: 281 KiB

View file

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 236 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View file

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View file

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View file

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View file

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 176 KiB

View file

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View file

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View file

Before

Width:  |  Height:  |  Size: 250 KiB

After

Width:  |  Height:  |  Size: 250 KiB

View file

Before

Width:  |  Height:  |  Size: 165 KiB

After

Width:  |  Height:  |  Size: 165 KiB

View file

Before

Width:  |  Height:  |  Size: 652 KiB

After

Width:  |  Height:  |  Size: 652 KiB

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