Skip to content

Commit

Permalink
upgrade to bliss 2.3.4 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucascantor authored Oct 9, 2023
1 parent e4b0b03 commit 608d583
Show file tree
Hide file tree
Showing 41 changed files with 2,389 additions and 1,876 deletions.
21 changes: 17 additions & 4 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ const {
initialSetup,
layoutAliases,
collections,
transforms,
shortcodes,
filters,
plugins,
constants,
events,
} = require('./_11ty');
const minifyHTML = require('./_11ty/transforms/minifyHTML');
const minifyJS = require('./_11ty/transforms/minifyJS');
const minifyJSON = require('./_11ty/transforms/minifyJSON');
const minifyXML = require('./_11ty/transforms/minifyXML');

module.exports = function (eleventyConfig) {
// --- Initial config
Expand All @@ -28,9 +32,10 @@ module.exports = function (eleventyConfig) {

// --- Transformations

Object.values(transforms).forEach(({ name, body }) => {
eleventyConfig.addTransform(name, body);
});
eleventyConfig.addTransform('minifyHTML', minifyHTML);
eleventyConfig.addTransform('minifyJSON', minifyJSON);
eleventyConfig.addTransform('minifyXML', minifyXML);
eleventyConfig.addTransform('minifyJS', minifyJS);

// --- Filters

Expand All @@ -50,6 +55,14 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(body, options && options);
});

// --- After build events

if (events.after.length > 0) {
Object.values(events.after).forEach((afterBuildEvent) => {
eleventyConfig.on('eleventy.after', afterBuildEvent);
});
}

// --- Consolidating everything under content folder

return {
Expand Down
63 changes: 63 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
queue_rules:
- name: default
conditions:
- status-success=Vercel

pull_request_rules:
- name: Automatic merge of Snyk dependency upgrades (bot)
conditions:
- author=snyk-bot
- -conflict
- status-success=Vercel
actions:
queue:
method: squash
name: default
- name: Automatic merge of Snyk dependency upgrades (me)
conditions:
- author=lwojcik
- title~=[Snyk]
- title~=Upgrade
- -conflict
- status-success=Vercel
actions:
queue:
method: squash
name: default
- name: Automatic merge of Dependabot dependency upgrades
conditions:
- author=dependabot[bot]
- -conflict
- status-success=Vercel
actions:
queue:
method: squash
name: default
- name: Ask to resolve conflict
conditions:
- conflict
actions:
comment:
message: This pull request is now in conflicts. Could you fix it @{{author}}?
- name: Automatic merge of owner-made PRs for main when CI passes and owner approves
conditions:
- status-success=Vercel
- author=lwojcik
- base=main
- label!=work-in-progress
- label=ready-to-merge
actions:
queue:
method: squash
name: default
- name: Automatic merge of PRs for main when CI passes and owner approves
conditions:
- status-success=Vercel
- base=main
- label!=work-in-progress
- approved-reviews-by=lwojcik
- label=ready-to-merge
actions:
queue:
method: squash
name: default
85 changes: 0 additions & 85 deletions README.md

This file was deleted.

7 changes: 6 additions & 1 deletion _11ty/collections/tagList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const moduleName = require('../helpers/moduleName');
const { EXCLUDED_TAGS } = require('../constants');
const siteConfig = require('../../content/_data/siteConfig');

const { language, options } = siteConfig.localeSort;

module.exports = {
name: moduleName(__filename),
Expand All @@ -11,6 +14,8 @@ module.exports = {
.filter((tag) => !EXCLUDED_TAGS.includes(tag))
.forEach((tag) => tagsSet.add(tag));
});
return Array.from(tagsSet).sort();
return Array.from(tagsSet).sort((a, b) =>
a.localeCompare(b, language, options)
);
},
};
2 changes: 1 addition & 1 deletion _11ty/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
POST_COLLECTION_TAG_NAME: 'post',
PAGE_COLLECTION_TAG_NAME: 'page',
POSTS_PER_TAG_PAGE: siteConfig.tags.postsPerPage,
IS_PRODUCTION: process.env.NODE_ENV === 'production',
IS_PRODUCTION: process.env.ELEVENTY_ENV === 'production',
SLUGIFY_CONFIG: {
replacement: '-',
lower: true,
Expand Down
7 changes: 7 additions & 0 deletions _11ty/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const socialImages = require('./events/socialImages');

const afterBuildEvents = [socialImages];

module.exports = {
after: afterBuildEvents,
};
39 changes: 39 additions & 0 deletions _11ty/events/socialImages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const fs = require('fs');
const path = require('path');
const Image = require('@11ty/eleventy-img');
const siteConfig = require('../../content/_data/siteConfig');

const SOCIAL_PREVIEW_IMAGES_DIR = path.join('_site', 'images', 'share');
const OUTPUT_IMAGE_EXTENSION = 'jpg';

module.exports = () => {
const files = fs.readdirSync(SOCIAL_PREVIEW_IMAGES_DIR);

if (siteConfig.opengraph.enableImageGeneration) {
if (files && files.length > 0) {
files.forEach(async (filename) => {
if (filename.endsWith('.svg')) {
const imageUrl = path.join(SOCIAL_PREVIEW_IMAGES_DIR, filename);

await Image(imageUrl, {
formats: ['jpeg'],
outputDir: path.join('.', SOCIAL_PREVIEW_IMAGES_DIR),
filenameFormat: () => {
const outputFilename = filename.substring(0, filename.length - 4);

return `${outputFilename}.${OUTPUT_IMAGE_EXTENSION}`;
},
});

// we no longer need SVG files after converting to JPG so we remove them

// fs.unlinkSync(imageUrl);
}
});
}
} else {
// If OG image generation is off, SVG files are not needed,
// so we remove them from the build
fs.rmSync(SOCIAL_PREVIEW_IMAGES_DIR, { recursive: true, force: true });
}
};
30 changes: 30 additions & 0 deletions _11ty/filters/splitlines.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const moduleName = require('../helpers/moduleName');

const CHARACTERS_PER_LINE = 14;

const body = (input) => {
const parts = input.split(' ');

const lines = parts.reduce((prev, current) => {
if (!prev.length) {
return [current];
}

const lastOne = prev[prev.length - 1];

if (lastOne.length + current.length > CHARACTERS_PER_LINE) {
return [...prev, current];
}

prev[prev.length - 1] = lastOne + ' ' + current;

return prev;
}, []);

return lines;
};

module.exports = {
name: moduleName(__filename),
body,
};
5 changes: 4 additions & 1 deletion _11ty/helpers/getCollectionKeyValues.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const slugifyString = require('./slugifyString');
const siteConfig = require('../../content/_data/siteConfig');

const { language, options } = siteConfig.localeSort;

/**
* Returns array of unique key values for passed collection
Expand All @@ -12,7 +15,7 @@ const uniqueKeyValues = (collection, key) => {
let collectionKeyValues = collection
.filter((item) => key in item.data)
.flatMap((item) => item.data[key])
.sort((a, b) => a.localeCompare(b, 'en', { sensitivity: 'base' }));
.sort((a, b) => a.localeCompare(b, language, options));

// dedupe
let uniqueValues = [...new Set(collectionKeyValues)];
Expand Down
2 changes: 2 additions & 0 deletions _11ty/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const shortcodes = requireDir('./shortcodes');
const filters = requireDir('./filters');
const plugins = require('./plugins');
const constants = require('./constants');
const events = require('./events');

module.exports = {
initialSetup,
Expand All @@ -17,4 +18,5 @@ module.exports = {
filters,
plugins,
constants,
events,
};
Loading

0 comments on commit 608d583

Please sign in to comment.