website: update 11ty to v3

This commit is contained in:
Starbeamrainbowlabs 2024-10-02 00:21:05 +01:00
parent f56b4ff8f6
commit 1f8ad8e106
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 1543 additions and 1850 deletions

View file

@ -11,6 +11,7 @@
<link rel="icon" href="{% image_urlpass '../worldeditadditions.png' %}" type="image/png" sizes="540x540" /> <link rel="icon" href="{% image_urlpass '../worldeditadditions.png' %}" type="image/png" sizes="540x540" />
<meta name="theme-color" content="#61b4f4" /> <meta name="theme-color" content="#61b4f4" />
<meta name="generator" content="{{ eleventy.generator }}" />
<!-- OpenGraph --> <!-- OpenGraph -->
<meta property="og:title" content="WorldEditAdditions" /> <meta property="og:title" content="WorldEditAdditions" />

View file

@ -1,21 +1,25 @@
"use strict"; "use strict";
const os = require("os"); import os from "os";
const fs = require("fs"); import fs from "fs";
const path = require("path"); import path from "path";
const debug = require("debug"); import debug from "debug";
const htmlentities = require("html-entities"); import htmlentities from "html-entities";
const phin = require("phin"); import phin from "phin";
const CleanCSS = require("clean-css"); import CleanCSS from "clean-css";
const { minify: minify_html } = require("html-minifier-terser"); import { minify as minify_html } from "html-minifier-terser";
const moondoc_runner = require("./lib/moondoc_runner.js"); import UpgradeHelper from "@11ty/eleventy-upgrade-help";
const HTMLPicture = require("./lib/HTMLPicture.js");
const FileFetcher = require("./lib/FileFetcher.js");
import moondoc_runner from "./lib/moondoc_runner.js";
import HTMLPicture from "./lib/HTMLPicture.js";
import FileFetcher from "./lib/FileFetcher.js";
const file_fetcher = new FileFetcher(); const file_fetcher = new FileFetcher();
// HACK: Make sure __dirname is defined when using es6 modules. I forget where I found this - a PR with a source URL would be great!
const __dirname = import.meta.url.slice(7, import.meta.url.lastIndexOf("/"));
const is_production = typeof process.env.NODE_ENV === "string" && process.env.NODE_ENV === "production"; const is_production = typeof process.env.NODE_ENV === "string" && process.env.NODE_ENV === "production";
var nextid = 0; var nextid = 0;
@ -120,11 +124,12 @@ async function do_minify_html(source, output_path) {
if(is_production) console.log("Production environment detected, minifying content"); if(is_production) console.log("Production environment detected, minifying content");
module.exports = function(eleventyConfig) { export default function config(eleventyConfig) {
moondoc_runner( moondoc_runner(
path.resolve(__dirname, "_site/api/index.html") path.resolve(__dirname, "_site/api/index.html")
); );
eleventyConfig.addPlugin(UpgradeHelper);
eleventyConfig.addTransform("cssmin", do_minify_css); eleventyConfig.addTransform("cssmin", do_minify_css);
eleventyConfig.addTransform("htmlmin", do_minify_html); eleventyConfig.addTransform("htmlmin", do_minify_html);

3356
.docs/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -20,8 +20,9 @@
}, },
"homepage": "https://github.com/sbrl/Minetest-WorldEditAdditions#readme", "homepage": "https://github.com/sbrl/Minetest-WorldEditAdditions#readme",
"dependencies": { "dependencies": {
"@11ty/eleventy": "^2.0.1", "@11ty/eleventy": "^3.0.0",
"chroma-js": "^2.4.2", "@11ty/eleventy-upgrade-help": "^3.0.1",
"chroma-js": "^3.1.1",
"clean-css": "^5.3.2", "clean-css": "^5.3.2",
"columnify": "^1.6.0", "columnify": "^1.6.0",
"debug": "^4.3.7", "debug": "^4.3.7",