From f8e750dc2a58eb7cc4ac34c95e4652ce033dd528 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Mon, 10 May 2021 12:05:23 -0500 Subject: [PATCH 1/2] Add more eleventy devs scripts # Conflicts: # package.json --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 7d1bc97..60d9954 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "generate-eleventy": "node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet", "generate-postcss": "ENV=production postcss assets/css/tailwind.css --o static/tailwind.css", "dev-eleventy": "node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet --watch --serve", + "dev-eleventy-debug": "DEBUG=Eleventy* node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet --watch --serve", + "dev-eleventy-benchmark": "DEBUG=Eleventy:Benchmark* node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet --watch --serve", + "dev-eleventy-computed": "DEBUG=Eleventy:ComputedData* node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet --watch --serve", "lint": "eslint --ext .js,.vue --ignore-path .gitignore .", "lint:fix": "eslint --fix --ext .js,.vue --ignore-path .gitignore .", "precommit": "npm run lint", From 6bf7c71465c43d886c999f80753244b6e7344c6d Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Fri, 14 May 2021 17:36:46 -0500 Subject: [PATCH 2/2] List app aliases --- pages-eleventy/app.11ty.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pages-eleventy/app.11ty.js b/pages-eleventy/app.11ty.js index f77b64e..d785ca7 100644 --- a/pages-eleventy/app.11ty.js +++ b/pages-eleventy/app.11ty.js @@ -23,6 +23,20 @@ export const makeDescription = function ( app ) { return `Latest reported support status of ${ app.name } on Apple Silicon and Apple M1 Processors.` } +// https://stackoverflow.com/a/15069646/1397641 +function makeEnglishList ( array, conjunction = 'and' ) { + const total = array.length + + if ( total < 3 ) return array.join(` ${conjunction} `) + + array = array.slice() + + // Prepend conjunction to final part + array[ total-1 ] = `${ conjunction } ${ array[ total-1 ] }` + + return array.join(', ') +} + export function renderPageLinksHtml ( links ) { return links.map( (link, i) => { @@ -94,6 +108,8 @@ export class AppTemplate { // console.log('video.payload', Object.keys(video.payload)) + const hasMultipleAliases = !!app.aliases && app.aliases.length > 1 + const appDeviceSupport = deviceList.map( device => { const supportsApp = deviceSupportsApp( device, app ) return { @@ -117,6 +133,10 @@ export class AppTemplate { ${ app.text } + ${ hasMultipleAliases ? /* html */` + May also be known as ${ makeEnglishList( app.aliases, 'or' ) } + ` : '' } +