convert to ESM, update

This commit is contained in:
madrilene 2024-06-03 11:15:04 +02:00
parent 9c45f782ba
commit 38270f4f22
3 changed files with 133 additions and 140 deletions

View file

@ -1,6 +1,6 @@
const EleventyFetch = require('@11ty/eleventy-fetch'); import EleventyFetch from '@11ty/eleventy-fetch';
module.exports = async function () { export default async function () {
let url = 'https://api.github.com/users/madrilene/repos'; let url = 'https://api.github.com/users/madrilene/repos';
// returning promise // returning promise
@ -11,4 +11,4 @@ module.exports = async function () {
}); });
return data; return data;
}; }

View file

@ -1,5 +1,4 @@
module.exports = { /**
/**
* Returns back some attributes based on whether the * Returns back some attributes based on whether the
* link is active or a parent of an active item. * link is active or a parent of an active item.
* *
@ -7,8 +6,7 @@ module.exports = {
* @param {String} pageUrl - The page context. * @param {String} pageUrl - The page context.
* @returns {String} - The attributes or empty. * @returns {String} - The attributes or empty.
*/ */
export function getLinkActiveState(itemUrl, pageUrl) {
getLinkActiveState(itemUrl, pageUrl) {
let response = ''; let response = '';
if (itemUrl === pageUrl) { if (itemUrl === pageUrl) {
@ -20,9 +18,9 @@ module.exports = {
} }
return response; return response;
}, }
/** /**
* Take an array of keys and return back items that match. * Take an array of keys and return back items that match.
* Note: items in the collection must have a key attribute in * Note: items in the collection must have a key attribute in
* Front Matter. * Front Matter.
@ -31,20 +29,18 @@ module.exports = {
* @param {Array} keys - Collection of keys. * @param {Array} keys - Collection of keys.
* @returns {Array} - Result collection or empty. * @returns {Array} - Result collection or empty.
*/ */
filterCollectionByKeys(collection, keys) { export function filterCollectionByKeys(collection, keys) {
return collection.filter(x => keys.includes(x.data.key)); return collection.filter(x => keys.includes(x.data.key));
}, }
/** /**
* Generates a random UUID (Universally Unique Identifier). * Generates a random UUID (Universally Unique Identifier).
* *
* @returns {string} A random UUID. * @returns {string} A random UUID.
*/ */
export function random() {
random() {
const segment = () => { const segment = () => {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}; };
return `${segment()}-${segment()}-${segment()}`; return `${segment()}-${segment()}-${segment()}`;
} }
};

View file

@ -1,34 +1,33 @@
module.exports = { export const url = process.env.URL || 'http://localhost:8080';
url: process.env.URL || 'http://localhost:8080', export const siteName = 'Eleventy Excellent';
siteName: 'Eleventy Excellent', export const siteDescription =
siteDescription: 'Eleventy starter built around the CSS workflow suggested by buildexcellentwebsit.es';
'Eleventy starter built around the CSS workflow suggested by buildexcellentwebsit.es', export const siteType = 'Person'; // schema
siteType: 'Person', // schema export const locale = 'en_EN';
locale: 'en_EN', export const lang = 'en';
lang: 'en', export const skipContent = 'Skip to content';
skipContent: 'Skip to content', export const author = {
author: {
name: 'Lene Saile', // i.e. Lene Saile - page / blog author's name. Must be set. name: 'Lene Saile', // i.e. Lene Saile - page / blog author's name. Must be set.
avatar: '/favicon.png', avatar: '/icon-512x512.png', // path to the author's avatar. In this case just using a favicon.
email: 'hola@lenesaile.com', // i.e. hola@lenesaile.com - email of the author email: 'hola@lenesaile.com', // i.e. hola@lenesaile.com - email of the author
website: 'https://www.lenesaile.com' // i.e. https.://www.lenesaile.com - the personal site of the author website: 'https://www.lenesaile.com' // i.e. https.://www.lenesaile.com - the personal site of the author
}, };
creator: { export const creator = {
name: 'Lene Saile', // i.e. Lene Saile - creator's (developer) name. name: 'Lene Saile', // i.e. Lene Saile - creator's (developer) name.
email: 'hola@lenesaile.com', email: 'hola@lenesaile.com',
website: 'https://www.lenesaile.com', website: 'https://www.lenesaile.com',
social: 'https://front-end.social/@lene' social: 'https://front-end.social/@lene'
}, };
themeColor: '#DD4462', // Manifest: defines the default theme color for the application export const pathToSvgLogo = 'src/assets/svg/misc/logo.svg'; // used for favicon generation
themeBgColor: '#FBFBFB', // Manifest: defines a placeholder background color for the application page to display before its stylesheet is loaded export const themeColor = '#DD4462'; // Manifest: defines the default theme color for the application
opengraph_default: '/assets/images/template/opengraph-default.jpg', // fallback/default meta image export const themeBgColor = '#FBFBFB'; // Manifest: defines a placeholder background color for the application page to display before its stylesheet is loaded
opengraph_default_alt: export const opengraph_default = '/assets/images/template/opengraph-default.jpg'; // fallback/default meta image
'Visible content: Eleventy starter built around the CSS workflow for Cube CSS, Every Layout, Design Tokens and Tailwind for uitility, based on the concepts explained in buildexcellentwebsit.es', // alt text for default meta image export const opengraph_default_alt =
blog: { 'Visible content: Eleventy starter built around the CSS workflow for Cube CSS, Every Layout, Design Tokens and Tailwind for uitility, based on the concepts explained in buildexcellentwebsit.es'; // alt text for default meta image
export const blog = {
// RSS feed // RSS feed
name: 'My Web Development Blog', name: 'My Web Development Blog',
description: description: 'Tell the word what you are writing about in your blog. It will show up on feed readers.',
'Tell the word what you are writing about in your blog. It will show up on feed readers.',
// feed links are looped over in the head. You may add more to the array. // feed links are looped over in the head. You may add more to the array.
feedLinks: [ feedLinks: [
{ {
@ -47,28 +46,27 @@ module.exports = {
paginationPrevious: 'Previous', paginationPrevious: 'Previous',
paginationNext: 'Next', paginationNext: 'Next',
paginationNumbers: true paginationNumbers: true
}, };
details: { export const details = {
aria: 'section controls', aria: 'section controls',
expand: 'expand all', expand: 'expand all',
collapse: 'collapse all' collapse: 'collapse all'
}, };
navigation: { export const navigation = {
navLabel: 'Menu',
ariaTop: 'Main', ariaTop: 'Main',
ariaBottom: 'Complementary', ariaBottom: 'Complementary',
ariaPlatforms: 'Platforms', ariaPlatforms: 'Platforms',
// activate alternative mobile menu with drawer drawerNav: false
drawerNav: false, };
navLabel: 'Menu' export const themeSwitch = {
},
themeSwitch: {
title: 'Theme', title: 'Theme',
light: 'light', light: 'light',
dark: 'dark', dark: 'dark'
initial: 'select' };
}, export const initial = 'select';
greenweb: { export const greenweb = {
// this goues into src/common/greenweb.njk // this goes into src/common/greenweb.njk
providers: { providers: {
// if you want to add more than one, edit the array directly. // if you want to add more than one, edit the array directly.
domain: 'netlify.com', domain: 'netlify.com',
@ -80,11 +78,10 @@ module.exports = {
doctype: '', doctype: '',
url: '' url: ''
} }
}, };
viewRepo: { export const viewRepo = {
// this is for the view/edit on github link. The value in the package.json will be pulled in. // this is for the view/edit on github link. The value in the package.json will be pulled in.
allow: true, allow: true,
infoText: 'View this page on GitHub' infoText: 'View this page on GitHub'
},
easteregg: true
}; };
export const easteregg = true;