From 656f26a5ad2f66159cd1b14ef4a3bc3a1b7804a0 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Thu, 28 Apr 2022 14:49:11 -0500 Subject: [PATCH] Fix eleventy syntax in bundle astro component --- src/components/listing-parts/bundles.astro | 95 ++++++++++++++-------- 1 file changed, 61 insertions(+), 34 deletions(-) diff --git a/src/components/listing-parts/bundles.astro b/src/components/listing-parts/bundles.astro index 9abd7a9..4f38fcb 100644 --- a/src/components/listing-parts/bundles.astro +++ b/src/components/listing-parts/bundles.astro @@ -1,6 +1,8 @@ --- import semver from 'semver' +// import { Code } from 'astro/components' + import { getStatusOfScan } from '~/helpers/statuses.js' import { supportedArchitectures } from '~/helpers/bundles.js' @@ -25,10 +27,10 @@ const hasBundleIdentifiers = Array.isArray( listing.bundles ) { listing.bundles.map( ( [bundleIdentifier, versions] ) => (
{ bundleIdentifier }
@@ -37,46 +39,71 @@ const hasBundleIdentifiers = Array.isArray( listing.bundles ) -
- { listing.bundles.map( ( [bundleIdentifier, versions] ) => ( -
-

{ bundleIdentifier }

+
+ { listing.bundles.map( ( [ bundleIdentifier, unsortedVersions ] ) => { + // console.log( 'unsortedVersions', Object.entries( unsortedVersions )[0] ) + // Sort versions by semver + const versions = Object.entries( unsortedVersions ).sort( ( [ aVersionRaw ], [ bVersionRaw ] ) => { + // const aVersion = aVersionRaw || '0.0.0' + // const bVersion = bVersionRaw || '0.0.0' -
+ return semver.compare( bVersionRaw, aVersionRaw ) + } ) -
+ return ( +
+

{ bundleIdentifier }

- { Object.entries(versions) - .sort((a, b) => new Date(b[1]['Date']) - new Date(a[1]['Date'])) - .map( ( [ version, report ] ) => ( -
-
v{ version }
-
-
- { getStatusOfScan( report, false ) } -
-
- 🖥 Supported Architectures { supportedArchitectures( report ).join(', ') } +
+ +
+ + { versions.map( ( [ version, report ] ) => ( +
+
v{ version }
+
+
+ { getStatusOfScan( report, false ) } +
+
+ 🖥 Supported Architectures { supportedArchitectures( report ).join(', ') } +
+
+ Full Info Plist +
{ JSON.stringify( report['Info Plist'], undefined, 2) }
+
+
+ Full Meta Details +
{ JSON.stringify( report['Macho Meta'], undefined, 2) }
+
-
- Full Info Plist -
{ JSON.stringify(report['Info Plist'], undefined, 2) }
-
-
- Full Meta Details -
{ JSON.stringify(report['Macho Meta'], undefined, 2) }
-
-
- )) } + )) } + +
-
-
- )) } + ) + }) }