import dotenv from 'dotenv' import config from '../nuxt.config.js' import { getAppType, getRouteType } from '../helpers/app-derived.js' import { deviceSupportsApp } from '../helpers/devices.js' import { makeLastUpdatedFriendly } from '../helpers/parse-date.js' import { getStatusOfScan } from '../helpers/statuses.js' import VideoRow from '../components-eleventy/video/row.js' // import VideoRow from '../components-eleventy/video/row.js' // import { isVideo } from '../helpers/app-derived' // Setup dotenv dotenv.config() function isString( maybeString ) { return (typeof maybeString === 'string' || maybeString instanceof String) } export const makeTitle = function ( app ) { return `Does ${app.name} work on Apple Silicon? - ${ config.head.title }` } export const makeDescription = function ( app ) { return `Latest reported support status of ${ app.name } on Apple Silicon and Apple M1 Pro and M1 Max 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) => { const notAppTestLink = !link.label.includes('๐งช') const isMainLink = (i === 0) && notAppTestLink return /* html */` ${ isMainLink ? 'View' : link.label } ` } ).join('') } export function supportedArchitectures ( appScan ) { // if ( Array.isArray(appScan['Macho Meta']) ) { // return appScan['Macho Meta'].map( architecture => architecture.processorType) // } // console.log('meta', appScan['Macho Meta']) if ( appScan['Macho Meta'].architectures === undefined ) return [] return appScan['Macho Meta'].architectures .map( architecture => architecture.processorType) .filter(processorType => Number(processorType) !== 0) } function renderBundleDataLevel ( bundleLevelData, depth = 0 ) { const levelContainerClassses = 'border rounded-lg bg-black bg-opacity-10 space-y-4 p-4 mt-4' const maxDepth = 2 if ( isString(bundleLevelData) ) { return bundleLevelData } if ( depth >= maxDepth ) { return /* html */`
${ JSON.stringify(bundleLevelData, undefined, 2) }`
}
if ( Array.isArray( bundleLevelData ) ) {
const htmlList = bundleLevelData.map( ( bundleLevel ) => {
return /* html */`${ JSON.stringify(report['Info Plist'], undefined, 2) }
${ JSON.stringify(report['Macho Meta'], undefined, 2) }