Skip to content

Commit ad88c2e

Browse files
committed
move to fastly
- add logging, content fetch - various fixes around deployability via Vercel (dependencies, etc)
1 parent a2107e0 commit ad88c2e

18 files changed

Lines changed: 3700 additions & 6 deletions

.envrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export FASTLY_SERVICE_ID="lACFUzQjUGLnZsvoHgcnx6"
2+
export PATH="$PATH:$PWD/compute-js/bin"
3+
4+
[[ -f .envrc.local ]] && source .envrc.local

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Public output
22
site/
33
public/
4+
build/
45

56
# Docs sources
67
docs/
8+
9+
# mkdocs cache
10+
.cache
11+
12+
# dev envrc
13+
.envrc.local

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ repos:
99
- id: check-yaml
1010
args: [--unsafe]
1111
- id: check-added-large-files
12+
- repo: https://github.com/boidolr/pre-commit-images
13+
rev: v1.5.2
14+
hooks:
15+
- id: optimize-png
16+
- id: optimize-svg
17+
- id: optimize-jpg

build-all.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
test -d build || mkdir build
4+
5+
cleanup() {
6+
echo -e "\nScript interrupted. Exiting..."
7+
exit 1
8+
}
9+
10+
trap cleanup INT
11+
12+
source .envrc
13+
14+
# Build the site
15+
mkdocs build -d build/site
16+
17+
# hardlink duplicates
18+
command -v hardlink && hardlink -t build/site || echo "no hardlink in $PATH"
19+
20+
MINIFY=$(command -v minify || echo "./compute-js/bin/minify")
21+
# minify everything
22+
test -d build/minified || $MINIFY -r --sync --preserve=all -o build/minified build/site
23+
24+
# remove locales from minified (Fastly) site
25+
for locale in $(yq -r '.plugins[] | select(type == "object" and has("i18n")) | .i18n.languages[].locale' < mkdocs.yml | grep -v 'en'); do
26+
rm -fr "build/minified/site/$locale"
27+
done

compute-js/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules
2+
/bin
3+
/pkg
4+
/static-publisher

compute-js/.publish-id

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Generated by @fastly/compute-js-static-publish.
2+
2qS5iaeanC9NRRLK1pSoYu

compute-js/fastly.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file describes a Fastly Compute package. To learn more visit:
2+
# https://developer.fastly.com/reference/fastly-toml/
3+
4+
authors = [ "neil@resf.org" ]
5+
description = "Rocky Linux Documentation Site"
6+
language = "javascript"
7+
manifest_version = 2
8+
name = "@resf/rocky-linux-docs"
9+
service_id = "lACFUzQjUGLnZsvoHgcnx6"
10+
# kv_store_name = "mkdocs"
11+
12+
[scripts]
13+
build = "npm run build"
14+
15+
[local_server]
16+
[local_server.backends]
17+
[local_server.backends.docs-vercel]
18+
url = "https://cname.vercel-dns.com/"
19+
override_host = "docs.rockylinux.org"

0 commit comments

Comments
 (0)