migrate to Eleventy v3 and ESM, upgrade dependencies
Some checks failed
publish / publish (push) Failing after 4m13s
Some checks failed
publish / publish (push) Failing after 4m13s
This commit is contained in:
parent
84e3af4205
commit
f10dcd9df8
|
@ -8,6 +8,7 @@ eleventyComputed:
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="generator" content="{{ eleventy.generator }}">
|
||||||
<title>{% if title %}{{ title }} | {% endif %}ESE {{ ese.year }}</title>
|
<title>{% if title %}{{ title }} | {% endif %}ESE {{ ese.year }}</title>
|
||||||
<link rel="stylesheet" href="{% getBundleFileUrl "css" %}">
|
<link rel="stylesheet" href="{% getBundleFileUrl "css" %}">
|
||||||
<link rel="stylesheet" href="/aileron.lite.min.css">
|
<link rel="stylesheet" href="/aileron.lite.min.css">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const { ICalCalendar, ICalCalendarMethod } = require('ical-generator')
|
import { ICalCalendar, ICalCalendarMethod } from 'ical-generator';
|
||||||
|
|
||||||
module.exports = class ProgramIcal {
|
export default class ProgramIcal {
|
||||||
getDate(date, time) {
|
getDate(date, time) {
|
||||||
const d = new Date(date);
|
const d = new Date(date);
|
||||||
const [ hours, mins ] = time.split(":");
|
const [ hours, mins ] = time.split(":");
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
const { EleventyHtmlBasePlugin, EleventyI18nPlugin } = require("@11ty/eleventy");
|
import { EleventyHtmlBasePlugin, EleventyI18nPlugin } from "@11ty/eleventy";
|
||||||
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
|
import eleventyNavigationPlugin from "@11ty/eleventy-navigation";
|
||||||
const faviconsPlugin = require("eleventy-plugin-gen-favicons");
|
import Image from "@11ty/eleventy-img";
|
||||||
const bundlerPlugin = require("@11ty/eleventy-plugin-bundle");
|
|
||||||
const pluginIcons = require('eleventy-plugin-icons');
|
|
||||||
const Image = require("@11ty/eleventy-img");
|
|
||||||
const yaml = require("js-yaml");
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
module.exports = function(eleventyConfig) {
|
import faviconsPlugin from "eleventy-plugin-gen-favicons";
|
||||||
|
import pluginIcons from 'eleventy-plugin-icons';
|
||||||
|
import SvgTextToPath from 'svg-text-to-path';
|
||||||
|
import markdownIt from 'markdown-it';
|
||||||
|
import yaml from "js-yaml";
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
export default async function(eleventyConfig) {
|
||||||
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
||||||
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
||||||
eleventyConfig.addPlugin(EleventyI18nPlugin, {
|
eleventyConfig.addPlugin(EleventyI18nPlugin, {
|
||||||
defaultLanguage: "de",
|
defaultLanguage: "de",
|
||||||
});
|
});
|
||||||
eleventyConfig.addPlugin(bundlerPlugin);
|
|
||||||
let fontawesomePath = "node_modules/@fortawesome/fontawesome-free/svgs";
|
let fontawesomePath = "node_modules/@fortawesome/fontawesome-free/svgs";
|
||||||
eleventyConfig.addPlugin(pluginIcons, {
|
eleventyConfig.addPlugin(pluginIcons, {
|
||||||
sources: [
|
sources: [
|
||||||
|
@ -27,15 +28,20 @@ module.exports = function(eleventyConfig) {
|
||||||
});
|
});
|
||||||
eleventyConfig.addPlugin(faviconsPlugin, {});
|
eleventyConfig.addPlugin(faviconsPlugin, {});
|
||||||
|
|
||||||
|
eleventyConfig.addBundle("css", {
|
||||||
|
toFileDirectory: "bundle",
|
||||||
|
});
|
||||||
|
eleventyConfig.addBundle("js");
|
||||||
|
|
||||||
// override icon shortcode to make the SVGs accessible
|
// override icon shortcode to make the SVGs accessible
|
||||||
eleventyConfig.addAsyncShortcode("icon", async function(input, attrs) {
|
eleventyConfig.addAsyncShortcode("icon", async function(input, attrs) {
|
||||||
let out;
|
let out;
|
||||||
if (!attrs || !("title" in attrs)) {
|
if (!attrs || !("title" in attrs)) {
|
||||||
out = await eleventyConfig.nunjucksAsyncShortcodes.rawIcon(input, attrs);
|
out = await eleventyConfig.universal.shortcodes.rawIcon(input, attrs);
|
||||||
} else {
|
} else {
|
||||||
const { title, ...newAttrs } = attrs;
|
const { title, ...newAttrs } = attrs;
|
||||||
newAttrs.role = "img";
|
newAttrs.role = "img";
|
||||||
const svgStr = await eleventyConfig.nunjucksAsyncShortcodes.rawIcon(input, newAttrs);
|
const svgStr = await eleventyConfig.universal.shortcodes.rawIcon(input, newAttrs);
|
||||||
const match = svgStr.match(/(<svg.*?>)(.*$)/s);
|
const match = svgStr.match(/(<svg.*?>)(.*$)/s);
|
||||||
out = match[1] + "<title>" + title + "</title>" + match[2];
|
out = match[1] + "<title>" + title + "</title>" + match[2];
|
||||||
}
|
}
|
||||||
|
@ -71,9 +77,7 @@ module.exports = function(eleventyConfig) {
|
||||||
svg = svg.replaceAll("{{ese.color}}", data.ese.color);
|
svg = svg.replaceAll("{{ese.color}}", data.ese.color);
|
||||||
|
|
||||||
// render text to path
|
// render text to path
|
||||||
// TODO replace with ESM import once we switch to Eleventy v3
|
let session = new SvgTextToPath(svg, {
|
||||||
const Session = (await import('svg-text-to-path')).default;
|
|
||||||
let session = new Session(svg, {
|
|
||||||
fonts: {
|
fonts: {
|
||||||
"Aileron Thin": [{
|
"Aileron Thin": [{
|
||||||
wght: 400,
|
wght: 400,
|
||||||
|
@ -123,8 +127,7 @@ module.exports = function(eleventyConfig) {
|
||||||
};
|
};
|
||||||
|
|
||||||
eleventyConfig.addAsyncFilter('mdInline', async function(value) {
|
eleventyConfig.addAsyncFilter('mdInline', async function(value) {
|
||||||
// TODO replace with ESM import once we switch to Eleventy v3
|
const md = markdownIt();
|
||||||
const md = (await import('markdown-it/index.mjs')).default();
|
|
||||||
|
|
||||||
// customize link rendering
|
// customize link rendering
|
||||||
md.renderer.rules.link_open = md_link_open;
|
md.renderer.rules.link_open = md_link_open;
|
||||||
|
|
1975
package-lock.json
generated
1975
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -3,6 +3,7 @@
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"description": "This is the WIP rewrite of the ESE website.",
|
"description": "This is the WIP rewrite of the ESE website.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "npx @11ty/eleventy --formats=logo.svg",
|
"prebuild": "npx @11ty/eleventy --formats=logo.svg",
|
||||||
"build": "npx @11ty/eleventy --formats=md,njk",
|
"build": "npx @11ty/eleventy --formats=md,njk",
|
||||||
|
@ -12,10 +13,9 @@
|
||||||
"author": "FSR Informatik TU Dresden",
|
"author": "FSR Informatik TU Dresden",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^2.0.1",
|
"@11ty/eleventy": "^3.0.0",
|
||||||
"@11ty/eleventy-img": "^4.0.2",
|
"@11ty/eleventy-img": "^5.0.0",
|
||||||
"@11ty/eleventy-navigation": "^0.3.5",
|
"@11ty/eleventy-navigation": "^0.3.5",
|
||||||
"@11ty/eleventy-plugin-bundle": "^1.0.5",
|
|
||||||
"@fortawesome/fontawesome-free": "^6.6.0",
|
"@fortawesome/fontawesome-free": "^6.6.0",
|
||||||
"eleventy-plugin-gen-favicons": "^1.1.3",
|
"eleventy-plugin-gen-favicons": "^1.1.3",
|
||||||
"eleventy-plugin-icons": "^4.5.1",
|
"eleventy-plugin-icons": "^4.5.1",
|
||||||
|
|
Loading…
Reference in a new issue